Skip to content

Commit a87b05d

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 03fe362e of spec repo
1 parent d73822f commit a87b05d

9 files changed

+166
-16
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-28 19:18:47.087973",
8-
"spec_repo_commit": "4b2bab38"
7+
"regenerated": "2023-09-29 12:47:02.838417",
8+
"spec_repo_commit": "03fe362e"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-09-28 19:18:47.102159",
13-
"spec_repo_commit": "4b2bab38"
12+
"regenerated": "2023-09-29 12:47:02.853101",
13+
"spec_repo_commit": "03fe362e"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5399,6 +5399,13 @@ components:
53995399
GCPSTSServiceAccountAttributes:
54005400
description: Attributes associated with your service account.
54015401
properties:
5402+
account_tags:
5403+
description: Tags to be associated with GCP metrics and service checks from
5404+
your account.
5405+
items:
5406+
description: Account Level Tag
5407+
type: string
5408+
type: array
54025409
automute:
54035410
description: Silence monitors for expected GCE instance shutdowns.
54045411
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 metrics and service checks 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-29T12:39:55.710Z

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\":{\"client_email\":\"80e3f00106389e6e@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\",\"id\":\"d6c68645-2b52-43e9-838c-9b7fdb809a8d\",\"attributes\":{\"host_filters\":[],\"account_tags\":[],\"client_email\":\"80e3f00106389e6e@test-project.iam.gserviceaccount.com\",\"is_cspm_enabled\":false,\"automute\":false}}}\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": "d1521ff2-cbc6-5041-1e92-18068d5d6a7e"
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/d6c68645-2b52-43e9-838c-9b7fdb809a8d",
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": "7683c40f-3453-6c34-6491-142980d75660"
5656
}
5757
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-09-27T14:45:59.771Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[
2+
{
3+
"httpRequest": {
4+
"body": {
5+
"type": "JSON",
6+
"json": "{\"data\":{\"attributes\":{\"account_tags\":[\"lorem\",\"ipsum\"],\"client_email\":\"1f86730b653d0a57@test-project.iam.gserviceaccount.com\",\"host_filters\":[]},\"type\":\"gcp_service_account\"}}"
7+
},
8+
"headers": {},
9+
"method": "POST",
10+
"path": "/api/v2/integration/gcp/accounts",
11+
"keepAlive": false,
12+
"secure": true
13+
},
14+
"httpResponse": {
15+
"body": "{\"data\":{\"type\":\"gcp_service_account\",\"attributes\":{\"host_filters\":[],\"client_email\":\"1f86730b653d0a57@test-project.iam.gserviceaccount.com\",\"is_cspm_enabled\":false,\"automute\":false,\"account_tags\":[\"lorem\",\"ipsum\"]},\"id\":\"1cdedba8-a0a3-4036-82b0-ad8088dd0c02\"}}\n",
16+
"headers": {
17+
"Content-Type": [
18+
"application/json"
19+
]
20+
},
21+
"statusCode": 201,
22+
"reasonPhrase": "Created"
23+
},
24+
"times": {
25+
"remainingTimes": 1
26+
},
27+
"timeToLive": {
28+
"unlimited": true
29+
},
30+
"id": "4f5b930c-5c9b-1952-a77d-6f90ad34f1c6"
31+
},
32+
{
33+
"httpRequest": {
34+
"headers": {},
35+
"method": "DELETE",
36+
"path": "/api/v2/integration/gcp/accounts/1cdedba8-a0a3-4036-82b0-ad8088dd0c02",
37+
"keepAlive": false,
38+
"secure": true
39+
},
40+
"httpResponse": {
41+
"headers": {
42+
"Content-Type": [
43+
"text/html; charset=utf-8"
44+
]
45+
},
46+
"statusCode": 204,
47+
"reasonPhrase": "No Content"
48+
},
49+
"times": {
50+
"remainingTimes": 1
51+
},
52+
"timeToLive": {
53+
"unlimited": true
54+
},
55+
"id": "ad93d1da-3ff7-11df-78b7-add4d376ada9"
56+
}
57+
]

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ 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

@@ -54,6 +54,16 @@ Feature: GCP Integration
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)