Skip to content

Commit c80ae58

Browse files
authored
chore: Update admin references (#1428)
1 parent e229909 commit c80ae58

72 files changed

Lines changed: 687 additions & 687 deletions

File tree

Some content is hidden

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

cfn-resources/access-list-api-key/cmd/resource/resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/logger"
3131
progress_events "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
3232
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
33-
"go.mongodb.org/atlas-sdk/v20231115014/admin"
33+
admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin"
3434
)
3535

3636
var CreateRequiredFields = []string{constants.OrgID, constants.APIUserID}
@@ -90,8 +90,8 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
9090
}
9191

9292
// createReq.ApiService.
93-
entryList := make([]admin.UserAccessListRequest, 0)
94-
var access admin.UserAccessListRequest
93+
entryList := make([]admin20231115014.UserAccessListRequest, 0)
94+
var access admin20231115014.UserAccessListRequest
9595
if currentModel.CidrBlock != nil {
9696
access.CidrBlock = currentModel.CidrBlock
9797
}

cfn-resources/alert-configuration/cmd/resource/resource.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
progressevents "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
3232
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
3333
"github.com/spf13/cast"
34-
"go.mongodb.org/atlas-sdk/v20231115014/admin"
34+
admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin"
3535
)
3636

3737
var CreateRequiredFields = []string{constants.EventTypeName, constants.ProjectID}
@@ -76,7 +76,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
7676
return progressevents.GetFailedEventByCode(err.Error(), cloudformation.HandlerErrorCodeInvalidRequest), err
7777
}
7878

