Skip to content

Commit 11860fc

Browse files
authored
CLOUDP-288862: Delete with latest api version (#3990)
1 parent 3a58d62 commit 11860fc

12 files changed

+40
-41
lines changed

internal/cli/clusters/delete.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/usage"
2828
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/watchers"
2929
"github.com/spf13/cobra"
30-
atlasClustersPinned "go.mongodb.org/atlas-sdk/v20240530005/admin"
30+
atlasv2 "go.mongodb.org/atlas-sdk/v20250312003/admin"
3131
)
3232

3333
//go:generate go tool go.uber.org/mock/mockgen -typed -destination=delete_mock_test.go -package=clusters . ClusterDeleter
@@ -63,12 +63,12 @@ func (opts *DeleteOpts) Run() error {
6363
}
6464

6565
func (opts *DeleteOpts) RunFlexCluster(err error) error {
66-
apiError, ok := atlasClustersPinned.AsError(err)
66+
apiError, ok := atlasv2.AsError(err)
6767
if !ok {
6868
return err
6969
}
7070

71-
if *apiError.ErrorCode != cannotUseFlexWithClusterApisErrorCode {
71+
if apiError.ErrorCode != cannotUseFlexWithClusterApisErrorCode {
7272
return err
7373
}
7474

internal/cli/clusters/delete_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ import (
2020
"testing"
2121

2222
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli"
23-
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer"
2423
"github.com/stretchr/testify/require"
25-
atlasClustersPinned "go.mongodb.org/atlas-sdk/v20240530005/admin"
24+
atlasv2 "go.mongodb.org/atlas-sdk/v20250312003/admin"
2625
"go.uber.org/mock/gomock"
2726
)
2827

@@ -51,8 +50,8 @@ func TestDelete_RunFlexCluster(t *testing.T) {
5150
ctrl := gomock.NewController(t)
5251
mockStore := NewMockClusterDeleter(ctrl)
5352

54-
expectedError := &atlasClustersPinned.GenericOpenAPIError{}
55-
expectedError.SetModel(atlasClustersPinned.ApiError{ErrorCode: pointer.Get(cannotUseFlexWithClusterApisErrorCode)})
53+
expectedError := &atlasv2.GenericOpenAPIError{}
54+
expectedError.SetModel(atlasv2.ApiError{ErrorCode: cannotUseFlexWithClusterApisErrorCode})
5655

5756
deleteOpts := &DeleteOpts{
5857
DeleteOpts: &cli.DeleteOpts{

internal/store/clusters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (s *Store) GetClusterAutoScalingConfig(projectID, name string) (*atlasv2.Cl
108108

109109
// DeleteCluster encapsulate the logic to manage different cloud providers.
110110
func (s *Store) DeleteCluster(projectID, name string) error {
111-
_, err := s.clientClusters.ClustersApi.DeleteCluster(s.ctx, projectID, name).Execute()
111+
_, err := s.clientv2.ClustersApi.DeleteCluster(s.ctx, projectID, name).Execute()
112112
return err
113113
}
114114

Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
HTTP/2.0 200 OK
22
Content-Length: 364
33
Content-Type: application/vnd.atlas.2023-01-01+json;charset=utf-8
4-
Date: Fri, 20 Jun 2025 14:37:20 GMT
4+
Date: Tue, 17 Jun 2025 13:32:55 GMT
55
Referrer-Policy: strict-origin-when-cross-origin
66
Server: mdbws
77
Strict-Transport-Security: max-age=31536000; includeSubdomains;
88
X-Content-Type-Options: nosniff
9-
X-Envoy-Upstream-Service-Time: 114
9+
X-Envoy-Upstream-Service-Time: 185
1010
X-Frame-Options: DENY
1111
X-Java-Method: ApiGroupTeamsResource::addTeams
1212
X-Java-Version: 17.0.14+7
13-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
13+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1414
X-Permitted-Cross-Domain-Policies: none
1515

16-
{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/teams?pageNum=1&itemsPerPage=100","rel":"self"}],"results":[{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/teams/6855721fe16f343ef1ded461","rel":"self"}],"roleNames":["GROUP_READ_ONLY"],"teamId":"6855721fe16f343ef1ded461"}],"totalCount":1}
16+
{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/teams?pageNum=1&itemsPerPage=100","rel":"self"}],"results":[{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/teams/68516e87ffb74d59cd662f84","rel":"self"}],"roleNames":["GROUP_READ_ONLY"],"teamId":"68516e87ffb74d59cd662f84"}],"totalCount":1}
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
HTTP/2.0 204 No Content
22
Content-Type: application/vnd.atlas.2023-01-01+json;charset=utf-8
3-
Date: Fri, 20 Jun 2025 14:37:21 GMT
3+
Date: Tue, 17 Jun 2025 13:32:56 GMT
44
Referrer-Policy: strict-origin-when-cross-origin
55
Server: mdbws
66
Strict-Transport-Security: max-age=31536000; includeSubdomains;
77
X-Content-Type-Options: nosniff
8-
X-Envoy-Upstream-Service-Time: 110
8+
X-Envoy-Upstream-Service-Time: 128
99
X-Frame-Options: DENY
1010
X-Java-Method: ApiOrganizationTeamsResource::deleteTeam
1111
X-Java-Version: 17.0.14+7
12-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
12+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1313
X-Permitted-Cross-Domain-Policies: none
1414

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
HTTP/2.0 204 No Content
22
Content-Type: application/vnd.atlas.2023-01-01+json;charset=utf-8
3-
Date: Fri, 20 Jun 2025 14:37:20 GMT
3+
Date: Tue, 17 Jun 2025 13:32:56 GMT
44
Referrer-Policy: strict-origin-when-cross-origin
55
Server: mdbws
66
Strict-Transport-Security: max-age=31536000; includeSubdomains;
77
X-Content-Type-Options: nosniff
8-
X-Envoy-Upstream-Service-Time: 113
8+
X-Envoy-Upstream-Service-Time: 141
99
X-Frame-Options: DENY
1010
X-Java-Method: ApiGroupTeamsResource::removeTeam
1111
X-Java-Version: 17.0.14+7
12-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
12+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1313
X-Permitted-Cross-Domain-Policies: none
1414

Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
HTTP/2.0 200 OK
22
Content-Length: 713
33
Content-Type: application/vnd.atlas.2025-02-19+json;charset=utf-8
4-
Date: Fri, 20 Jun 2025 14:37:19 GMT
4+
Date: Tue, 17 Jun 2025 13:32:55 GMT
55
Referrer-Policy: strict-origin-when-cross-origin
66
Server: mdbws
77
Strict-Transport-Security: max-age=31536000; includeSubdomains;
88
X-Content-Type-Options: nosniff
9-
X-Envoy-Upstream-Service-Time: 34
9+
X-Envoy-Upstream-Service-Time: 50
1010
X-Frame-Options: DENY
1111
X-Java-Method: ApiOrganizationUsersResource::getOrganizationUsers
1212
X-Java-Version: 17.0.14+7
13-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
13+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1414
X-Permitted-Cross-Domain-Policies: none
1515

