Skip to content

Commit

Permalink
CLOUDP-179698 Add tags to serverless (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmenezes authored May 29, 2023
1 parent 45637d0 commit f979068
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
2 changes: 2 additions & 0 deletions mongodbatlas/serverless_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ type ServerlessCreateRequestParams struct {
ProviderSettings *ServerlessProviderSettings `json:"providerSettings,omitempty"`
ServerlessBackupOptions *ServerlessBackupOptions `json:"serverlessBackupOptions,omitempty"`
TerminationProtectionEnabled *bool `json:"terminationProtectionEnabled,omitempty"`
Tag []*Tag `json:"tags,omitempty"`
}

type ServerlessUpdateRequestParams struct {
ServerlessBackupOptions *ServerlessBackupOptions `json:"serverlessBackupOptions"`
TerminationProtectionEnabled *bool `json:"terminationProtectionEnabled,omitempty"`
Tag []*Tag `json:"tags,omitempty"`
}

// ServerlessProviderSettings represents the Provider Settings of serverless instances.
Expand Down
36 changes: 32 additions & 4 deletions mongodbatlas/serverless_instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func TestServerlessInstances_List(t *testing.T) {
"backingProviderName": "AWS",
"regionName": "US_EAST_1"
},
"stateName": "IDLE"
"stateName": "IDLE",
"tags": [ { "key": "key1", "value": "value1" } ]
},{
"connectionStrings": {
"standardSrv" : "mongodb+srv://instance1.example.com"
Expand All @@ -76,7 +77,8 @@ func TestServerlessInstances_List(t *testing.T) {
"backingProviderName": "AWS",
"regionName": "US_EAST_1"
},
"stateName": "IDLE"
"stateName": "IDLE",
"tags": [ { "key": "key1", "value": "value1" } ]
}],
"totalCount": 2
}`)
Expand Down Expand Up @@ -104,6 +106,12 @@ func TestServerlessInstances_List(t *testing.T) {
StateName: "IDLE",
ConnectionStrings: &ConnectionStrings{StandardSrv: "mongodb+srv://instance1.example.com"},
CreateDate: "2021-06-25T21:32:06Z",
Tags: []*Tag{
{
Key: "key1",
Value: "value1",
},
},
Links: []*Link{
{
Rel: "self",
Expand All @@ -120,6 +128,12 @@ func TestServerlessInstances_List(t *testing.T) {
StateName: "IDLE",
ConnectionStrings: &ConnectionStrings{StandardSrv: "mongodb+srv://instance1.example.com"},
CreateDate: "2021-06-25T21:32:06Z",
Tags: []*Tag{
{
Key: "key1",
Value: "value1",
},
},
Links: []*Link{
{
Rel: "self",
Expand Down Expand Up @@ -217,7 +231,8 @@ func TestServerlessInstances_Create(t *testing.T) {
"backingProviderName": "AWS",
"regionName": "US_EAST_1"
},
"stateName": "IDLE"
"stateName": "IDLE",
"tags": [ { "key": "key1", "value": "value1" } ]
}`)
})

Expand Down Expand Up @@ -246,6 +261,12 @@ func TestServerlessInstances_Create(t *testing.T) {
Href: "http://cloud.mongodb.com/api/atlas/v1.0/groups/{groupId}/serverless/{instanceName1}",
},
},
Tags: []*Tag{
{
Key: "key1",
Value: "value1",
},
},
}

if diff := deep.Equal(serverlessInstance, expected); diff != nil {
Expand Down Expand Up @@ -287,7 +308,8 @@ func TestServerlessInstances_Update(t *testing.T) {
"serverlessContinuousBackupEnabled" : true
},
"stateName" : "IDLE",
"terminationProtectionEnabled": true
"terminationProtectionEnabled": true,
"tags": [ { "key": "key1", "value": "value1" } ]
}`)
})

Expand Down Expand Up @@ -326,6 +348,12 @@ func TestServerlessInstances_Update(t *testing.T) {
Href: "http://cloud.mongodb.com/api/atlas/v1.0/groups/{groupId}/serverless/{instanceName1}/backup/snapshots",
},
},
Tags: []*Tag{
{
Key: "key1",
Value: "value1",
},
},
}

if diff := deep.Equal(serverlessInstance, expected); diff != nil {
Expand Down

0 comments on commit f979068

Please sign in to comment.