diff --git a/go.mod b/go.mod index 6a5f7542ab..724143ea66 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/pborman/uuid v1.2.1 github.com/sethvargo/go-password v0.2.0 github.com/stretchr/testify v1.8.4 - go.mongodb.org/atlas v0.31.0 + go.mongodb.org/atlas v0.32.0 go.mongodb.org/mongo-driver v1.12.1 go.uber.org/zap v1.25.0 golang.org/x/sync v0.3.0 @@ -42,7 +42,6 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect - github.com/benbjohnson/clock v1.3.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect github.com/google/s2a-go v0.1.4 // indirect diff --git a/go.sum b/go.sum index e71d9d1685..ca5c95194f 100644 --- a/go.sum +++ b/go.sum @@ -96,7 +96,6 @@ github.com/aws/aws-sdk-go v1.44.318 h1:Yl66rpbQHFUbxe9JBKLcvOvRivhVgP6+zH0b9KzAR github.com/aws/aws-sdk-go v1.44.318/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -400,8 +399,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.mongodb.org/atlas v0.31.0 h1:NgLqsNYm6wDYeDUO90etw1sl8T1U2DUKu36eUdnrFSI= -go.mongodb.org/atlas v0.31.0/go.mod h1:L4BKwVx/OeEhOVjCSdgo90KJm4469iv7ZLzQms/EPTg= +go.mongodb.org/atlas v0.32.0 h1:6uHwus8Bz+h1Ax75Pf3qo3kWCwnaUYav+SxSMU2RGiQ= +go.mongodb.org/atlas v0.32.0/go.mod h1:L4BKwVx/OeEhOVjCSdgo90KJm4469iv7ZLzQms/EPTg= go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= diff --git a/pkg/api/v1/status/cloud_provider_access.go b/pkg/api/v1/status/cloud_provider_access.go index d4a38edbde..04dfd85b75 100644 --- a/pkg/api/v1/status/cloud_provider_access.go +++ b/pkg/api/v1/status/cloud_provider_access.go @@ -56,7 +56,7 @@ func (c *CloudProviderAccessRole) FailedToAuthorise(errorMessage string) { c.ErrorMessage = errorMessage } -func (c *CloudProviderAccessRole) Update(role mongodbatlas.AWSIAMRole, isEmptyArn bool) { +func (c *CloudProviderAccessRole) Update(role mongodbatlas.CloudProviderAccessRole, isEmptyArn bool) { c.RoleID = role.RoleID c.AtlasAssumedRoleExternalID = role.AtlasAssumedRoleExternalID c.AtlasAWSAccountArn = role.AtlasAWSAccountARN diff --git a/pkg/controller/atlasproject/cloud_provider_access.go b/pkg/controller/atlasproject/cloud_provider_access.go index 12d6782ac2..5acefe3d6f 100644 --- a/pkg/controller/atlasproject/cloud_provider_access.go +++ b/pkg/controller/atlasproject/cloud_provider_access.go @@ -70,9 +70,9 @@ func syncProviderAccessStatus(ctx context.Context, customContext *workflow.Conte func tryToAuthorize(ctx context.Context, access mongodbatlas.CloudProviderAccessService, logger *zap.SugaredLogger, statusMap map[v1.CloudProviderAccessRole]status.CloudProviderAccessRole, groupID string) { for spec, roleStatus := range statusMap { if roleStatus.Status == status.StatusCreated { - request := mongodbatlas.CloudProviderAuthorizationRequest{ + request := mongodbatlas.CloudProviderAccessRoleRequest{ ProviderName: spec.ProviderName, - IAMAssumedRoleARN: spec.IamAssumedRoleArn, + IAMAssumedRoleARN: &spec.IamAssumedRoleArn, } role, _, err := access.AuthorizeRole(ctx, groupID, roleStatus.RoleID, &request) if err != nil { @@ -109,7 +109,7 @@ func ensureCloudProviderAccessStatus(statusMap map[v1.CloudProviderAccessRole]st return workflow.OK(), status.CloudProviderAccessReadyType } -func updateAccessRoles(toUpdate []mongodbatlas.AWSIAMRole, specToStatus map[v1.CloudProviderAccessRole]status.CloudProviderAccessRole) { +func updateAccessRoles(toUpdate []mongodbatlas.CloudProviderAccessRole, specToStatus map[v1.CloudProviderAccessRole]status.CloudProviderAccessRole) { for _, role := range toUpdate { for spec, roleStatus := range specToStatus { if role.RoleID == roleStatus.RoleID { @@ -212,7 +212,7 @@ func checkStatuses(specs []v1.CloudProviderAccessRole, statuses []status.CloudPr type accessRoleDiff struct { toCreate []v1.CloudProviderAccessRole - toUpdate []mongodbatlas.AWSIAMRole + toUpdate []mongodbatlas.CloudProviderAccessRole toDelete map[string]string // roleId -> providerName } diff --git a/test/e2e/api/atlas/atlas.go b/test/e2e/api/atlas/atlas.go index 95227a057b..b5e7b8a709 100644 --- a/test/e2e/api/atlas/atlas.go +++ b/test/e2e/api/atlas/atlas.go @@ -166,12 +166,12 @@ func ginkgoPrettyPrintf(obj interface{}, msg string, formatArgs ...interface{}) ginkgo.GinkgoWriter.Println(debug.PrettyString(obj)) } -func (a *Atlas) GetIntegrationbyType(projectId, iType string) (*mongodbatlas.ThirdPartyIntegration, error) { - integraion, _, err := a.Client.Integrations.Get(context.Background(), projectId, iType) +func (a *Atlas) GetIntegrationByType(projectId, iType string) (*mongodbatlas.ThirdPartyIntegration, error) { + integration, _, err := a.Client.Integrations.Get(context.Background(), projectId, iType) if err != nil { return nil, err } - return integraion, nil + return integration, nil } func (a *Atlas) GetUserByName(database, projectID, username string) (*mongodbatlas.DatabaseUser, error) { @@ -190,7 +190,7 @@ func (a *Atlas) DeleteGlobalKey(key mongodbatlas.APIKey) error { return nil } -func (a *Atlas) GetEncryptioAtRest(projectID string) (*mongodbatlas.EncryptionAtRest, error) { +func (a *Atlas) GetEncryptionAtRest(projectID string) (*mongodbatlas.EncryptionAtRest, error) { encryptionAtRest, _, err := a.Client.EncryptionsAtRest.Get(context.Background(), projectID) if err != nil { return nil, err diff --git a/test/e2e/encryption_at_rest_test.go b/test/e2e/encryption_at_rest_test.go index 281af19a31..964e3287f3 100644 --- a/test/e2e/encryption_at_rest_test.go +++ b/test/e2e/encryption_at_rest_test.go @@ -239,7 +239,7 @@ func removeAllEncryptionsSeparately(encAtRest *v1.EncryptionAtRest) { func checkIfEncryptionsAreDisabled(projectID string) (areEmpty bool, err error) { atlasClient := atlas.GetClientOrFail() - encryptionAtRest, err := atlasClient.GetEncryptioAtRest(projectID) + encryptionAtRest, err := atlasClient.GetEncryptionAtRest(projectID) if err != nil { return false, err } diff --git a/test/e2e/integration_test.go b/test/e2e/integration_test.go index ea456a3d41..cd9489b345 100644 --- a/test/e2e/integration_test.go +++ b/test/e2e/integration_test.go @@ -59,7 +59,7 @@ var _ = Describe("Configuration namespaced. Deploy deployment", Label("integrati func integrationCycle(data *model.TestDataProvider, key string) { integrationType := "DATADOG" - By("Deploy User Resouces", func() { + By("Deploy User Resources", func() { projectStatus := GetProjectIntegrationStatus(data) Expect(projectStatus).Should(BeEmpty()) }) @@ -94,7 +94,7 @@ func integrationCycle(data *model.TestDataProvider, key string) { Expect(err).ShouldNot(HaveOccurred()) - dog, err := atlasClient.GetIntegrationbyType(data.Project.ID(), integrationType) + dog, err := atlasClient.GetIntegrationByType(data.Project.ID(), integrationType) Expect(err).ShouldNot(HaveOccurred()) Expect(strings.HasSuffix(key, removeStarsFromString(dog.APIKey))).Should(BeTrue()) }) @@ -108,7 +108,7 @@ func integrationCycle(data *model.TestDataProvider, key string) { }) By("Delete integration check", func() { - integration, err := atlasClient.GetIntegrationbyType(data.Project.ID(), integrationType) + integration, err := atlasClient.GetIntegrationByType(data.Project.ID(), integrationType) Expect(err).Should(HaveOccurred()) Expect(integration).To(BeNil())