Skip to content

Commit

Permalink
Add cloud run filter to GCP v1 and v2 spec (#2156)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Feb 16, 2024
1 parent fc08c5c commit 46dab3c
Show file tree
Hide file tree
Showing 19 changed files with 518 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-02-15 17:39:55.076058",
"spec_repo_commit": "45fd84e5"
"regenerated": "2024-02-16 18:02:53.068147",
"spec_repo_commit": "dc02d0d0"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-02-15 17:39:55.092469",
"spec_repo_commit": "45fd84e5"
"regenerated": "2024-02-16 18:02:53.084384",
"spec_repo_commit": "dc02d0d0"
}
}
}
12 changes: 12 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,18 @@ components:
key.'
example: https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL
type: string
cloud_run_revision_filters:
description: 'Limit the Cloud Run revisions that are pulled into Datadog
by using tags.

Only Cloud Run revision resources that apply to specified filters are
imported into Datadog.'
example:
- $KEY:$VALUE
items:
description: Cloud Run Filters
type: string
type: array
errors:
description: An array of errors.
example:
Expand Down
12 changes: 12 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7388,6 +7388,18 @@ components:
description: Your service account email address.
example: datadog-service-account@test-project.iam.gserviceaccount.com
type: string
cloud_run_revision_filters:
description: 'List of filters to limit the Cloud Run revisions that are
pulled into Datadog by using tags.