16-
{"links":[{"href":"http://localhost:8080/api/atlas/v2/orgs/a0123456789abcdef012345a/users?includeCount=true&pageNum=1&itemsPerPage=1","rel":"self"},{"href":"http://localhost:8080/api/atlas/v2/orgs/a0123456789abcdef012345a/users?includeCount=true&itemsPerPage=1&pageNum=2","rel":"next"}],"results":[{"country":"IE","createdAt":"2020-02-18T10:58:47Z","firstName":"Andrea","id":"5e4bc367c6b0f41bb9bbb178","lastAuth":"2025-06-19T08:26:30Z","lastName":"Angiolillo","mobileNumber":null,"orgMembershipStatus":"ACTIVE","roles":{"groupRoleAssignments":[{"groupId":"b0123456789abcdef012345b","groupRoles":["GROUP_OWNER"]}],"orgRoles":["ORG_OWNER"]},"teamIds":[],"username":"[email protected]"}],"totalCount":16}
16+
{"links":[{"href":"http://localhost:8080/api/atlas/v2/orgs/a0123456789abcdef012345a/users?includeCount=true&pageNum=1&itemsPerPage=1","rel":"self"},{"href":"http://localhost:8080/api/atlas/v2/orgs/a0123456789abcdef012345a/users?includeCount=true&itemsPerPage=1&pageNum=2","rel":"next"}],"results":[{"country":"IE","createdAt":"2020-02-18T10:58:47Z","firstName":"Andrea","id":"5e4bc367c6b0f41bb9bbb178","lastAuth":"2025-06-16T07:44:40Z","lastName":"Angiolillo","mobileNumber":null,"orgMembershipStatus":"ACTIVE","roles":{"groupRoleAssignments":[{"groupId":"b0123456789abcdef012345b","groupRoles":["GROUP_OWNER"]}],"orgRoles":["ORG_OWNER"]},"teamIds":[],"username":"[email protected]"}],"totalCount":34}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
HTTP/2.0 200 OK
22
Content-Length: 412
33
Content-Type: application/vnd.atlas.2023-01-01+json;charset=utf-8
4-
Date: Fri, 20 Jun 2025 14:37:20 GMT
4+
Date: Tue, 17 Jun 2025 13:32:56 GMT
55
Referrer-Policy: strict-origin-when-cross-origin
66
Server: mdbws
77
Strict-Transport-Security: max-age=31536000; includeSubdomains;
88
X-Content-Type-Options: nosniff
9-
X-Envoy-Upstream-Service-Time: 19
9+
X-Envoy-Upstream-Service-Time: 37
1010
X-Frame-Options: DENY
1111
X-Java-Method: ApiGroupTeamsResource::getTeams
1212
X-Java-Version: 17.0.14+7
13-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
13+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1414
X-Permitted-Cross-Domain-Policies: none
1515

