Skip to content

Commit 98f1a2a

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit cc202cae of spec repo
1 parent e1cb3b2 commit 98f1a2a

File tree

7 files changed

+109
-17
lines changed

7 files changed

+109
-17
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-09-26 14:16:42.583794",
8-
"spec_repo_commit": "0270a00c"
7+
"regenerated": "2023-09-27 14:46:44.726576",
8+
"spec_repo_commit": "cc202cae"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-09-26 14:16:42.597935",
13-
"spec_repo_commit": "0270a00c"
12+
"regenerated": "2023-09-27 14:46:44.741059",
13+
"spec_repo_commit": "cc202cae"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5403,6 +5403,13 @@ components:
54035403
GCPSTSServiceAccountAttributes:
54045404
description: Attributes associated with your service account.
54055405
properties:
5406+
account_tags:
5407+
description: Tags to be associated with GCP resources and metrics from your
5408+
account.
5409+
items:
5410+
description: Account Level Tag
5411+
type: string
5412+
type: array
54065413
automute:
54075414
description: Silence monitors for expected GCE instance shutdowns.
54085415
type: boolean
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Create a new entry for your service account with account_tags returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.GcpIntegrationApi;
6+
import com.datadog.api.client.v2.model.GCPSTSServiceAccountAttributes;
7+
import com.datadog.api.client.v2.model.GCPSTSServiceAccountCreateRequest;
8+
import com.datadog.api.client.v2.model.GCPSTSServiceAccountData;
9+
import com.datadog.api.client.v2.model.GCPSTSServiceAccountResponse;
10+
import com.datadog.api.client.v2.model.GCPServiceAccountType;
11+
import java.util.Arrays;
12+
13+
public class Example {
14+
public static void main(String[] args) {
15+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
16+
GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient);
17+
18+
GCPSTSServiceAccountCreateRequest body =
19+
new GCPSTSServiceAccountCreateRequest()
20+
.data(
21+
new GCPSTSServiceAccountData()
22+
.attributes(
23+
new GCPSTSServiceAccountAttributes()
24+
.accountTags(Arrays.asList("lorem", "ipsum"))
25+
.clientEmail("252bf553ef04b351@test-project.iam.gserviceaccount.com"))
26+
.type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT));
27+
28+
try {
29+
GCPSTSServiceAccountResponse result = apiInstance.createGCPSTSAccount(body);
30+
System.out.println(result);
31+
} catch (ApiException e) {
32+
System.err.println("Exception when calling GcpIntegrationApi#createGCPSTSAccount");
33+
System.err.println("Status code: " + e.getCode());
34+
System.err.println("Reason: " + e.getResponseBody());
35+
System.err.println("Response headers: " + e.getResponseHeaders());
36+
e.printStackTrace();
37+
}
38+
}
39+
}

