Skip to content

Commit

Permalink
Support parameter to override builder region (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangra committed May 8, 2024
1 parent 9c32a87 commit 3883e36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions resource_remote_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package fly

import "context"

func (client *Client) EnsureRemoteBuilder(ctx context.Context, orgID, appName string) (*GqlMachine, *App, error) {
func (client *Client) EnsureRemoteBuilder(ctx context.Context, orgID, appName, region string) (*GqlMachine, *App, error) {
query := `
mutation($input: EnsureMachineRemoteBuilderInput!) {
ensureMachineRemoteBuilder(input: $input) {
Expand Down Expand Up @@ -31,16 +31,16 @@ func (client *Client) EnsureRemoteBuilder(ctx context.Context, orgID, appName st
req := client.NewRequest(query)
ctx = ctxWithAction(ctx, "ensure_remote_builder")

input := EnsureRemoteBuilderInput{}
if region != "" {
input.Region = StringPointer(region)
}
if orgID != "" {
req.Var("input", EnsureRemoteBuilderInput{
OrganizationID: StringPointer(orgID),
})
input.OrganizationID = StringPointer(orgID)
} else {
req.Var("input", EnsureRemoteBuilderInput{
AppName: StringPointer(appName),
})

input.AppName = StringPointer(appName)
}
req.Var("input", input)

data, err := client.RunWithContext(ctx, req)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ type PostgresEnableConsulPayload struct {
type EnsureRemoteBuilderInput struct {
AppName *string `json:"appName"`
OrganizationID *string `json:"organizationId"`
Region *string `json:"region"`
}

type PostgresClusterAttachment struct {
Expand Down

0 comments on commit 3883e36

Please sign in to comment.