16-
{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/teams?includeCount=true&pageNum=1&itemsPerPage=100","rel":"self"}],"results":[{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/teams/6855721fe16f343ef1ded461","rel":"self"}],"roleNames":["GROUP_READ_ONLY","GROUP_DATA_ACCESS_READ_ONLY"],"teamId":"6855721fe16f343ef1ded461"}],"totalCount":1}
16+
{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/teams?includeCount=true&pageNum=1&itemsPerPage=100","rel":"self"}],"results":[{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/teams/68516e87ffb74d59cd662f84","rel":"self"}],"roleNames":["GROUP_READ_ONLY","GROUP_DATA_ACCESS_READ_ONLY"],"teamId":"68516e87ffb74d59cd662f84"}],"totalCount":1}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
HTTP/2.0 201 Created
22
Content-Length: 1067
33
Content-Type: application/vnd.atlas.2023-01-01+json;charset=utf-8
4-
Date: Fri, 20 Jun 2025 14:37:16 GMT
4+
Date: Tue, 17 Jun 2025 13:32:53 GMT
55
Location: http://localhost:8080//api/atlas/v1.0
66
Referrer-Policy: strict-origin-when-cross-origin
77
Server: mdbws
88
Strict-Transport-Security: max-age=31536000; includeSubdomains;
99
X-Content-Type-Options: nosniff
10-
X-Envoy-Upstream-Service-Time: 2970
10+
X-Envoy-Upstream-Service-Time: 1513
1111
X-Frame-Options: DENY
1212
X-Java-Method: ApiAtlasGroupsResource::addGroup
1313
X-Java-Version: 17.0.14+7
14-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
14+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1515
X-Permitted-Cross-Domain-Policies: none
1616