Only Cloud Run revision resources that apply to specified filters are
imported into Datadog.'
example:
- $KEY:$VALUE
items:
description: Cloud Run Filters
type: string
type: array
host_filters:
description: Your Host Filters.
items:
Expand Down
2 changes: 2 additions & 0 deletions examples/v1/gcp-integration/CreateGCPIntegration.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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) {
Expand All @@ -18,6 +19,7 @@ public static void main(String[] args) {
.clientId("163662907116366290710")
.clientX509CertUrl("https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL")
.hostFilters("key:value,filter:example")
.cloudRunRevisionFilters(Collections.singletonList("dr:dre"))
.isCspmEnabled(true)
.isSecurityCommandCenterEnabled(true)
.privateKey("private_key")
Expand Down
42 changes: 42 additions & 0 deletions examples/v1/gcp-integration/UpdateGCPIntegration_3544259255.java
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 examples/v2/gcp-integration/CreateGCPSTSAccount_194782945.java
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 examples/v2/gcp-integration/UpdateGCPSTSAccount_2241994060.java
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();
}
}
}
40 changes: 40 additions & 0 deletions src/main/java/com/datadog/api/client/v1/model/GCPAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
GCPAccount.JSON_PROPERTY_CLIENT_EMAIL,
GCPAccount.JSON_PROPERTY_CLIENT_ID,
GCPAccount.JSON_PROPERTY_CLIENT_X509_CERT_URL,
GCPAccount.JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS,
GCPAccount.JSON_PROPERTY_ERRORS,
GCPAccount.JSON_PROPERTY_HOST_FILTERS,
GCPAccount.JSON_PROPERTY_IS_CSPM_ENABLED,
Expand Down Expand Up @@ -60,6 +61,10 @@ public class GCPAccount {
public static final String JSON_PROPERTY_CLIENT_X509_CERT_URL = "client_x509_cert_url";
private String clientX509CertUrl;

public static final String JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS =
"cloud_run_revision_filters";
private List<String> cloudRunRevisionFilters = null;

public static final String JSON_PROPERTY_ERRORS = "errors";
private List<String> errors = null;

Expand Down Expand Up @@ -219,6 +224,36 @@ public void setClientX509CertUrl(String clientX509CertUrl) {
this.clientX509CertUrl = clientX509CertUrl;
}

public GCPAccount cloudRunRevisionFilters(List<String> cloudRunRevisionFilters) {
this.cloudRunRevisionFilters = cloudRunRevisionFilters;
return this;
}

public GCPAccount addCloudRunRevisionFiltersItem(String cloudRunRevisionFiltersItem) {
if (this.cloudRunRevisionFilters == null) {
this.cloudRunRevisionFilters = new ArrayList<>();
}
this.cloudRunRevisionFilters.add(cloudRunRevisionFiltersItem);
return this;
}

/**
* Limit the Cloud Run revisions that are pulled into Datadog by using tags. Only Cloud Run
* revision resources that apply to specified filters are imported into Datadog.
*
* @return cloudRunRevisionFilters
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<String> getCloudRunRevisionFilters() {
return cloudRunRevisionFilters;
}

public void setCloudRunRevisionFilters(List<String> cloudRunRevisionFilters) {
this.cloudRunRevisionFilters = cloudRunRevisionFilters;
}

public GCPAccount errors(List<String> errors) {
this.errors = errors;
return this;
Expand Down Expand Up @@ -502,6 +537,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.clientEmail, gcpAccount.clientEmail)
&& Objects.equals(this.clientId, gcpAccount.clientId)
&& Objects.equals(this.clientX509CertUrl, gcpAccount.clientX509CertUrl)
&& Objects.equals(this.cloudRunRevisionFilters, gcpAccount.cloudRunRevisionFilters)
&& Objects.equals(this.errors, gcpAccount.errors)
&& Objects.equals(this.hostFilters, gcpAccount.hostFilters)
&& Objects.equals(this.isCspmEnabled, gcpAccount.isCspmEnabled)
Expand All @@ -525,6 +561,7 @@ public int hashCode() {
clientEmail,
clientId,
clientX509CertUrl,
cloudRunRevisionFilters,
errors,
hostFilters,
isCspmEnabled,
Expand All @@ -550,6 +587,9 @@ public String toString() {
sb.append(" clientEmail: ").append(toIndentedString(clientEmail)).append("\n");
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
sb.append(" clientX509CertUrl: ").append(toIndentedString(clientX509CertUrl)).append("\n");
sb.append(" cloudRunRevisionFilters: ")
.append(toIndentedString(cloudRunRevisionFilters))
.append("\n");
sb.append(" errors: ").append(toIndentedString(errors)).append("\n");
sb.append(" hostFilters: ").append(toIndentedString(hostFilters)).append("\n");
sb.append(" isCspmEnabled: ").append(toIndentedString(isCspmEnabled)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
GCPSTSServiceAccountAttributes.JSON_PROPERTY_ACCOUNT_TAGS,
GCPSTSServiceAccountAttributes.JSON_PROPERTY_AUTOMUTE,
GCPSTSServiceAccountAttributes.JSON_PROPERTY_CLIENT_EMAIL,
GCPSTSServiceAccountAttributes.JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS,
GCPSTSServiceAccountAttributes.JSON_PROPERTY_HOST_FILTERS,
GCPSTSServiceAccountAttributes.JSON_PROPERTY_IS_CSPM_ENABLED,
GCPSTSServiceAccountAttributes.JSON_PROPERTY_IS_SECURITY_COMMAND_CENTER_ENABLED,
Expand All @@ -41,6 +42,10 @@ public class GCPSTSServiceAccountAttributes {
public static final String JSON_PROPERTY_CLIENT_EMAIL = "client_email";
private String clientEmail;

public static final String JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS =
"cloud_run_revision_filters";
private List<String> cloudRunRevisionFilters = null;

public static final String JSON_PROPERTY_HOST_FILTERS = "host_filters";
private List<String> hostFilters = null;

Expand Down Expand Up @@ -126,6 +131,38 @@ public void setClientEmail(String clientEmail) {
this.clientEmail = clientEmail;
}

public GCPSTSServiceAccountAttributes cloudRunRevisionFilters(
List<String> cloudRunRevisionFilters) {
this.cloudRunRevisionFilters = cloudRunRevisionFilters;
return this;
}

public GCPSTSServiceAccountAttributes addCloudRunRevisionFiltersItem(
String cloudRunRevisionFiltersItem) {
if (this.cloudRunRevisionFilters == null) {
this.cloudRunRevisionFilters = new ArrayList<>();
}
this.cloudRunRevisionFilters.add(cloudRunRevisionFiltersItem);
return this;
}

/**
* List of filters to limit the Cloud Run revisions that are pulled into Datadog by using tags.
* Only Cloud Run revision resources that apply to specified filters are imported into Datadog.
*
* @return cloudRunRevisionFilters
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<String> getCloudRunRevisionFilters() {
return cloudRunRevisionFilters;
}

public void setCloudRunRevisionFilters(List<String> cloudRunRevisionFilters) {
this.cloudRunRevisionFilters = cloudRunRevisionFilters;
}

public GCPSTSServiceAccountAttributes hostFilters(List<String> hostFilters) {
this.hostFilters = hostFilters;
return this;
Expand Down Expand Up @@ -282,6 +319,8 @@ public boolean equals(Object o) {
return Objects.equals(this.accountTags, gcpstsServiceAccountAttributes.accountTags)
&& Objects.equals(this.automute, gcpstsServiceAccountAttributes.automute)
&& Objects.equals(this.clientEmail, gcpstsServiceAccountAttributes.clientEmail)
&& Objects.equals(
this.cloudRunRevisionFilters, gcpstsServiceAccountAttributes.cloudRunRevisionFilters)
&& Objects.equals(this.hostFilters, gcpstsServiceAccountAttributes.hostFilters)
&& Objects.equals(this.isCspmEnabled, gcpstsServiceAccountAttributes.isCspmEnabled)
&& Objects.equals(
Expand All @@ -300,6 +339,7 @@ public int hashCode() {
accountTags,
automute,
clientEmail,
cloudRunRevisionFilters,
hostFilters,
isCspmEnabled,
isSecurityCommandCenterEnabled,
Expand All @@ -314,6 +354,9 @@ public String toString() {
sb.append(" accountTags: ").append(toIndentedString(accountTags)).append("\n");
sb.append(" automute: ").append(toIndentedString(automute)).append("\n");
sb.append(" clientEmail: ").append(toIndentedString(clientEmail)).append("\n");
sb.append(" cloudRunRevisionFilters: ")
.append(toIndentedString(cloudRunRevisionFilters))
.append("\n");
sb.append(" hostFilters: ").append(toIndentedString(hostFilters)).append("\n");
sb.append(" isCspmEnabled: ").append(toIndentedString(isCspmEnabled)).append("\n");
sb.append(" isSecurityCommandCenterEnabled: ")
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-12-20T13:18:07.717Z
2024-01-31T21:16:03.254Z
Loading

0 comments on commit 46dab3c

Please sign in to comment.