Skip to content

Commit

Permalink
changed naming for Set and Unset for connection
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-fbudzynski committed Oct 30, 2024
1 parent ba98db7 commit 9becdb9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pkg/acceptance/helpers/connection_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *ConnectionClient) CreateReplication(t *testing.T, id sdk.AccountObjectI
return connection, c.DropFunc(t, id)
}

func (c *ConnectionClient) Alter(t *testing.T, id sdk.AccountObjectIdentifier, req *sdk.AlterConnectionRequest) {
func (c *ConnectionClient) Alter(t *testing.T, req *sdk.AlterConnectionRequest) {
t.Helper()
ctx := context.Background()

Expand Down
8 changes: 4 additions & 4 deletions pkg/resources/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ func UpdateContextConnection(ctx context.Context, d *schema.ResourceData, meta a
return diag.FromErr(err)
}

connectionSetRequest := new(sdk.SetConnectionRequest)
connectionUnsetRequest := new(sdk.UnsetConnectionRequest)
connectionSetRequest := new(sdk.ConnectionSetRequest)
connectionUnsetRequest := new(sdk.ConnectionUnsetRequest)

if d.HasChange("enable_failover_to_accounts") {
before, after := d.GetChange("enable_failover_to_accounts")
Expand Down Expand Up @@ -280,14 +280,14 @@ func UpdateContextConnection(ctx context.Context, d *schema.ResourceData, meta a
}
}

if (*connectionSetRequest != sdk.SetConnectionRequest{}) {
if (*connectionSetRequest != sdk.ConnectionSetRequest{}) {
err := client.Connections.Alter(ctx, sdk.NewAlterConnectionRequest(id).WithSet(*connectionSetRequest))
if err != nil {
return diag.FromErr(err)
}
}

if (*connectionUnsetRequest != sdk.UnsetConnectionRequest{}) {
if (*connectionUnsetRequest != sdk.ConnectionUnsetRequest{}) {
err := client.Connections.Alter(ctx, sdk.NewAlterConnectionRequest(id).WithUnset(*connectionUnsetRequest))
if err != nil {
return diag.FromErr(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/connection_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func TestAcc_Connection_ExternalChanges(t *testing.T) {
{
PreConfig: func() {
acc.TestClient().Connection.Alter(t, sdk.NewAlterConnectionRequest(id).
WithSet(*sdk.NewSetRequest().
WithSet(*sdk.NewSetConnectionRequest().
WithComment("external comment")))
},
Config: config.FromModel(t, connectionModel),
Expand Down
16 changes: 8 additions & 8 deletions pkg/sdk/connections_dto_builders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/sdk/connections_dto_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type AlterConnectionRequest struct {
EnableConnectionFailover *EnableConnectionFailoverRequest
DisableConnectionFailover *DisableConnectionFailoverRequest
Primary *bool
Set *SetRequest
Unset *UnsetRequest
Set *ConnectionSetRequest
Unset *ConnectionUnsetRequest
}

type EnableConnectionFailoverRequest struct {
Expand All @@ -38,11 +38,11 @@ type ToAccountsRequest struct {
Accounts []AccountIdentifier
}

type SetRequest struct {
type ConnectionSetRequest struct {
Comment *string
}

type UnsetRequest struct {
type ConnectionUnsetRequest struct {
Comment *bool
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/sdk/testint/connections_gen_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func TestInt_Connections(t *testing.T) {

// Set
err := client.Connections.Alter(ctx, sdk.NewAlterConnectionRequest(id).
WithSet(*sdk.NewSetRequest().
WithSet(*sdk.NewSetConnectionRequest().
WithComment("new integration test comment")))
require.NoError(t, err)

Expand All @@ -265,7 +265,7 @@ func TestInt_Connections(t *testing.T) {

// Unset
err = client.Connections.Alter(ctx, sdk.NewAlterConnectionRequest(id).
WithUnset(*sdk.NewUnsetRequest().
WithUnset(*sdk.NewUnsetConnectionRequest().
WithComment(true)))
require.NoError(t, err)

Expand Down

0 comments on commit 9becdb9

Please sign in to comment.