Skip to content

Commit f979068

Browse files
authored
CLOUDP-179698 Add tags to serverless (#491)
1 parent 45637d0 commit f979068

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

mongodbatlas/serverless_instances.go

+2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ type ServerlessCreateRequestParams struct {
5151
ProviderSettings *ServerlessProviderSettings `json:"providerSettings,omitempty"`
5252
ServerlessBackupOptions *ServerlessBackupOptions `json:"serverlessBackupOptions,omitempty"`
5353
TerminationProtectionEnabled *bool `json:"terminationProtectionEnabled,omitempty"`
54+
Tag []*Tag `json:"tags,omitempty"`
5455
}
5556

5657
type ServerlessUpdateRequestParams struct {
5758
ServerlessBackupOptions *ServerlessBackupOptions `json:"serverlessBackupOptions"`
5859
TerminationProtectionEnabled *bool `json:"terminationProtectionEnabled,omitempty"`
60+
Tag []*Tag `json:"tags,omitempty"`
5961
}
6062

6163
// ServerlessProviderSettings represents the Provider Settings of serverless instances.

mongodbatlas/serverless_instances_test.go

+32-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func TestServerlessInstances_List(t *testing.T) {
5757
"backingProviderName": "AWS",
5858
"regionName": "US_EAST_1"
5959
},
60-
"stateName": "IDLE"
60+
"stateName": "IDLE",
61+
"tags": [ { "key": "key1", "value": "value1" } ]
6162
},{
6263
"connectionStrings": {
6364
"standardSrv" : "mongodb+srv://instance1.example.com"
@@ -76,7 +77,8 @@ func TestServerlessInstances_List(t *testing.T) {
7677
"backingProviderName": "AWS",
7778
"regionName": "US_EAST_1"
7879
},
79-
"stateName": "IDLE"
80+
"stateName": "IDLE",
81+
"tags": [ { "key": "key1", "value": "value1" } ]
8082
}],
8183
"totalCount": 2
8284
}`)
@@ -104,6 +106,12 @@ func TestServerlessInstances_List(t *testing.T) {
104106
StateName: "IDLE",
105107
ConnectionStrings: &ConnectionStrings{StandardSrv: "mongodb+srv://instance1.example.com"},
106108
CreateDate: "2021-06-25T21:32:06Z",
109+
Tags: []*Tag{
110+
{
111+
Key: "key1",
112+
Value: "value1",
113+
},
114+
},
107115
Links: []*Link{
108116
{
109117
Rel: "self",
@@ -120,6 +128,12 @@ func TestServerlessInstances_List(t *testing.T) {
120128
StateName: "IDLE",
121129
ConnectionStrings: &ConnectionStrings{StandardSrv: "mongodb+srv://instance1.example.com"},
122130
CreateDate: "2021-06-25T21:32:06Z",
131+
Tags: []*Tag{
132+
{
133+
Key: "key1",
134+
Value: "value1",
135+
},
136+
},
123137
Links: []*Link{
124138
{
125139
Rel: "self",
@@ -217,7 +231,8 @@ func TestServerlessInstances_Create(t *testing.T) {
217231
"backingProviderName": "AWS",
218232
"regionName": "US_EAST_1"
219233
},
220-
"stateName": "IDLE"
234+
"stateName": "IDLE",
235+
"tags": [ { "key": "key1", "value": "value1" } ]
221236
}`)
222237
})
223238

@@ -246,6 +261,12 @@ func TestServerlessInstances_Create(t *testing.T) {
246261
Href: "http://cloud.mongodb.com/api/atlas/v1.0/groups/{groupId}/serverless/{instanceName1}",
247262
},
248263
},
264+
Tags: []*Tag{
265+
{
266+
Key: "key1",
267+
Value: "value1",
268+
},
269+
},
249270
}
250271

251272
if diff := deep.Equal(serverlessInstance, expected); diff != nil {
@@ -287,7 +308,8 @@ func TestServerlessInstances_Update(t *testing.T) {
287308
"serverlessContinuousBackupEnabled" : true
288309
},
289310
"stateName" : "IDLE",
290-
"terminationProtectionEnabled": true
311+
"terminationProtectionEnabled": true,
312+
"tags": [ { "key": "key1", "value": "value1" } ]
291313
}`)
292314
})
293315

@@ -326,6 +348,12 @@ func TestServerlessInstances_Update(t *testing.T) {
326348
Href: "http://cloud.mongodb.com/api/atlas/v1.0/groups/{groupId}/serverless/{instanceName1}/backup/snapshots",
327349
},
328350
},
351+
Tags: []*Tag{
352+
{
353+
Key: "key1",
354+
Value: "value1",
355+
},
356+
},
329357
}
330358

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

0 commit comments

Comments
 (0)