17-
{"clusterCount":0,"created":"2025-06-20T14:37:19Z","id":"6855721ccd32be2bdf8db2bf","links":[{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf","rel":"self"},{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/containers","rel":"https://cloud.mongodb.com/containers"},{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/clusters","rel":"https://cloud.mongodb.com/clusters"},{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/databaseUsers","rel":"https://cloud.mongodb.com/databaseUsers"},{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/peers","rel":"https://cloud.mongodb.com/peers"},{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/processes","rel":"https://cloud.mongodb.com/processes"},{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/whitelist","rel":"https://cloud.mongodb.com/whitelist"}],"name":"teams-e2e-648","orgId":"a0123456789abcdef012345a","withDefaultAlertsSettings":true}
17+
{"clusterCount":0,"created":"2025-06-17T13:32:54Z","id":"68516e85ffb74d59cd662efa","links":[{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa","rel":"self"},{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/containers","rel":"https://cloud.mongodb.com/containers"},{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/clusters","rel":"https://cloud.mongodb.com/clusters"},{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/databaseUsers","rel":"https://cloud.mongodb.com/databaseUsers"},{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/peers","rel":"https://cloud.mongodb.com/peers"},{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/processes","rel":"https://cloud.mongodb.com/processes"},{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/whitelist","rel":"https://cloud.mongodb.com/whitelist"}],"name":"teams-e2e-381","orgId":"a0123456789abcdef012345a","withDefaultAlertsSettings":true}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
HTTP/2.0 201 Created
22
Content-Length: 232
33
Content-Type: application/vnd.atlas.2023-01-01+json;charset=utf-8
4-
Date: Fri, 20 Jun 2025 14:37:19 GMT
5-
Location: http://localhost:8080/orgs/a0123456789abcdef012345a/teams/6855721fe16f343ef1ded461
4+
Date: Tue, 17 Jun 2025 13:32:55 GMT
5+
Location: http://localhost:8080/orgs/a0123456789abcdef012345a/teams/68516e87ffb74d59cd662f84
66
Referrer-Policy: strict-origin-when-cross-origin
77
Server: mdbws
88
Strict-Transport-Security: max-age=31536000; includeSubdomains;
99
X-Content-Type-Options: nosniff
10-
X-Envoy-Upstream-Service-Time: 138
10+
X-Envoy-Upstream-Service-Time: 188
1111
X-Frame-Options: DENY
1212
X-Java-Method: ApiOrganizationTeamsResource::createTeam
1313
X-Java-Version: 17.0.14+7
14-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
14+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1515
X-Permitted-Cross-Domain-Policies: none
1616

17-
{"id":"6855721fe16f343ef1ded461","links":[{"href":"http://localhost:8080/api/atlas/v2/orgs/a0123456789abcdef012345a/teams/6855721fe16f343ef1ded461","rel":"self"}],"name":"e2e-teams-143","usernames":["[email protected]"]}
17+
{"id":"68516e87ffb74d59cd662f84","links":[{"href":"http://localhost:8080/api/atlas/v2/orgs/a0123456789abcdef012345a/teams/68516e87ffb74d59cd662f84","rel":"self"}],"name":"e2e-teams-443","usernames":["[email protected]"]}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
HTTP/2.0 200 OK
2-
Content-Length: 389
2+
Content-Length: 419
33
Content-Type: application/vnd.atlas.2023-01-01+json;charset=utf-8
4-
Date: Fri, 20 Jun 2025 14:37:20 GMT
4+
Date: Tue, 17 Jun 2025 13:32:55 GMT
55
Referrer-Policy: strict-origin-when-cross-origin
66
Server: mdbws
77
Strict-Transport-Security: max-age=31536000; includeSubdomains;
88
X-Content-Type-Options: nosniff
9-
X-Envoy-Upstream-Service-Time: 114
9+
X-Envoy-Upstream-Service-Time: 163
1010
X-Frame-Options: DENY
1111
X-Java-Method: ApiGroupTeamsResource::patchTeam
1212
X-Java-Version: 17.0.14+7
13-
X-Mongodb-Service-Version: gitHash=c9cc80704805413f1d20ccd4de364bd36cd66b6b; versionString=master
13+
X-Mongodb-Service-Version: gitHash=1ab676b47c305241bdf9a34bc95947dde225deff; versionString=master
1414
X-Permitted-Cross-Domain-Policies: none
1515

16-
{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/teams/6855721fe16f343ef1ded461?pageNum=1&itemsPerPage=100","rel":"self"}],"results":[{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/6855721ccd32be2bdf8db2bf/teams/6855721fe16f343ef1ded461","rel":"self"}],"roleNames":["GROUP_READ_ONLY"],"teamId":"6855721fe16f343ef1ded461"}],"totalCount":1}
16+
{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/teams/68516e87ffb74d59cd662f84?pageNum=1&itemsPerPage=100","rel":"self"}],"results":[{"links":[{"href":"http://localhost:8080/api/atlas/v2/groups/68516e85ffb74d59cd662efa/teams/68516e87ffb74d59cd662f84","rel":"self"}],"roleNames":["GROUP_READ_ONLY","GROUP_DATA_ACCESS_READ_ONLY"],"teamId":"68516e87ffb74d59cd662f84"}],"totalCount":1}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"TestAtlasProjectTeams/rand":"jw=="}
1+
{"TestAtlasProjectTeams/rand":"Abs="}

0 commit comments

Comments
 (0)