Skip to content

Commit 1d41449

Browse files
feat: upgrade Atlas SDK from v20250312006 to v20250312010 with breaking API fixes (#10)
Breaking Changes: - AlertConfigurationsApi: ListAlertConfigurations→ListAlertConfigs, GetAlertConfiguration→GetAlertConfig, CreateAlertConfiguration→CreateAlertConfig, UpdateAlertConfiguration→UpdateAlertConfig, DeleteAlertConfiguration→DeleteAlertConfig, ListAlertConfigurationMatchersFieldNames→ListMatcherFieldNames - AlertsApi: ListAlertsByAlertConfigurationId→GetAlertConfigAlerts - ProjectIPAccessListApi: ListProjectIpAccessLists→ListAccessListEntries, GetProjectIpList→GetAccessListEntry, CreateProjectIpAccessList→CreateAccessListEntry, DeleteProjectIpAccessList→DeleteAccessListEntry - NetworkPeeringApi (Containers): ListPeeringContainers→ListGroupContainerAll, GetPeeringContainer→GetGroupContainer, CreatePeeringContainer→CreateGroupContainer, UpdatePeeringContainer→UpdateGroupContainer, DeletePeeringContainer→DeleteGroupContainer - NetworkPeeringApi (Peering): ListPeeringConnections→ListGroupPeers, GetPeeringConnection→GetGroupPeer, CreatePeeringConnection→CreateGroupPeer, UpdatePeeringConnection→UpdateGroupPeer, DeletePeeringConnection→DeleteGroupPeer - OrganizationsApi: ListOrganizations→ListOrgs, GetOrganization→GetOrg - ProjectsApi: ListProjects→ListGroups, GetProject→GetGroup, CreateProject→CreateGroup, UpdateProject→UpdateGroup, DeleteProject→DeleteGroup, ListOrganizationProjects→GetOrgGroups (moved to OrganizationsApi) - AtlasSearchApi: ListAtlasSearchIndexes→ListSearchIndex, ListAtlasSearchIndexesCluster→ListClusterSearchIndexes, GetAtlasSearchIndex→GetClusterFtsIndex, GetAtlasSearchIndexByName→GetIndexByName, CreateAtlasSearchIndex→CreateClusterFtsIndex, UpdateAtlasSearchIndex→UpdateClusterFtsIndex, DeleteAtlasSearchIndex→DeleteClusterFtsIndex, DeleteAtlasSearchIndexByName→DeleteIndexByName - PrivateEndpointServicesApi: ListPrivateEndpointServices→ListPrivateEndpointService Type Changes: - Search Index operations now use ClusterSearchIndex type instead of SearchIndexResponse for ID-based operations - Added conversion helpers ConvertClusterSearchIndexToResponse and ConvertSearchIndexCreateRequestToClusterSearchIndex for backward compatibility Updated: - All 46 Go files to use new import path go.mongodb.org/atlas-sdk/v20250312010 - go.mod and go.sum with new SDK version - All API method calls to use new method names - Service layer to handle type changes - Command layer to use conversion helpers - Unit tests pass ✓ - Build succeeds ✓ - Code formatted and vetted ✓ Co-authored-by: Danny Teller <danny.teller@tipalti.com>
1 parent 883b0d7 commit 1d41449

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+200
-117
lines changed

cmd/atlas/alerts/alert_configurations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"time"
99

1010
"github.com/spf13/cobra"
11-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
11+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1212

1313
"github.com/teabranch/matlas-cli/internal/cli"
1414
"github.com/teabranch/matlas-cli/internal/config"

cmd/atlas/alerts/alerts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"time"
99

1010
"github.com/spf13/cobra"
11-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
11+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1212

1313
"github.com/teabranch/matlas-cli/internal/cli"
1414
"github.com/teabranch/matlas-cli/internal/config"

cmd/atlas/clusters/clusters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010

1111
"github.com/spf13/cobra"
12-
"go.mongodb.org/atlas-sdk/v20250312006/admin"
12+
"go.mongodb.org/atlas-sdk/v20250312010/admin"
1313
"gopkg.in/yaml.v3"
1414

1515
"github.com/teabranch/matlas-cli/internal/cli"

cmd/atlas/network-containers/network_containers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"time"
88

99
"github.com/spf13/cobra"
10-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
10+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1111

1212
"github.com/teabranch/matlas-cli/internal/cli"
1313
"github.com/teabranch/matlas-cli/internal/config"

cmd/atlas/network-peering/network_peering.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"time"
88

99
"github.com/spf13/cobra"
10-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
10+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1111

1212
"github.com/teabranch/matlas-cli/internal/cli"
1313
"github.com/teabranch/matlas-cli/internal/config"

cmd/atlas/network/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77

88
"github.com/spf13/cobra"
9-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
9+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1010

1111
"github.com/teabranch/matlas-cli/internal/cli"
1212
"github.com/teabranch/matlas-cli/internal/config"

cmd/atlas/projects/projects.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"time"
99

1010
"github.com/spf13/cobra"
11-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
11+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1212

1313
atlasclient "github.com/teabranch/matlas-cli/internal/clients/atlas"
1414
"github.com/teabranch/matlas-cli/internal/config"

cmd/atlas/search/search.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/spf13/cobra"
13-
"go.mongodb.org/atlas-sdk/v20250312006/admin"
13+
"go.mongodb.org/atlas-sdk/v20250312010/admin"
1414

1515
"github.com/teabranch/matlas-cli/internal/cli"
1616
"github.com/teabranch/matlas-cli/internal/config"
@@ -343,17 +343,23 @@ func runGetSearchIndex(cmd *cobra.Command, projectID, clusterName, indexID, inde
343343
progress.StopSpinnerWithError("Search index not found")
344344
return fmt.Errorf("search index %q not found", indexName)
345345
}
346-
res, err = searchService.GetSearchIndex(ctx, projectID, clusterName, foundID)
346+
clusterIdx, err := searchService.GetSearchIndex(ctx, projectID, clusterName, foundID)
347347
if err != nil {
348348
progress.StopSpinnerWithError("Failed to get search index details")
349349
return cli.WrapWithSuggestion(err, "Check your project ID, cluster name, and index identifier")
350350
}
351+
// Convert to SearchIndexResponse for formatting
352+
converted := atlas.ConvertClusterSearchIndexToResponse(clusterIdx)
353+
res = &converted
351354
} else {
352-
res, err = searchService.GetSearchIndex(ctx, projectID, clusterName, indexID)
355+
clusterIdx, err := searchService.GetSearchIndex(ctx, projectID, clusterName, indexID)
353356
if err != nil {
354357
progress.StopSpinnerWithError("Failed to get search index details")
355358
return cli.WrapWithSuggestion(err, "Check your project ID, cluster name, and index identifier")
356359
}
360+
// Convert to SearchIndexResponse for formatting
361+
converted := atlas.ConvertClusterSearchIndexToResponse(clusterIdx)
362+
res = &converted
357363
}
358364
progress.StopSpinner(fmt.Sprintf("Fetched details for index %s", res.GetName()))
359365
// Format and display result
@@ -455,18 +461,24 @@ func runCreateSearchIndex(cmd *cobra.Command, projectID, clusterName, databaseNa
455461
indexRequest.SetDefinition(*indexDefinition)
456462
}
457463

