Skip to content

Commit 3147f57

Browse files
authored
CLOUDP-288862: Unpin SDK in backup (#3988)
1 parent 72f2408 commit 3147f57

File tree

2 files changed

+43
-45
lines changed

2 files changed

+43
-45
lines changed

internal/cli/backup/restores/start.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store"
2727
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/usage"
2828
"github.com/spf13/cobra"
29-
atlasClustersPinned "go.mongodb.org/atlas-sdk/v20240530005/admin"
3029
atlasv2 "go.mongodb.org/atlas-sdk/v20250312003/admin"
3130
)
3231

@@ -42,7 +41,7 @@ const (
4241
type RestoreJobsCreator interface {
4342
CreateRestoreJobs(string, string, *atlasv2.DiskBackupSnapshotRestoreJob) (*atlasv2.DiskBackupSnapshotRestoreJob, error)
4443
CreateRestoreFlexClusterJobs(string, string, *atlasv2.FlexBackupRestoreJobCreate20241113) (*atlasv2.FlexBackupRestoreJob20241113, error)
45-
AtlasCluster(string, string) (*atlasClustersPinned.AdvancedClusterDescription, error)
44+
LatestAtlasCluster(string, string) (*atlasv2.ClusterDescription20240805, error)
4645
}
4746

4847
type StartOpts struct {
@@ -168,13 +167,13 @@ func markRequiredPointInTimeRestoreFlags(cmd *cobra.Command) error {
168167

169168
// checkIsFlexCluster sets the opts.isFlexCluster that indicates if the cluster is a FlexCluster.
170169
func (opts *StartOpts) checkIsFlexCluster() error {
171-
_, err := opts.store.AtlasCluster(opts.ConfigProjectID(), opts.clusterName)
170+
_, err := opts.store.LatestAtlasCluster(opts.ConfigProjectID(), opts.clusterName)
172171
if err == nil {
173172
opts.isFlexCluster = false
174173
return nil
175174
}
176175

177-
if !atlasClustersPinned.IsErrorCode(err, cannotUseFlexWithClusterApisErrorCode) {
176+
if !commonerrors.IsCannotUseFlexWithClusterApis(err) {
178177
return err
179178
}
180179

internal/cli/backup/restores/start_mock_test.go

Lines changed: 40 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)