src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
/** Attributes associated with your service account. */
2222
@JsonPropertyOrder({
23+
GCPSTSServiceAccountAttributes.JSON_PROPERTY_ACCOUNT_TAGS,
2324
GCPSTSServiceAccountAttributes.JSON_PROPERTY_AUTOMUTE,
2425
GCPSTSServiceAccountAttributes.JSON_PROPERTY_CLIENT_EMAIL,
2526
GCPSTSServiceAccountAttributes.JSON_PROPERTY_HOST_FILTERS,
@@ -29,6 +30,9 @@
2930
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
3031
public class GCPSTSServiceAccountAttributes {
3132
@JsonIgnore public boolean unparsed = false;
33+
public static final String JSON_PROPERTY_ACCOUNT_TAGS = "account_tags";
34+
private List<String> accountTags = null;
35+
3236
public static final String JSON_PROPERTY_AUTOMUTE = "automute";
3337
private Boolean automute;
3438

@@ -41,6 +45,35 @@ public class GCPSTSServiceAccountAttributes {
4145
public static final String JSON_PROPERTY_IS_CSPM_ENABLED = "is_cspm_enabled";
4246
private Boolean isCspmEnabled;
4347

48+
public GCPSTSServiceAccountAttributes accountTags(List<String> accountTags) {
49+
this.accountTags = accountTags;
50+
return this;
51+
}
52+
53+
public GCPSTSServiceAccountAttributes addAccountTagsItem(String accountTagsItem) {
54+
if (this.accountTags == null) {
55+
this.accountTags = new ArrayList<>();
56+
}
57+
this.accountTags.add(accountTagsItem);
58+
return this;
59+
}
60+
61+
/**
62+
* Tags to be associated with GCP resources and metrics from your account.
63+
*
64+
* @return accountTags
65+
*/
66+
@jakarta.annotation.Nullable
67+
@JsonProperty(JSON_PROPERTY_ACCOUNT_TAGS)
68+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
69+
public List<String> getAccountTags() {
70+
return accountTags;
71+
}
72+
73+
public void setAccountTags(List<String> accountTags) {
74+
this.accountTags = accountTags;
75+
}
76+
4477
public GCPSTSServiceAccountAttributes automute(Boolean automute) {
4578
this.automute = automute;
4679
return this;
@@ -191,7 +224,8 @@ public boolean equals(Object o) {
191224
}
192225
GCPSTSServiceAccountAttributes gcpstsServiceAccountAttributes =
193226
(GCPSTSServiceAccountAttributes) o;
194-
return Objects.equals(this.automute, gcpstsServiceAccountAttributes.automute)
227+
return Objects.equals(this.accountTags, gcpstsServiceAccountAttributes.accountTags)
228+
&& Objects.equals(this.automute, gcpstsServiceAccountAttributes.automute)
195229
&& Objects.equals(this.clientEmail, gcpstsServiceAccountAttributes.clientEmail)
196230
&& Objects.equals(this.hostFilters, gcpstsServiceAccountAttributes.hostFilters)
197231
&& Objects.equals(this.isCspmEnabled, gcpstsServiceAccountAttributes.isCspmEnabled)
@@ -201,13 +235,15 @@ public boolean equals(Object o) {
201235

202236
@Override
203237
public int hashCode() {
204-
return Objects.hash(automute, clientEmail, hostFilters, isCspmEnabled, additionalProperties);
238+
return Objects.hash(
239+
accountTags, automute, clientEmail, hostFilters, isCspmEnabled, additionalProperties);
205240
}
206241

207242
@Override
208243
public String toString() {
209244
StringBuilder sb = new StringBuilder();
210245
sb.append("class GCPSTSServiceAccountAttributes {\n");
246+
sb.append(" accountTags: ").append(toIndentedString(accountTags)).append("\n");
211247
sb.append(" automute: ").append(toIndentedString(automute)).append("\n");
212248
sb.append(" clientEmail: ").append(toIndentedString(clientEmail)).append("\n");
213249
sb.append(" hostFilters: ").append(toIndentedString(hostFilters)).append("\n");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-06-16T14:05:25.134Z
1+
2023-09-22T15:33:37.996Z

src/test/resources/cassettes/features/v2/Create_a_new_entry_for_your_service_account_returns_OK_response.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"httpRequest": {
44
"body": {
55
"type": "JSON",
6-
"json": "{\"data\":{\"attributes\":{\"client_email\":\"47cdd79b4a719ac2@test-project.iam.gserviceaccount.com\",\"host_filters\":[]},\"type\":\"gcp_service_account\"}}"
6+
"json": "{\"data\":{\"attributes\":{\"account_tags\":[],\"client_email\":\"8abafc3b19e440e5@test-project.iam.gserviceaccount.com\",\"host_filters\":[]},\"type\":\"gcp_service_account\"}}"
77
},
88
"headers": {},
99
"method": "POST",
@@ -12,7 +12,7 @@
1212
"secure": true
1313
},
1414
"httpResponse": {
15-
"body": "{\"data\":{\"type\":\"gcp_service_account\",\"attributes\":{\"host_filters\":[],\"client_email\":\"47cdd79b4a719ac2@test-project.iam.gserviceaccount.com\",\"is_cspm_enabled\":false,\"automute\":false},\"id\":\"3aa3ec77-9646-4f6a-bcd0-01e5124e2ad1\"}}\n",
15+
"body": "{\"data\":{\"type\":\"gcp_service_account\",\"attributes\":{\"automute\":false,\"client_email\":\"8abafc3b19e440e5@test-project.iam.gserviceaccount.com\",\"host_filters\":[],\"account_tags\":[],\"is_cspm_enabled\":false},\"id\":\"2e3af706-ac9e-4c6d-ab5b-41f63f8385db\"}}\n",
1616
"headers": {
1717
"Content-Type": [
1818
"application/json"
@@ -27,13 +27,13 @@
2727
"timeToLive": {
2828
"unlimited": true
2929
},
30-
"id": "244386ca-785e-1a93-6a8e-b76d486ba395"
30+
"id": "903dbf42-9c16-0501-62a8-8024c7b7c916"
3131
},
3232
{
3333
"httpRequest": {
3434
"headers": {},
3535
"method": "DELETE",
36-
"path": "/api/v2/integration/gcp/accounts/3aa3ec77-9646-4f6a-bcd0-01e5124e2ad1",
36+
"path": "/api/v2/integration/gcp/accounts/2e3af706-ac9e-4c6d-ab5b-41f63f8385db",
3737
"keepAlive": false,
3838
"secure": true
3939
},
@@ -52,6 +52,6 @@
5252
"timeToLive": {
5353
"unlimited": true
5454
},
55-
"id": "20a1fed0-dc1a-8819-8825-904ecb3db9f0"
55+
"id": "63c7ddba-04e7-4c4d-294b-a49aaf12de07"
5656
}
5757
]

src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,36 @@ Feature: GCP Integration
3434
@generated @skip @team:DataDog/gcp-integrations
3535
Scenario: Create a new entry for your service account returns "Bad Request" response
3636
Given new "CreateGCPSTSAccount" request
37-
And body with value {"data": {"attributes": {"client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}}
37+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}}
3838
When the request is sent
3939
Then the response status is 400 Bad Request
4040

4141
@generated @skip @team:DataDog/gcp-integrations
4242
Scenario: Create a new entry for your service account returns "Conflict" response
4343
Given new "CreateGCPSTSAccount" request
44-
And body with value {"data": {"attributes": {"client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}}
44+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}}
4545
When the request is sent
4646
Then the response status is 409 Conflict
4747

4848
@skip-validation @team:DataDog/gcp-integrations
4949
Scenario: Create a new entry for your service account returns "OK" response
5050
Given new "CreateGCPSTSAccount" request
51-
And body with value {"data": {"attributes": {"client_email": "{{ unique_hash }}@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}}
51+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "{{ unique_hash }}@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}}
5252
When the request is sent
5353
Then the response status is 201 OK
5454
And the response "data.type" is equal to "gcp_service_account"
5555
And the response "data.attributes.client_email" is equal to "{{ unique_hash }}@test-project.iam.gserviceaccount.com"
5656

57+
@team:DataDog/gcp-integrations
58+
Scenario: Create a new entry for your service account with account_tags returns "OK" response
59+
Given new "CreateGCPSTSAccount" request
60+
And body with value {"data": {"attributes": {"account_tags": ["lorem", "ipsum"], "client_email": "{{ unique_hash }}@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}}
61+
When the request is sent
62+
Then the response status is 201 OK
63+
And the response "data.type" is equal to "gcp_service_account"
64+
And the response "data.attributes.client_email" is equal to "{{ unique_hash }}@test-project.iam.gserviceaccount.com"
65+
And the response "data.attributes.account_tags" is equal to ["lorem", "ipsum"]
66+
5767
@generated @skip @team:DataDog/gcp-integrations
5868
Scenario: Delete an STS enabled GCP Account returns "Bad Request" response
5969
Given new "DeleteGCPSTSAccount" request
@@ -93,15 +103,15 @@ Feature: GCP Integration
93103
Scenario: Update STS Service Account returns "Bad Request" response
94104
Given new "UpdateGCPSTSAccount" request
95105
And request contains "account_id" parameter from "REPLACE.ME"
96-
And body with value {"data": {"attributes": {"client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
106+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
97107
When the request is sent
98108
Then the response status is 400 Bad Request
99109

100110
@generated @skip @team:DataDog/gcp-integrations
101111
Scenario: Update STS Service Account returns "Not Found" response
102112
Given new "UpdateGCPSTSAccount" request
103113
And request contains "account_id" parameter from "REPLACE.ME"
104-
And body with value {"data": {"attributes": {"client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
114+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
105115
When the request is sent
106116
Then the response status is 404 Not Found
107117

0 commit comments

Comments
 (0)