464+
// Convert request to ClusterSearchIndex
465+
clusterIndexReq := atlas.ConvertSearchIndexCreateRequestToClusterSearchIndex(indexRequest)
466+
458467
// Create the search index
459-
result, err := searchService.CreateSearchIndex(ctx, projectID, clusterName, *indexRequest)
468+
result, err := searchService.CreateSearchIndex(ctx, projectID, clusterName, *clusterIndexReq)
460469
if err != nil {
461470
progress.StopSpinnerWithError("Failed to create search index")
462471
return cli.WrapWithSuggestion(err, "Check your project ID, cluster name, and index configuration")
463472
}
464473

465474
progress.StopSpinner("Search index created successfully")
466475

476+
// Convert result to SearchIndexResponse for formatting
477+
converted := atlas.ConvertClusterSearchIndexToResponse(result)
478+
467479
// Format and display the result
468480
formatter := output.CreateSearchIndexesFormatter()
469-
return formatter.FormatSearchIndex(*result, cmd.Flag("output").Value.String())
481+
return formatter.FormatSearchIndex(converted, cmd.Flag("output").Value.String())
470482
}
471483

472484
func runUpdateSearchIndex(cmd *cobra.Command, projectID, clusterName, indexID, indexFile string) error {

cmd/atlas/users/users.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"syscall"
99

1010
"github.com/spf13/cobra"
11-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
11+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1212
"golang.org/x/term"
1313

1414
"github.com/teabranch/matlas-cli/internal/cli"

cmd/atlas/users/users_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/stretchr/testify/assert"
88
"github.com/stretchr/testify/require"
99

10-
admin "go.mongodb.org/atlas-sdk/v20250312006/admin"
10+
admin "go.mongodb.org/atlas-sdk/v20250312010/admin"
1111
)
1212

1313
func TestNewUsersCmd(t *testing.T) {

0 commit comments

Comments
 (0)