Skip to content

Commit

Permalink
vendor: upgrade cockroach-cloud-sdk-go to v1.8.0 (#182)
Browse files Browse the repository at this point in the history
There are breaking changes in the new version so this commit
also includes required code changes.
  • Loading branch information
carloruiz authored Mar 11, 2024
1 parent 94f1502 commit 6b329bb
Show file tree
Hide file tree
Showing 29 changed files with 2,629 additions and 1,146 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/cockroachdb/terraform-provider-cockroach
go 1.18

require (
github.com/cockroachdb/cockroach-cloud-sdk-go v1.7.0
github.com/cockroachdb/cockroach-cloud-sdk-go v1.8.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
github.com/hashicorp/go-retryablehttp v0.7.4
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/cockroachdb/cockroach-cloud-sdk-go v1.7.0 h1:KKokmhXa5nzHXrP8kc81BZ6ciOewcT8FKqofS2yoR1s=
github.com/cockroachdb/cockroach-cloud-sdk-go v1.7.0/go.mod h1:oG9ylbcVGOF7IbVAW2nx5F6ry9a2dZD1H9rd+qd4P60=
github.com/cockroachdb/cockroach-cloud-sdk-go v1.8.0 h1:bz/hTomytW/XM8uFtYSF7nay/LW2u4vh0R06kGBm5Bk=
github.com/cockroachdb/cockroach-cloud-sdk-go v1.8.0/go.mod h1:oG9ylbcVGOF7IbVAW2nx5F6ry9a2dZD1H9rd+qd4P60=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -274,8 +274,6 @@ golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/database_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func NewDatabaseResource() resource.Resource {
}

func loadDatabaseToTerraformState(
clusterID string, databaseObj *client.ApiDatabase, state *Database,
clusterID string, databaseObj *client.Database, state *Database,
) {
state.ClusterId = types.StringValue(clusterID)
state.Name = types.StringValue(databaseObj.GetName())
Expand Down
10 changes: 5 additions & 5 deletions internal/provider/database_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ func TestIntegrationDatabaseResource(t *testing.T) {
},
},
}
database := client.ApiDatabase{
database := client.Database{
Name: databaseName,
}
updatedDatabase := client.ApiDatabase{
updatedDatabase := client.Database{
Name: newDatabaseName,
}

Expand All @@ -95,19 +95,19 @@ func TestIntegrationDatabaseResource(t *testing.T) {
&client.CreateDatabaseRequest{Name: databaseName},
).Return(&database, nil, nil)
s.EXPECT().ListDatabases(gomock.Any(), clusterID, gomock.Any()).
Return(&client.ApiListDatabasesResponse{Databases: []client.ApiDatabase{database}}, nil, nil).
Return(&client.ListDatabasesResponse{Databases: []client.Database{database}}, nil, nil).
Times(2)

// Update
s.EXPECT().GetCluster(gomock.Any(), clusterID).
Return(&cluster, &http.Response{Status: http.StatusText(http.StatusOK)}, nil).
Times(2)
s.EXPECT().ListDatabases(gomock.Any(), clusterID, gomock.Any()).
Return(&client.ApiListDatabasesResponse{Databases: []client.ApiDatabase{database}}, nil, nil)
Return(&client.ListDatabasesResponse{Databases: []client.Database{database}}, nil, nil)
s.EXPECT().EditDatabase(gomock.Any(), clusterID, databaseName, &client.UpdateDatabaseRequest1{NewName: newDatabaseName}).
Return(&updatedDatabase, nil, nil)
s.EXPECT().ListDatabases(gomock.Any(), clusterID, gomock.Any()).
Return(&client.ApiListDatabasesResponse{Databases: []client.ApiDatabase{updatedDatabase}}, nil, nil).
Return(&client.ListDatabasesResponse{Databases: []client.Database{updatedDatabase}}, nil, nil).
Times(3)

// Delete
Expand Down
11 changes: 7 additions & 4 deletions internal/provider/private_endpoint_connection_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ func TestIntegrationPrivateEndpointConnectionResource(t *testing.T) {
services := &client.PrivateEndpointServices{
Services: []client.PrivateEndpointService{
{
RegionName: "us-east-1",
CloudProvider: "AWS",
Status: client.PRIVATEENDPOINTSERVICESTATUSTYPE_AVAILABLE,
Aws: client.AWSPrivateLinkServiceDetail{
RegionName: "us-east-1",
CloudProvider: "AWS",
Status: client.PRIVATEENDPOINTSERVICESTATUSTYPE_AVAILABLE,
Name: "service-name",
EndpointServiceId: "service-id",
AvailabilityZoneIds: []string{},
Aws: &client.AWSPrivateLinkServiceDetail{
ServiceName: "service-name",
ServiceId: "service-id",
AvailabilityZoneIds: []string{},
Expand Down
11 changes: 7 additions & 4 deletions internal/provider/private_endpoint_services_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,13 @@ func TestIntegrationPrivateEndpointServicesResource(t *testing.T) {
services := &client.PrivateEndpointServices{}
for _, region := range regions {
services.Services = append(services.Services, client.PrivateEndpointService{
RegionName: region,
CloudProvider: "AWS",
Status: client.PRIVATEENDPOINTSERVICESTATUSTYPE_AVAILABLE,
Aws: client.AWSPrivateLinkServiceDetail{
RegionName: region,
CloudProvider: "AWS",
Status: client.PRIVATEENDPOINTSERVICESTATUSTYPE_AVAILABLE,
Name: "finalService-name",
EndpointServiceId: "finalService-id",
AvailabilityZoneIds: []string{},
Aws: &client.AWSPrivateLinkServiceDetail{
ServiceName: "finalService-name",
ServiceId: "finalService-id",
AvailabilityZoneIds: []string{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (r *privateEndpointTrustedOwnerResource) Create(
return
}

addReq := client.NewCockroachCloudAddPrivateEndpointTrustedOwnerRequest(
addReq := client.NewAddPrivateEndpointTrustedOwnerRequest(
plan.ExternalOwnerID.ValueString(),
client.PrivateEndpointTrustedOwnerTypeType(plan.Type.ValueString()),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestIntegrationPrivateEndpointTrustedOwnerResource(t *testing.T) {
s.EXPECT().AddPrivateEndpointTrustedOwner(
gomock.Any(),
cluster.Id,
&client.CockroachCloudAddPrivateEndpointTrustedOwnerRequest{
&client.AddPrivateEndpointTrustedOwnerRequest{
Type: client.PRIVATEENDPOINTTRUSTEDOWNERTYPETYPE_AWS_ACCOUNT_ID,
ExternalOwnerId: trustedOwner.ExternalOwnerId,
},
Expand Down
117 changes: 106 additions & 11 deletions mock/service.go

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

Loading

0 comments on commit 6b329bb

Please sign in to comment.