79-
alertConfigRequest := admin.GroupAlertsConfig{
79+
alertConfigRequest := admin20231115014.GroupAlertsConfig{
8080
GroupId: currentModel.ProjectId,
8181
EventTypeName: currentModel.EventTypeName,
8282
Enabled: currentModel.Enabled,
@@ -182,13 +182,13 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
182182
// Removing the computed attributes to recreate the original request
183183
alertReq.Created = nil
184184
alertReq.Updated = nil
185-
var alertModel *admin.GroupAlertsConfig
185+
var alertModel *admin20231115014.GroupAlertsConfig
186186

187187
// Cannot enable/disable ONLY via update (if only send enable as changed field server returns a 500 error)
188188
// so have to use different method to change enabled.
189-
if reflect.DeepEqual(alertReq, &admin.GroupAlertsConfig{Enabled: aws.Bool(true)}) ||
190-
reflect.DeepEqual(alertReq, &admin.GroupAlertsConfig{Enabled: aws.Bool(false)}) {
191-
alertModel, res, err = atlasV2.AlertConfigurationsApi.ToggleAlertConfiguration(context.Background(), projectID, id, &admin.AlertsToggle{Enabled: alertReq.Enabled}).Execute()
189+
if reflect.DeepEqual(alertReq, &admin20231115014.GroupAlertsConfig{Enabled: aws.Bool(true)}) ||
190+
reflect.DeepEqual(alertReq, &admin20231115014.GroupAlertsConfig{Enabled: aws.Bool(false)}) {
191+
alertModel, res, err = atlasV2.AlertConfigurationsApi.ToggleAlertConfiguration(context.Background(), projectID, id, &admin20231115014.AlertsToggle{Enabled: alertReq.Enabled}).Execute()
192192
} else {
193193
alertModel, res, err = atlasV2.AlertConfigurationsApi.UpdateAlertConfiguration(context.Background(), projectID, id, alertReq).Execute()
194194
}
@@ -251,15 +251,15 @@ func List(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
251251
HandlerErrorCode: cloudformation.HandlerErrorCodeNotFound}, nil
252252
}
253253

254-
func isExist(currentModel *Model, client *admin.APIClient) bool {
254+
func isExist(currentModel *Model, client *admin20231115014.APIClient) bool {
255255
alert, _, err := client.AlertConfigurationsApi.GetAlertConfiguration(context.Background(), *currentModel.ProjectId, *currentModel.Id).Execute()
256256
return err == nil && alert != nil
257257
}
258258

259-
func expandAlertConfigurationMatchers(matchers []Matcher) *[]admin.StreamsMatcher {
260-
mts := make([]admin.StreamsMatcher, 0)
259+
func expandAlertConfigurationMatchers(matchers []Matcher) *[]admin20231115014.StreamsMatcher {
260+
mts := make([]admin20231115014.StreamsMatcher, 0)
261261
for ind := range matchers {
262-
mMatcher := admin.NewStreamsMatcher(
262+
mMatcher := admin20231115014.NewStreamsMatcher(
263263
cast.ToString(matchers[ind].FieldName),
264264
cast.ToString(matchers[ind].Operator),
265265
cast.ToString(matchers[ind].Value),
@@ -269,12 +269,12 @@ func expandAlertConfigurationMatchers(matchers []Matcher) *[]admin.StreamsMatche
269269
return &mts
270270
}
271271

272-
func expandAlertConfigurationMetricThresholdConfig(currentModel *Model) *admin.ServerlessMetricThreshold {
272+
func expandAlertConfigurationMetricThresholdConfig(currentModel *Model) *admin20231115014.ServerlessMetricThreshold {
273273
threshold := currentModel.MetricThreshold
274274
if threshold == nil {
275275
return nil
276276
}
277-
return &admin.ServerlessMetricThreshold{
277+
return &admin20231115014.ServerlessMetricThreshold{
278278
MetricName: cast.ToString(threshold.MetricName),
279279
Operator: threshold.Operator,
280280
Threshold: threshold.Threshold,
@@ -283,19 +283,19 @@ func expandAlertConfigurationMetricThresholdConfig(currentModel *Model) *admin.S
283283
}
284284
}
285285

286-
func expandAlertConfigurationThreshold(threshold *IntegerThresholdView) *admin.GreaterThanRawThreshold {
286+
func expandAlertConfigurationThreshold(threshold *IntegerThresholdView) *admin20231115014.GreaterThanRawThreshold {
287287
if threshold == nil {
288288
return nil
289289
}
290-
return &admin.GreaterThanRawThreshold{
290+
return &admin20231115014.GreaterThanRawThreshold{
291291
Operator: threshold.Operator,
292292
Threshold: util.Pointer(int(*threshold.Threshold)),
293293
Units: threshold.Units,
294294
}
295295
}
296296

297-
func expandAlertConfigurationNotification(notificationList []NotificationView) (*[]admin.AlertsNotificationRootForGroup, error) {
298-
notifications := make([]admin.AlertsNotificationRootForGroup, 0)
297+
func expandAlertConfigurationNotification(notificationList []NotificationView) (*[]admin20231115014.AlertsNotificationRootForGroup, error) {
298+
notifications := make([]admin20231115014.AlertsNotificationRootForGroup, 0)
299299

300300
for ind := range notificationList {
301301
if notificationList[ind].IntervalMin != nil && *notificationList[ind].IntervalMin > cast.ToFloat64(0) {
@@ -307,7 +307,7 @@ func expandAlertConfigurationNotification(notificationList []NotificationView) (
307307
}
308308

309309
for ind := range notificationList {
310-
notification := admin.AlertsNotificationRootForGroup{
310+
notification := admin20231115014.AlertsNotificationRootForGroup{
311311
ApiToken: notificationList[ind].ApiToken,
312312
ChannelName: notificationList[ind].ChannelName,
313313
DatadogApiKey: notificationList[ind].DatadogApiKey,
@@ -334,9 +334,9 @@ func expandAlertConfigurationNotification(notificationList []NotificationView) (
334334
return &notifications, nil
335335
}
336336

337-
func convertToMongoModel(reqModel *admin.GroupAlertsConfig, currentModel *Model) *admin.GroupAlertsConfig {
337+
func convertToMongoModel(reqModel *admin20231115014.GroupAlertsConfig, currentModel *Model) *admin20231115014.GroupAlertsConfig {
338338
if reqModel == nil {
339-
reqModel = &admin.GroupAlertsConfig{}
339+
reqModel = &admin20231115014.GroupAlertsConfig{}
340340
}
341341

342342
// Only change the updated fields
@@ -361,7 +361,7 @@ func convertToMongoModel(reqModel *admin.GroupAlertsConfig, currentModel *Model)
361361
return reqModel
362362
}
363363

364-
func convertToUIModel(alertConfig *admin.GroupAlertsConfig, currentModel *Model) *Model {
364+
func convertToUIModel(alertConfig *admin20231115014.GroupAlertsConfig, currentModel *Model) *Model {
365365
currentModel.Id = alertConfig.Id
366366
if alertConfig.Created != nil {
367367
currentModel.Created = util.TimePtrToStringPtr(alertConfig.Created)

cfn-resources/api-key/cmd/resource/resource.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/secrets"
3232
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
3333

34-
"go.mongodb.org/atlas-sdk/v20231115014/admin"
34+
admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin"
3535
)
3636

3737
var CreateRequiredFields = []string{constants.OrgID, constants.Description, constants.AwsSecretName}
@@ -67,7 +67,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
6767
return *peErr, nil
6868
}
6969

70-
apiKeyInput := admin.CreateAtlasOrganizationApiKey{
70+
apiKeyInput := admin20231115014.CreateAtlasOrganizationApiKey{
7171
Desc: util.SafeString(currentModel.Description),
7272
Roles: currentModel.Roles,
7373
}
@@ -159,7 +159,7 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
159159
if peErr != nil {
160160
return *peErr, nil
161161
}
162-
apiKeyInput := admin.UpdateAtlasOrganizationApiKey{
162+
apiKeyInput := admin20231115014.UpdateAtlasOrganizationApiKey{
163163
Desc: currentModel.Description,
164164
Roles: &currentModel.Roles,
165165
}
@@ -304,7 +304,7 @@ func assignProjects(client *util.MongoDBClient, project ProjectAssignment, apiUs
304304
return handler.ProgressEvent{}, err
305305
}
306306

307-
func getAPIkeyDetails(req *handler.Request, client *util.MongoDBClient, currentModel *Model) (*admin.ApiKeyUserDetails, *string, *http.Response, error) {
307+
func getAPIkeyDetails(req *handler.Request, client *util.MongoDBClient, currentModel *Model) (*admin20231115014.ApiKeyUserDetails, *string, *http.Response, error) {
308308
apiKeyRequest := client.Atlas20231115014.ProgrammaticAPIKeysApi.GetApiKey(
309309
context.Background(),
310310
*currentModel.OrgId,
@@ -319,8 +319,8 @@ func getAPIkeyDetails(req *handler.Request, client *util.MongoDBClient, currentM
319319
return apiKeyUserDetails, arn, response, err
320320
}
321321

322-
func updateOrgKeyProjectRoles(projectAssignment ProjectAssignment, client *util.MongoDBClient, orgKeyID *string) (*admin.ApiKeyUserDetails, *http.Response, error) {
323-
projectAPIKeyInput := admin.UpdateAtlasProjectApiKey{
322+
func updateOrgKeyProjectRoles(projectAssignment ProjectAssignment, client *util.MongoDBClient, orgKeyID *string) (*admin20231115014.ApiKeyUserDetails, *http.Response, error) {
323+
projectAPIKeyInput := admin20231115014.UpdateAtlasProjectApiKey{
324324
Roles: &projectAssignment.Roles,
325325
}
326326
assignAPIRequest := client.Atlas20231115014.ProgrammaticAPIKeysApi.UpdateApiKeyRoles(
@@ -446,7 +446,7 @@ func areStringArraysEqualIgnoreOrder(arr1, arr2 []string) bool {
446446
return true
447447
}
448448

449-
func (model *Model) readAPIKeyDetails(apikey admin.ApiKeyUserDetails) Model {
449+
func (model *Model) readAPIKeyDetails(apikey admin20231115014.ApiKeyUserDetails) Model {
450450
model.APIUserId = apikey.Id
451451
model.Description = apikey.Desc
452452
model.PublicKey = apikey.PublicKey

cfn-resources/auditing/cmd/resource/resource.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
log "github.com/mongodb/mongodbatlas-cloudformation-resources/util/logger"
2828
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
2929
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
30-
"go.mongodb.org/atlas-sdk/v20231115014/admin"
30+
admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin"
3131
)
3232

3333
var RequiredFields = []string{constants.ProjectID}
@@ -67,7 +67,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
6767

6868
enabled := true
6969

70-
auditingInput := admin.AuditLog{
70+
auditingInput := admin20231115014.AuditLog{
7171
Enabled: &enabled,
7272
}
7373

@@ -163,7 +163,7 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
163163
}
164164

165165
var res *http.Response
166-
auditingInput := admin.AuditLog{}
166+
auditingInput := admin20231115014.AuditLog{}
167167
modified := false
168168

169169
if currentModel.AuditAuthorizationSuccess != nil {
@@ -230,7 +230,7 @@ func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler
230230
var res *http.Response
231231
enabled := false
232232

233-
auditingInput := admin.AuditLog{
233+
auditingInput := admin20231115014.AuditLog{
234234
Enabled: &enabled,
235235
AuditFilter: currentModel.AuditFilter,
236236
}
@@ -246,7 +246,7 @@ func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler
246246
}, nil
247247
}
248248

249-
func isEnabled(client admin.APIClient, currentModel Model) (bool, *handler.ProgressEvent) {
249+
func isEnabled(client admin20231115014.APIClient, currentModel Model) (bool, *handler.ProgressEvent) {
250250
atlasAuditing, res, err := client.AuditingApi.GetAuditingConfiguration(context.Background(), *currentModel.ProjectId).Execute()
251251

252252
if err != nil {

cfn-resources/cloud-backup-restore-jobs/cmd/resource/resource.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/constants"
2828
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
2929
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
30-
"go.mongodb.org/atlas-sdk/v20231115014/admin"
30+
admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin"
3131
)
3232

3333
var CreateRequiredFields = []string{constants.SnapshotID, constants.DeliveryType, constants.InstanceType, constants.InstanceName}
@@ -370,7 +370,7 @@ func updateModel(client *util.MongoDBClient, model *Model, checkFinish bool) *ha
370370
return nil
371371
}
372372

373-
func updateModelServerless(model *Model, job *admin.ServerlessBackupRestoreJob) {
373+
func updateModelServerless(model *Model, job *admin20231115014.ServerlessBackupRestoreJob) {
374374
model.TargetClusterName = &job.TargetClusterName
375375
model.DeliveryType = &job.DeliveryType
376376
model.ExpiresAt = util.TimePtrToStringPtr(job.ExpiresAt)
@@ -385,7 +385,7 @@ func updateModelServerless(model *Model, job *admin.ServerlessBackupRestoreJob)
385385
model.Links = flattenLinks(job.GetLinks())
386386
}
387387

388-
func updateModelServer(model *Model, job *admin.DiskBackupSnapshotRestoreJob) {
388+
func updateModelServer(model *Model, job *admin20231115014.DiskBackupSnapshotRestoreJob) {
389389
model.TargetClusterName = job.TargetClusterName
390390
model.DeliveryType = &job.DeliveryType
391391
model.ExpiresAt = util.TimePtrToStringPtr(job.ExpiresAt)
@@ -401,7 +401,7 @@ func updateModelServer(model *Model, job *admin.DiskBackupSnapshotRestoreJob) {
401401
model.Links = flattenLinks(job.GetLinks())
402402
}
403403

404-
func flattenLinks(linksResult []admin.Link) []Links {
404+
func flattenLinks(linksResult []admin20231115014.Link) []Links {
405405
links := make([]Links, 0)
406406
for _, link := range linksResult {
407407
var lin Links
@@ -412,8 +412,8 @@ func flattenLinks(linksResult []admin.Link) []Links {
412412
return links
413413
}
414414

415-
func paramsServer(model *Model) *admin.DiskBackupSnapshotRestoreJob {
416-
return &admin.DiskBackupSnapshotRestoreJob{
415+
func paramsServer(model *Model) *admin20231115014.DiskBackupSnapshotRestoreJob {
416+
return &admin20231115014.DiskBackupSnapshotRestoreJob{
417417
SnapshotId: model.SnapshotId,
418418
DeliveryType: *model.DeliveryType,
419419
TargetClusterName: model.TargetClusterName,
@@ -424,8 +424,8 @@ func paramsServer(model *Model) *admin.DiskBackupSnapshotRestoreJob {
424424
}
425425
}
426426

427-
func paramsServerless(model *Model) *admin.ServerlessBackupRestoreJob {
428-
return &admin.ServerlessBackupRestoreJob{
427+
func paramsServerless(model *Model) *admin20231115014.ServerlessBackupRestoreJob {
428+
return &admin20231115014.ServerlessBackupRestoreJob{
429429
SnapshotId: model.SnapshotId,
430430
DeliveryType: *model.DeliveryType,
431431
TargetClusterName: *model.TargetClusterName,

0 commit comments

Comments
 (0)