-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cloud run filter to GCP v1 and v2 spec (#2156)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
fc08c5c
commit 46dab3c
Showing
19 changed files
with
518 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
examples/v1/gcp-integration/UpdateGCPIntegration_3544259255.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Update a GCP integration cloud run revision filters returns "OK" response | ||
|
||
import com.datadog.api.client.ApiClient; | ||
import com.datadog.api.client.ApiException; | ||
import com.datadog.api.client.v1.api.GcpIntegrationApi; | ||
import com.datadog.api.client.v1.model.GCPAccount; | ||
import java.util.Collections; | ||
|
||
public class Example { | ||
public static void main(String[] args) { | ||
ApiClient defaultClient = ApiClient.getDefaultApiClient(); | ||
GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); | ||
|
||
GCPAccount body = | ||
new GCPAccount() | ||
.authProviderX509CertUrl("https://www.googleapis.com/oauth2/v1/certs") | ||
.authUri("https://accounts.google.com/o/oauth2/auth") | ||
.clientEmail("252bf553ef04b351@example.com") | ||
.clientId("163662907116366290710") | ||
.clientX509CertUrl("https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL") | ||
.hostFilters("key:value,filter:example") | ||
.cloudRunRevisionFilters(Collections.singletonList("merp:derp")) | ||
.isCspmEnabled(true) | ||
.isSecurityCommandCenterEnabled(true) | ||
.privateKey("private_key") | ||
.privateKeyId("123456789abcdefghi123456789abcdefghijklm") | ||
.projectId("datadog-apitest") | ||
.resourceCollectionEnabled(true) | ||
.tokenUri("https://accounts.google.com/o/oauth2/token") | ||
.type("service_account"); | ||
|
||
try { | ||
apiInstance.updateGCPIntegration(body); | ||
} catch (ApiException e) { | ||
System.err.println("Exception when calling GcpIntegrationApi#updateGCPIntegration"); | ||
System.err.println("Status code: " + e.getCode()); | ||
System.err.println("Reason: " + e.getResponseBody()); | ||
System.err.println("Response headers: " + e.getResponseHeaders()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
examples/v2/gcp-integration/CreateGCPSTSAccount_194782945.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Create a new entry for your service account with cloud run revision filters enabled returns "OK" | ||
// response | ||
|
||
import com.datadog.api.client.ApiClient; | ||
import com.datadog.api.client.ApiException; | ||
import com.datadog.api.client.v2.api.GcpIntegrationApi; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountAttributes; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountCreateRequest; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountData; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountResponse; | ||
import com.datadog.api.client.v2.model.GCPServiceAccountType; | ||
import java.util.Collections; | ||
|
||
public class Example { | ||
public static void main(String[] args) { | ||
ApiClient defaultClient = ApiClient.getDefaultApiClient(); | ||
GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); | ||
|
||
GCPSTSServiceAccountCreateRequest body = | ||
new GCPSTSServiceAccountCreateRequest() | ||
.data( | ||
new GCPSTSServiceAccountData() | ||
.attributes( | ||
new GCPSTSServiceAccountAttributes() | ||
.cloudRunRevisionFilters(Collections.singletonList("meh:bleh")) | ||
.clientEmail("252bf553ef04b351@test-project.iam.gserviceaccount.com")) | ||
.type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT)); | ||
|
||
try { | ||
GCPSTSServiceAccountResponse result = apiInstance.createGCPSTSAccount(body); | ||
System.out.println(result); | ||
} catch (ApiException e) { | ||
System.err.println("Exception when calling GcpIntegrationApi#createGCPSTSAccount"); | ||
System.err.println("Status code: " + e.getCode()); | ||
System.err.println("Reason: " + e.getResponseBody()); | ||
System.err.println("Response headers: " + e.getResponseHeaders()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
examples/v2/gcp-integration/UpdateGCPSTSAccount_2241994060.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Update STS Service Account returns "OK" response with cloud run revision filters | ||
|
||
import com.datadog.api.client.ApiClient; | ||
import com.datadog.api.client.ApiException; | ||
import com.datadog.api.client.v2.api.GcpIntegrationApi; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountAttributes; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountResponse; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountUpdateRequest; | ||
import com.datadog.api.client.v2.model.GCPSTSServiceAccountUpdateRequestData; | ||
import com.datadog.api.client.v2.model.GCPServiceAccountType; | ||
import java.util.Collections; | ||
|
||
public class Example { | ||
public static void main(String[] args) { | ||
ApiClient defaultClient = ApiClient.getDefaultApiClient(); | ||
GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); | ||
|
||
// there is a valid "gcp_sts_account" in the system | ||
String GCP_STS_ACCOUNT_DATA_ID = System.getenv("GCP_STS_ACCOUNT_DATA_ID"); | ||
|
||
GCPSTSServiceAccountUpdateRequest body = | ||
new GCPSTSServiceAccountUpdateRequest() | ||
.data( | ||
new GCPSTSServiceAccountUpdateRequestData() | ||
.attributes( | ||
new GCPSTSServiceAccountAttributes() | ||
.clientEmail("252bf553ef04b351@example.com") | ||
.cloudRunRevisionFilters(Collections.singletonList("merp:derp"))) | ||
.id(GCP_STS_ACCOUNT_DATA_ID) | ||
.type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT)); | ||
|
||
try { | ||
GCPSTSServiceAccountResponse result = | ||
apiInstance.updateGCPSTSAccount(GCP_STS_ACCOUNT_DATA_ID, body); | ||
System.out.println(result); | ||
} catch (ApiException e) { | ||
System.err.println("Exception when calling GcpIntegrationApi#updateGCPSTSAccount"); | ||
System.err.println("Status code: " + e.getCode()); | ||
System.err.println("Reason: " + e.getResponseBody()); | ||
System.err.println("Response headers: " + e.getResponseHeaders()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/test/resources/cassettes/features/v1/Create_a_GCP_integration_returns_OK_response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2023-12-20T13:18:07.717Z | ||
2024-01-31T21:16:03.254Z |
Oops, something went wrong.