From 3d1dfac8919b91547e9f67bd3c4e41bbe60c6977 Mon Sep 17 00:00:00 2001 From: dpebot Date: Tue, 16 Oct 2018 00:36:59 -0700 Subject: [PATCH] Re-generate library using google-cloud-clients/google-cloud-dlp/synth.py --- .../v2/OrganizationStoredInfoTypeName.java | 189 +++++++++ .../dlp/v2/ProjectStoredInfoTypeName.java | 189 +++++++++ .../privacy/dlp/v2/StoredInfoTypeName.java | 23 ++ .../privacy/dlp/v2/StoredInfoTypeNames.java | 33 ++ .../dlp/v2/UntypedStoredInfoTypeName.java | 103 +++++ .../google/cloud/dlp/v2/DlpServiceClient.java | 365 ++++++++++++++++++ .../cloud/dlp/v2/DlpServiceSettings.java | 69 ++++ .../cloud/dlp/v2/stub/DlpServiceStub.java | 34 ++ .../dlp/v2/stub/DlpServiceStubSettings.java | 215 ++++++++++- .../cloud/dlp/v2/stub/GrpcDlpServiceStub.java | 143 +++++++ .../cloud/dlp/v2/MockDlpServiceImpl.java | 83 ++++ 11 files changed, 1438 insertions(+), 8 deletions(-) create mode 100644 google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationStoredInfoTypeName.java create mode 100644 google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectStoredInfoTypeName.java create mode 100644 google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java create mode 100644 google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeNames.java create mode 100644 google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/UntypedStoredInfoTypeName.java diff --git a/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationStoredInfoTypeName.java b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationStoredInfoTypeName.java new file mode 100644 index 000000000000..eebc4e15733e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationStoredInfoTypeName.java @@ -0,0 +1,189 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.privacy.dlp.v2; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import java.util.Map; +import java.util.ArrayList; +import java.util.List; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class OrganizationStoredInfoTypeName extends StoredInfoTypeName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("organizations/{organization}/storedInfoTypes/{stored_info_type}"); + + private volatile Map fieldValuesMap; + + private final String organization; + private final String storedInfoType; + + public String getOrganization() { + return organization; + } + + public String getStoredInfoType() { + return storedInfoType; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private OrganizationStoredInfoTypeName(Builder builder) { + organization = Preconditions.checkNotNull(builder.getOrganization()); + storedInfoType = Preconditions.checkNotNull(builder.getStoredInfoType()); + } + + public static OrganizationStoredInfoTypeName of(String organization, String storedInfoType) { + return newBuilder() + .setOrganization(organization) + .setStoredInfoType(storedInfoType) + .build(); + } + + public static String format(String organization, String storedInfoType) { + return newBuilder() + .setOrganization(organization) + .setStoredInfoType(storedInfoType) + .build() + .toString(); + } + + public static OrganizationStoredInfoTypeName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch(formattedString, "OrganizationStoredInfoTypeName.parse: formattedString not in valid format"); + return of(matchMap.get("organization"), matchMap.get("stored_info_type")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (OrganizationStoredInfoTypeName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("organization", organization); + fieldMapBuilder.put("storedInfoType", storedInfoType); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("organization", organization, "stored_info_type", storedInfoType); + } + + /** Builder for OrganizationStoredInfoTypeName. */ + public static class Builder { + + private String organization; + private String storedInfoType; + + public String getOrganization() { + return organization; + } + + public String getStoredInfoType() { + return storedInfoType; + } + + public Builder setOrganization(String organization) { + this.organization = organization; + return this; + } + + public Builder setStoredInfoType(String storedInfoType) { + this.storedInfoType = storedInfoType; + return this; + } + + private Builder() { + } + + private Builder(OrganizationStoredInfoTypeName organizationStoredInfoTypeName) { + organization = organizationStoredInfoTypeName.organization; + storedInfoType = organizationStoredInfoTypeName.storedInfoType; + } + + public OrganizationStoredInfoTypeName build() { + return new OrganizationStoredInfoTypeName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof OrganizationStoredInfoTypeName) { + OrganizationStoredInfoTypeName that = (OrganizationStoredInfoTypeName) o; + return (this.organization.equals(that.organization)) + && (this.storedInfoType.equals(that.storedInfoType)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= organization.hashCode(); + h *= 1000003; + h ^= storedInfoType.hashCode(); + return h; + } +} + diff --git a/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectStoredInfoTypeName.java b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectStoredInfoTypeName.java new file mode 100644 index 000000000000..43e95e33a6bc --- /dev/null +++ b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectStoredInfoTypeName.java @@ -0,0 +1,189 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.privacy.dlp.v2; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import java.util.Map; +import java.util.ArrayList; +import java.util.List; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class ProjectStoredInfoTypeName extends StoredInfoTypeName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/storedInfoTypes/{stored_info_type}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String storedInfoType; + + public String getProject() { + return project; + } + + public String getStoredInfoType() { + return storedInfoType; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ProjectStoredInfoTypeName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + storedInfoType = Preconditions.checkNotNull(builder.getStoredInfoType()); + } + + public static ProjectStoredInfoTypeName of(String project, String storedInfoType) { + return newBuilder() + .setProject(project) + .setStoredInfoType(storedInfoType) + .build(); + } + + public static String format(String project, String storedInfoType) { + return newBuilder() + .setProject(project) + .setStoredInfoType(storedInfoType) + .build() + .toString(); + } + + public static ProjectStoredInfoTypeName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch(formattedString, "ProjectStoredInfoTypeName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("stored_info_type")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (ProjectStoredInfoTypeName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("storedInfoType", storedInfoType); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project, "stored_info_type", storedInfoType); + } + + /** Builder for ProjectStoredInfoTypeName. */ + public static class Builder { + + private String project; + private String storedInfoType; + + public String getProject() { + return project; + } + + public String getStoredInfoType() { + return storedInfoType; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setStoredInfoType(String storedInfoType) { + this.storedInfoType = storedInfoType; + return this; + } + + private Builder() { + } + + private Builder(ProjectStoredInfoTypeName projectStoredInfoTypeName) { + project = projectStoredInfoTypeName.project; + storedInfoType = projectStoredInfoTypeName.storedInfoType; + } + + public ProjectStoredInfoTypeName build() { + return new ProjectStoredInfoTypeName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ProjectStoredInfoTypeName) { + ProjectStoredInfoTypeName that = (ProjectStoredInfoTypeName) o; + return (this.project.equals(that.project)) + && (this.storedInfoType.equals(that.storedInfoType)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= storedInfoType.hashCode(); + return h; + } +} + diff --git a/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java new file mode 100644 index 000000000000..dd5894ac6cfc --- /dev/null +++ b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.privacy.dlp.v2; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class StoredInfoTypeName implements ResourceName { + protected StoredInfoTypeName() {} +} diff --git a/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeNames.java b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeNames.java new file mode 100644 index 000000000000..57f1bd5b2e53 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.privacy.dlp.v2; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class StoredInfoTypeNames { + private StoredInfoTypeNames() {} + + public static StoredInfoTypeName parse(String resourceNameString) { + if (OrganizationStoredInfoTypeName.isParsableFrom(resourceNameString)) { + return OrganizationStoredInfoTypeName.parse(resourceNameString); + } + if (ProjectStoredInfoTypeName.isParsableFrom(resourceNameString)) { + return ProjectStoredInfoTypeName.parse(resourceNameString); + } + return UntypedStoredInfoTypeName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/UntypedStoredInfoTypeName.java b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/UntypedStoredInfoTypeName.java new file mode 100644 index 000000000000..8ca083308e61 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/UntypedStoredInfoTypeName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.privacy.dlp.v2; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedStoredInfoTypeName extends StoredInfoTypeName { + + private final String rawValue; + private Map valueMap; + + private UntypedStoredInfoTypeName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedStoredInfoTypeName from(ResourceName resourceName) { + return new UntypedStoredInfoTypeName(resourceName.toString()); + } + + public static UntypedStoredInfoTypeName parse(String formattedString) { + return new UntypedStoredInfoTypeName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedStoredInfoTypeName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedStoredInfoTypeName) { + UntypedStoredInfoTypeName that = (UntypedStoredInfoTypeName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java index 78a1178c08c2..0cd61eac61fe 100644 --- a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java +++ b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java @@ -32,6 +32,7 @@ import com.google.privacy.dlp.v2.CreateDlpJobRequest; import com.google.privacy.dlp.v2.CreateInspectTemplateRequest; import com.google.privacy.dlp.v2.CreateJobTriggerRequest; +import com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DeidentifyContentRequest; import com.google.privacy.dlp.v2.DeidentifyContentResponse; import com.google.privacy.dlp.v2.DeidentifyTemplate; @@ -39,11 +40,13 @@ import com.google.privacy.dlp.v2.DeleteDlpJobRequest; import com.google.privacy.dlp.v2.DeleteInspectTemplateRequest; import com.google.privacy.dlp.v2.DeleteJobTriggerRequest; +import com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DlpJob; import com.google.privacy.dlp.v2.GetDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.GetDlpJobRequest; import com.google.privacy.dlp.v2.GetInspectTemplateRequest; import com.google.privacy.dlp.v2.GetJobTriggerRequest; +import com.google.privacy.dlp.v2.GetStoredInfoTypeRequest; import com.google.privacy.dlp.v2.InspectContentRequest; import com.google.privacy.dlp.v2.InspectContentResponse; import com.google.privacy.dlp.v2.InspectTemplate; @@ -58,13 +61,17 @@ import com.google.privacy.dlp.v2.ListInspectTemplatesResponse; import com.google.privacy.dlp.v2.ListJobTriggersRequest; import com.google.privacy.dlp.v2.ListJobTriggersResponse; +import com.google.privacy.dlp.v2.ListStoredInfoTypesRequest; +import com.google.privacy.dlp.v2.ListStoredInfoTypesResponse; import com.google.privacy.dlp.v2.RedactImageRequest; import com.google.privacy.dlp.v2.RedactImageResponse; import com.google.privacy.dlp.v2.ReidentifyContentRequest; import com.google.privacy.dlp.v2.ReidentifyContentResponse; +import com.google.privacy.dlp.v2.StoredInfoType; import com.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.UpdateInspectTemplateRequest; import com.google.privacy.dlp.v2.UpdateJobTriggerRequest; +import com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -1579,6 +1586,284 @@ public final UnaryCallable createJobTrigger return stub.createJobTriggerCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a pre-built stored infoType to be used for inspection. See + * https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   CreateStoredInfoTypeRequest request = CreateStoredInfoTypeRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   StoredInfoType response = dlpServiceClient.createStoredInfoType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final StoredInfoType createStoredInfoType(CreateStoredInfoTypeRequest request) { + return createStoredInfoTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a pre-built stored infoType to be used for inspection. See + * https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   CreateStoredInfoTypeRequest request = CreateStoredInfoTypeRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<StoredInfoType> future = dlpServiceClient.createStoredInfoTypeCallable().futureCall(request);
+   *   // Do something
+   *   StoredInfoType response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + createStoredInfoTypeCallable() { + return stub.createStoredInfoTypeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the stored infoType by creating a new version. The existing version will continue to be + * used until the new version is ready. See + * https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   StoredInfoTypeName name = OrganizationStoredInfoTypeName.of("[ORGANIZATION]", "[STORED_INFO_TYPE]");
+   *   UpdateStoredInfoTypeRequest request = UpdateStoredInfoTypeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   StoredInfoType response = dlpServiceClient.updateStoredInfoType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final StoredInfoType updateStoredInfoType(UpdateStoredInfoTypeRequest request) { + return updateStoredInfoTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the stored infoType by creating a new version. The existing version will continue to be + * used until the new version is ready. See + * https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   StoredInfoTypeName name = OrganizationStoredInfoTypeName.of("[ORGANIZATION]", "[STORED_INFO_TYPE]");
+   *   UpdateStoredInfoTypeRequest request = UpdateStoredInfoTypeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<StoredInfoType> future = dlpServiceClient.updateStoredInfoTypeCallable().futureCall(request);
+   *   // Do something
+   *   StoredInfoType response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + updateStoredInfoTypeCallable() { + return stub.updateStoredInfoTypeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   StoredInfoTypeName name = OrganizationStoredInfoTypeName.of("[ORGANIZATION]", "[STORED_INFO_TYPE]");
+   *   GetStoredInfoTypeRequest request = GetStoredInfoTypeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   StoredInfoType response = dlpServiceClient.getStoredInfoType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final StoredInfoType getStoredInfoType(GetStoredInfoTypeRequest request) { + return getStoredInfoTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   StoredInfoTypeName name = OrganizationStoredInfoTypeName.of("[ORGANIZATION]", "[STORED_INFO_TYPE]");
+   *   GetStoredInfoTypeRequest request = GetStoredInfoTypeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<StoredInfoType> future = dlpServiceClient.getStoredInfoTypeCallable().futureCall(request);
+   *   // Do something
+   *   StoredInfoType response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getStoredInfoTypeCallable() { + return stub.getStoredInfoTypeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists stored infoTypes. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   ListStoredInfoTypesRequest request = ListStoredInfoTypesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (StoredInfoType element : dlpServiceClient.listStoredInfoTypes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListStoredInfoTypesPagedResponse listStoredInfoTypes( + ListStoredInfoTypesRequest request) { + return listStoredInfoTypesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists stored infoTypes. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   ListStoredInfoTypesRequest request = ListStoredInfoTypesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListStoredInfoTypesPagedResponse> future = dlpServiceClient.listStoredInfoTypesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (StoredInfoType element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listStoredInfoTypesPagedCallable() { + return stub.listStoredInfoTypesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists stored infoTypes. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   ListStoredInfoTypesRequest request = ListStoredInfoTypesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListStoredInfoTypesResponse response = dlpServiceClient.listStoredInfoTypesCallable().call(request);
+   *     for (StoredInfoType element : response.getStoredInfoTypesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listStoredInfoTypesCallable() { + return stub.listStoredInfoTypesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   StoredInfoTypeName name = OrganizationStoredInfoTypeName.of("[ORGANIZATION]", "[STORED_INFO_TYPE]");
+   *   DeleteStoredInfoTypeRequest request = DeleteStoredInfoTypeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   dlpServiceClient.deleteStoredInfoType(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteStoredInfoType(DeleteStoredInfoTypeRequest request) { + deleteStoredInfoTypeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + * learn more. + * + *

Sample code: + * + *


+   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
+   *   StoredInfoTypeName name = OrganizationStoredInfoTypeName.of("[ORGANIZATION]", "[STORED_INFO_TYPE]");
+   *   DeleteStoredInfoTypeRequest request = DeleteStoredInfoTypeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = dlpServiceClient.deleteStoredInfoTypeCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteStoredInfoTypeCallable() { + return stub.deleteStoredInfoTypeCallable(); + } + @Override public final void close() { stub.close(); @@ -1920,4 +2205,84 @@ protected ListJobTriggersFixedSizeCollection createCollection( return new ListJobTriggersFixedSizeCollection(pages, collectionSize); } } + + public static class ListStoredInfoTypesPagedResponse + extends AbstractPagedListResponse< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType, + ListStoredInfoTypesPage, ListStoredInfoTypesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListStoredInfoTypesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListStoredInfoTypesPagedResponse apply(ListStoredInfoTypesPage input) { + return new ListStoredInfoTypesPagedResponse(input); + } + }); + } + + private ListStoredInfoTypesPagedResponse(ListStoredInfoTypesPage page) { + super(page, ListStoredInfoTypesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListStoredInfoTypesPage + extends AbstractPage< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType, + ListStoredInfoTypesPage> { + + private ListStoredInfoTypesPage( + PageContext + context, + ListStoredInfoTypesResponse response) { + super(context, response); + } + + private static ListStoredInfoTypesPage createEmptyPage() { + return new ListStoredInfoTypesPage(null, null); + } + + @Override + protected ListStoredInfoTypesPage createPage( + PageContext + context, + ListStoredInfoTypesResponse response) { + return new ListStoredInfoTypesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListStoredInfoTypesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType, + ListStoredInfoTypesPage, ListStoredInfoTypesFixedSizeCollection> { + + private ListStoredInfoTypesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListStoredInfoTypesFixedSizeCollection createEmptyCollection() { + return new ListStoredInfoTypesFixedSizeCollection(null, 0); + } + + @Override + protected ListStoredInfoTypesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListStoredInfoTypesFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java index a463d80fe5cb..e2c046539308 100644 --- a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java +++ b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java @@ -19,6 +19,7 @@ import static com.google.cloud.dlp.v2.DlpServiceClient.ListDlpJobsPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListInspectTemplatesPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse; +import static com.google.cloud.dlp.v2.DlpServiceClient.ListStoredInfoTypesPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -37,6 +38,7 @@ import com.google.privacy.dlp.v2.CreateDlpJobRequest; import com.google.privacy.dlp.v2.CreateInspectTemplateRequest; import com.google.privacy.dlp.v2.CreateJobTriggerRequest; +import com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DeidentifyContentRequest; import com.google.privacy.dlp.v2.DeidentifyContentResponse; import com.google.privacy.dlp.v2.DeidentifyTemplate; @@ -44,11 +46,13 @@ import com.google.privacy.dlp.v2.DeleteDlpJobRequest; import com.google.privacy.dlp.v2.DeleteInspectTemplateRequest; import com.google.privacy.dlp.v2.DeleteJobTriggerRequest; +import com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DlpJob; import com.google.privacy.dlp.v2.GetDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.GetDlpJobRequest; import com.google.privacy.dlp.v2.GetInspectTemplateRequest; import com.google.privacy.dlp.v2.GetJobTriggerRequest; +import com.google.privacy.dlp.v2.GetStoredInfoTypeRequest; import com.google.privacy.dlp.v2.InspectContentRequest; import com.google.privacy.dlp.v2.InspectContentResponse; import com.google.privacy.dlp.v2.InspectTemplate; @@ -63,13 +67,17 @@ import com.google.privacy.dlp.v2.ListInspectTemplatesResponse; import com.google.privacy.dlp.v2.ListJobTriggersRequest; import com.google.privacy.dlp.v2.ListJobTriggersResponse; +import com.google.privacy.dlp.v2.ListStoredInfoTypesRequest; +import com.google.privacy.dlp.v2.ListStoredInfoTypesResponse; import com.google.privacy.dlp.v2.RedactImageRequest; import com.google.privacy.dlp.v2.RedactImageResponse; import com.google.privacy.dlp.v2.ReidentifyContentRequest; import com.google.privacy.dlp.v2.ReidentifyContentResponse; +import com.google.privacy.dlp.v2.StoredInfoType; import com.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.UpdateInspectTemplateRequest; import com.google.privacy.dlp.v2.UpdateJobTriggerRequest; +import com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -247,6 +255,35 @@ public UnaryCallSettings createJobTriggerSe return ((DlpServiceStubSettings) getStubSettings()).createJobTriggerSettings(); } + /** Returns the object with the settings used for calls to createStoredInfoType. */ + public UnaryCallSettings + createStoredInfoTypeSettings() { + return ((DlpServiceStubSettings) getStubSettings()).createStoredInfoTypeSettings(); + } + + /** Returns the object with the settings used for calls to updateStoredInfoType. */ + public UnaryCallSettings + updateStoredInfoTypeSettings() { + return ((DlpServiceStubSettings) getStubSettings()).updateStoredInfoTypeSettings(); + } + + /** Returns the object with the settings used for calls to getStoredInfoType. */ + public UnaryCallSettings getStoredInfoTypeSettings() { + return ((DlpServiceStubSettings) getStubSettings()).getStoredInfoTypeSettings(); + } + + /** Returns the object with the settings used for calls to listStoredInfoTypes. */ + public PagedCallSettings< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, ListStoredInfoTypesPagedResponse> + listStoredInfoTypesSettings() { + return ((DlpServiceStubSettings) getStubSettings()).listStoredInfoTypesSettings(); + } + + /** Returns the object with the settings used for calls to deleteStoredInfoType. */ + public UnaryCallSettings deleteStoredInfoTypeSettings() { + return ((DlpServiceStubSettings) getStubSettings()).deleteStoredInfoTypeSettings(); + } + public static final DlpServiceSettings create(DlpServiceStubSettings stub) throws IOException { return new DlpServiceSettings.Builder(stub.toBuilder()).build(); } @@ -493,6 +530,38 @@ public UnaryCallSettings.Builder deleteJobTrigge return getStubSettingsBuilder().createJobTriggerSettings(); } + /** Returns the builder for the settings used for calls to createStoredInfoType. */ + public UnaryCallSettings.Builder + createStoredInfoTypeSettings() { + return getStubSettingsBuilder().createStoredInfoTypeSettings(); + } + + /** Returns the builder for the settings used for calls to updateStoredInfoType. */ + public UnaryCallSettings.Builder + updateStoredInfoTypeSettings() { + return getStubSettingsBuilder().updateStoredInfoTypeSettings(); + } + + /** Returns the builder for the settings used for calls to getStoredInfoType. */ + public UnaryCallSettings.Builder + getStoredInfoTypeSettings() { + return getStubSettingsBuilder().getStoredInfoTypeSettings(); + } + + /** Returns the builder for the settings used for calls to listStoredInfoTypes. */ + public PagedCallSettings.Builder< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, + ListStoredInfoTypesPagedResponse> + listStoredInfoTypesSettings() { + return getStubSettingsBuilder().listStoredInfoTypesSettings(); + } + + /** Returns the builder for the settings used for calls to deleteStoredInfoType. */ + public UnaryCallSettings.Builder + deleteStoredInfoTypeSettings() { + return getStubSettingsBuilder().deleteStoredInfoTypeSettings(); + } + @Override public DlpServiceSettings build() throws IOException { return new DlpServiceSettings(this); diff --git a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java index 2a53d2ee51ba..f43f49d35d16 100644 --- a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java +++ b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java @@ -19,6 +19,7 @@ import static com.google.cloud.dlp.v2.DlpServiceClient.ListDlpJobsPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListInspectTemplatesPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse; +import static com.google.cloud.dlp.v2.DlpServiceClient.ListStoredInfoTypesPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -28,6 +29,7 @@ import com.google.privacy.dlp.v2.CreateDlpJobRequest; import com.google.privacy.dlp.v2.CreateInspectTemplateRequest; import com.google.privacy.dlp.v2.CreateJobTriggerRequest; +import com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DeidentifyContentRequest; import com.google.privacy.dlp.v2.DeidentifyContentResponse; import com.google.privacy.dlp.v2.DeidentifyTemplate; @@ -35,11 +37,13 @@ import com.google.privacy.dlp.v2.DeleteDlpJobRequest; import com.google.privacy.dlp.v2.DeleteInspectTemplateRequest; import com.google.privacy.dlp.v2.DeleteJobTriggerRequest; +import com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DlpJob; import com.google.privacy.dlp.v2.GetDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.GetDlpJobRequest; import com.google.privacy.dlp.v2.GetInspectTemplateRequest; import com.google.privacy.dlp.v2.GetJobTriggerRequest; +import com.google.privacy.dlp.v2.GetStoredInfoTypeRequest; import com.google.privacy.dlp.v2.InspectContentRequest; import com.google.privacy.dlp.v2.InspectContentResponse; import com.google.privacy.dlp.v2.InspectTemplate; @@ -54,13 +58,17 @@ import com.google.privacy.dlp.v2.ListInspectTemplatesResponse; import com.google.privacy.dlp.v2.ListJobTriggersRequest; import com.google.privacy.dlp.v2.ListJobTriggersResponse; +import com.google.privacy.dlp.v2.ListStoredInfoTypesRequest; +import com.google.privacy.dlp.v2.ListStoredInfoTypesResponse; import com.google.privacy.dlp.v2.RedactImageRequest; import com.google.privacy.dlp.v2.RedactImageResponse; import com.google.privacy.dlp.v2.ReidentifyContentRequest; import com.google.privacy.dlp.v2.ReidentifyContentResponse; +import com.google.privacy.dlp.v2.StoredInfoType; import com.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.UpdateInspectTemplateRequest; import com.google.privacy.dlp.v2.UpdateJobTriggerRequest; +import com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -203,6 +211,32 @@ public UnaryCallable createJobTriggerCallab throw new UnsupportedOperationException("Not implemented: createJobTriggerCallable()"); } + public UnaryCallable createStoredInfoTypeCallable() { + throw new UnsupportedOperationException("Not implemented: createStoredInfoTypeCallable()"); + } + + public UnaryCallable updateStoredInfoTypeCallable() { + throw new UnsupportedOperationException("Not implemented: updateStoredInfoTypeCallable()"); + } + + public UnaryCallable getStoredInfoTypeCallable() { + throw new UnsupportedOperationException("Not implemented: getStoredInfoTypeCallable()"); + } + + public UnaryCallable + listStoredInfoTypesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listStoredInfoTypesPagedCallable()"); + } + + public UnaryCallable + listStoredInfoTypesCallable() { + throw new UnsupportedOperationException("Not implemented: listStoredInfoTypesCallable()"); + } + + public UnaryCallable deleteStoredInfoTypeCallable() { + throw new UnsupportedOperationException("Not implemented: deleteStoredInfoTypeCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java index 45b90d837911..e8cafcd8c575 100644 --- a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java +++ b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java @@ -19,6 +19,7 @@ import static com.google.cloud.dlp.v2.DlpServiceClient.ListDlpJobsPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListInspectTemplatesPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse; +import static com.google.cloud.dlp.v2.DlpServiceClient.ListStoredInfoTypesPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -51,6 +52,7 @@ import com.google.privacy.dlp.v2.CreateDlpJobRequest; import com.google.privacy.dlp.v2.CreateInspectTemplateRequest; import com.google.privacy.dlp.v2.CreateJobTriggerRequest; +import com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DeidentifyContentRequest; import com.google.privacy.dlp.v2.DeidentifyContentResponse; import com.google.privacy.dlp.v2.DeidentifyTemplate; @@ -58,11 +60,13 @@ import com.google.privacy.dlp.v2.DeleteDlpJobRequest; import com.google.privacy.dlp.v2.DeleteInspectTemplateRequest; import com.google.privacy.dlp.v2.DeleteJobTriggerRequest; +import com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DlpJob; import com.google.privacy.dlp.v2.GetDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.GetDlpJobRequest; import com.google.privacy.dlp.v2.GetInspectTemplateRequest; import com.google.privacy.dlp.v2.GetJobTriggerRequest; +import com.google.privacy.dlp.v2.GetStoredInfoTypeRequest; import com.google.privacy.dlp.v2.InspectContentRequest; import com.google.privacy.dlp.v2.InspectContentResponse; import com.google.privacy.dlp.v2.InspectTemplate; @@ -77,13 +81,17 @@ import com.google.privacy.dlp.v2.ListInspectTemplatesResponse; import com.google.privacy.dlp.v2.ListJobTriggersRequest; import com.google.privacy.dlp.v2.ListJobTriggersResponse; +import com.google.privacy.dlp.v2.ListStoredInfoTypesRequest; +import com.google.privacy.dlp.v2.ListStoredInfoTypesResponse; import com.google.privacy.dlp.v2.RedactImageRequest; import com.google.privacy.dlp.v2.RedactImageResponse; import com.google.privacy.dlp.v2.ReidentifyContentRequest; import com.google.privacy.dlp.v2.ReidentifyContentResponse; +import com.google.privacy.dlp.v2.StoredInfoType; import com.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.UpdateInspectTemplateRequest; import com.google.privacy.dlp.v2.UpdateJobTriggerRequest; +import com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -169,6 +177,16 @@ public class DlpServiceStubSettings extends StubSettings private final UnaryCallSettings deleteJobTriggerSettings; private final UnaryCallSettings updateJobTriggerSettings; private final UnaryCallSettings createJobTriggerSettings; + private final UnaryCallSettings + createStoredInfoTypeSettings; + private final UnaryCallSettings + updateStoredInfoTypeSettings; + private final UnaryCallSettings + getStoredInfoTypeSettings; + private final PagedCallSettings< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, ListStoredInfoTypesPagedResponse> + listStoredInfoTypesSettings; + private final UnaryCallSettings deleteStoredInfoTypeSettings; /** Returns the object with the settings used for calls to inspectContent. */ public UnaryCallSettings inspectContentSettings() { @@ -313,6 +331,35 @@ public UnaryCallSettings createJobTriggerSe return createJobTriggerSettings; } + /** Returns the object with the settings used for calls to createStoredInfoType. */ + public UnaryCallSettings + createStoredInfoTypeSettings() { + return createStoredInfoTypeSettings; + } + + /** Returns the object with the settings used for calls to updateStoredInfoType. */ + public UnaryCallSettings + updateStoredInfoTypeSettings() { + return updateStoredInfoTypeSettings; + } + + /** Returns the object with the settings used for calls to getStoredInfoType. */ + public UnaryCallSettings getStoredInfoTypeSettings() { + return getStoredInfoTypeSettings; + } + + /** Returns the object with the settings used for calls to listStoredInfoTypes. */ + public PagedCallSettings< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, ListStoredInfoTypesPagedResponse> + listStoredInfoTypesSettings() { + return listStoredInfoTypesSettings; + } + + /** Returns the object with the settings used for calls to deleteStoredInfoType. */ + public UnaryCallSettings deleteStoredInfoTypeSettings() { + return deleteStoredInfoTypeSettings; + } + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public DlpServiceStub createStub() throws IOException { if (getTransportChannelProvider() @@ -406,6 +453,11 @@ protected DlpServiceStubSettings(Builder settingsBuilder) throws IOException { deleteJobTriggerSettings = settingsBuilder.deleteJobTriggerSettings().build(); updateJobTriggerSettings = settingsBuilder.updateJobTriggerSettings().build(); createJobTriggerSettings = settingsBuilder.createJobTriggerSettings().build(); + createStoredInfoTypeSettings = settingsBuilder.createStoredInfoTypeSettings().build(); + updateStoredInfoTypeSettings = settingsBuilder.updateStoredInfoTypeSettings().build(); + getStoredInfoTypeSettings = settingsBuilder.getStoredInfoTypeSettings().build(); + listStoredInfoTypesSettings = settingsBuilder.listStoredInfoTypesSettings().build(); + deleteStoredInfoTypeSettings = settingsBuilder.deleteStoredInfoTypeSettings().build(); } private static final PagedListDescriptor< @@ -560,6 +612,44 @@ public Iterable extractResources(ListJobTriggersResponse payload) { } }; + private static final PagedListDescriptor< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType> + LIST_STORED_INFO_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListStoredInfoTypesRequest injectToken( + ListStoredInfoTypesRequest payload, String token) { + return ListStoredInfoTypesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListStoredInfoTypesRequest injectPageSize( + ListStoredInfoTypesRequest payload, int pageSize) { + return ListStoredInfoTypesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListStoredInfoTypesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListStoredInfoTypesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListStoredInfoTypesResponse payload) { + return payload.getStoredInfoTypesList(); + } + }; + private static final PagedListResponseFactory< ListInspectTemplatesRequest, ListInspectTemplatesResponse, ListInspectTemplatesPagedResponse> @@ -640,6 +730,26 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, ListStoredInfoTypesPagedResponse> + LIST_STORED_INFO_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, + ListStoredInfoTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListStoredInfoTypesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_STORED_INFO_TYPES_PAGE_STR_DESC, request, context); + return ListStoredInfoTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Builder for DlpServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; @@ -695,6 +805,18 @@ public static class Builder extends StubSettings.Builder createJobTriggerSettings; + private final UnaryCallSettings.Builder + createStoredInfoTypeSettings; + private final UnaryCallSettings.Builder + updateStoredInfoTypeSettings; + private final UnaryCallSettings.Builder + getStoredInfoTypeSettings; + private final PagedCallSettings.Builder< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, + ListStoredInfoTypesPagedResponse> + listStoredInfoTypesSettings; + private final UnaryCallSettings.Builder + deleteStoredInfoTypeSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -707,13 +829,7 @@ public static class Builder extends StubSettings.BuildernewArrayList( StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put( - "http_get", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put("no_retry", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -795,6 +911,17 @@ protected Builder(ClientContext clientContext) { createJobTriggerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createStoredInfoTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateStoredInfoTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getStoredInfoTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listStoredInfoTypesSettings = + PagedCallSettings.newBuilder(LIST_STORED_INFO_TYPES_PAGE_STR_FACT); + + deleteStoredInfoTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + unaryMethodSettingsBuilders = ImmutableList.>of( inspectContentSettings, @@ -821,7 +948,12 @@ protected Builder(ClientContext clientContext) { getJobTriggerSettings, deleteJobTriggerSettings, updateJobTriggerSettings, - createJobTriggerSettings); + createJobTriggerSettings, + createStoredInfoTypeSettings, + updateStoredInfoTypeSettings, + getStoredInfoTypeSettings, + listStoredInfoTypesSettings, + deleteStoredInfoTypeSettings); initDefaults(this); } @@ -962,6 +1094,31 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder + .createStoredInfoTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateStoredInfoTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getStoredInfoTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listStoredInfoTypesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteStoredInfoTypeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + return builder; } @@ -993,6 +1150,11 @@ protected Builder(DlpServiceStubSettings settings) { deleteJobTriggerSettings = settings.deleteJobTriggerSettings.toBuilder(); updateJobTriggerSettings = settings.updateJobTriggerSettings.toBuilder(); createJobTriggerSettings = settings.createJobTriggerSettings.toBuilder(); + createStoredInfoTypeSettings = settings.createStoredInfoTypeSettings.toBuilder(); + updateStoredInfoTypeSettings = settings.updateStoredInfoTypeSettings.toBuilder(); + getStoredInfoTypeSettings = settings.getStoredInfoTypeSettings.toBuilder(); + listStoredInfoTypesSettings = settings.listStoredInfoTypesSettings.toBuilder(); + deleteStoredInfoTypeSettings = settings.deleteStoredInfoTypeSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -1020,7 +1182,12 @@ protected Builder(DlpServiceStubSettings settings) { getJobTriggerSettings, deleteJobTriggerSettings, updateJobTriggerSettings, - createJobTriggerSettings); + createJobTriggerSettings, + createStoredInfoTypeSettings, + updateStoredInfoTypeSettings, + getStoredInfoTypeSettings, + listStoredInfoTypesSettings, + deleteStoredInfoTypeSettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -1189,6 +1356,38 @@ public UnaryCallSettings.Builder deleteJobTrigge return createJobTriggerSettings; } + /** Returns the builder for the settings used for calls to createStoredInfoType. */ + public UnaryCallSettings.Builder + createStoredInfoTypeSettings() { + return createStoredInfoTypeSettings; + } + + /** Returns the builder for the settings used for calls to updateStoredInfoType. */ + public UnaryCallSettings.Builder + updateStoredInfoTypeSettings() { + return updateStoredInfoTypeSettings; + } + + /** Returns the builder for the settings used for calls to getStoredInfoType. */ + public UnaryCallSettings.Builder + getStoredInfoTypeSettings() { + return getStoredInfoTypeSettings; + } + + /** Returns the builder for the settings used for calls to listStoredInfoTypes. */ + public PagedCallSettings.Builder< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, + ListStoredInfoTypesPagedResponse> + listStoredInfoTypesSettings() { + return listStoredInfoTypesSettings; + } + + /** Returns the builder for the settings used for calls to deleteStoredInfoType. */ + public UnaryCallSettings.Builder + deleteStoredInfoTypeSettings() { + return deleteStoredInfoTypeSettings; + } + @Override public DlpServiceStubSettings build() throws IOException { return new DlpServiceStubSettings(this); diff --git a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java index 34ec97200ca6..dbce1d07d25b 100644 --- a/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java +++ b/google-cloud-clients/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java @@ -19,6 +19,7 @@ import static com.google.cloud.dlp.v2.DlpServiceClient.ListDlpJobsPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListInspectTemplatesPagedResponse; import static com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse; +import static com.google.cloud.dlp.v2.DlpServiceClient.ListStoredInfoTypesPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -32,6 +33,7 @@ import com.google.privacy.dlp.v2.CreateDlpJobRequest; import com.google.privacy.dlp.v2.CreateInspectTemplateRequest; import com.google.privacy.dlp.v2.CreateJobTriggerRequest; +import com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DeidentifyContentRequest; import com.google.privacy.dlp.v2.DeidentifyContentResponse; import com.google.privacy.dlp.v2.DeidentifyTemplate; @@ -39,11 +41,13 @@ import com.google.privacy.dlp.v2.DeleteDlpJobRequest; import com.google.privacy.dlp.v2.DeleteInspectTemplateRequest; import com.google.privacy.dlp.v2.DeleteJobTriggerRequest; +import com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DlpJob; import com.google.privacy.dlp.v2.GetDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.GetDlpJobRequest; import com.google.privacy.dlp.v2.GetInspectTemplateRequest; import com.google.privacy.dlp.v2.GetJobTriggerRequest; +import com.google.privacy.dlp.v2.GetStoredInfoTypeRequest; import com.google.privacy.dlp.v2.InspectContentRequest; import com.google.privacy.dlp.v2.InspectContentResponse; import com.google.privacy.dlp.v2.InspectTemplate; @@ -58,13 +62,17 @@ import com.google.privacy.dlp.v2.ListInspectTemplatesResponse; import com.google.privacy.dlp.v2.ListJobTriggersRequest; import com.google.privacy.dlp.v2.ListJobTriggersResponse; +import com.google.privacy.dlp.v2.ListStoredInfoTypesRequest; +import com.google.privacy.dlp.v2.ListStoredInfoTypesResponse; import com.google.privacy.dlp.v2.RedactImageRequest; import com.google.privacy.dlp.v2.RedactImageResponse; import com.google.privacy.dlp.v2.ReidentifyContentRequest; import com.google.privacy.dlp.v2.ReidentifyContentResponse; +import com.google.privacy.dlp.v2.StoredInfoType; import com.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.UpdateInspectTemplateRequest; import com.google.privacy.dlp.v2.UpdateJobTriggerRequest; +import com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -308,6 +316,52 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(CreateJobTriggerRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(JobTrigger.getDefaultInstance())) .build(); + private static final MethodDescriptor + createStoredInfoTypeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.privacy.dlp.v2.DlpService/CreateStoredInfoType") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateStoredInfoTypeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(StoredInfoType.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateStoredInfoTypeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.privacy.dlp.v2.DlpService/UpdateStoredInfoType") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateStoredInfoTypeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(StoredInfoType.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getStoredInfoTypeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.privacy.dlp.v2.DlpService/GetStoredInfoType") + .setRequestMarshaller( + ProtoUtils.marshaller(GetStoredInfoTypeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(StoredInfoType.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listStoredInfoTypesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.privacy.dlp.v2.DlpService/ListStoredInfoTypes") + .setRequestMarshaller( + ProtoUtils.marshaller(ListStoredInfoTypesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListStoredInfoTypesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + deleteStoredInfoTypeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.privacy.dlp.v2.DlpService/DeleteStoredInfoType") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteStoredInfoTypeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); private final BackgroundResource backgroundResources; @@ -356,6 +410,16 @@ public class GrpcDlpServiceStub extends DlpServiceStub { private final UnaryCallable deleteJobTriggerCallable; private final UnaryCallable updateJobTriggerCallable; private final UnaryCallable createJobTriggerCallable; + private final UnaryCallable + createStoredInfoTypeCallable; + private final UnaryCallable + updateStoredInfoTypeCallable; + private final UnaryCallable getStoredInfoTypeCallable; + private final UnaryCallable + listStoredInfoTypesCallable; + private final UnaryCallable + listStoredInfoTypesPagedCallable; + private final UnaryCallable deleteStoredInfoTypeCallable; private final GrpcStubCallableFactory callableFactory; @@ -510,6 +574,29 @@ protected GrpcDlpServiceStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createJobTriggerMethodDescriptor) .build(); + GrpcCallSettings + createStoredInfoTypeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createStoredInfoTypeMethodDescriptor) + .build(); + GrpcCallSettings + updateStoredInfoTypeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateStoredInfoTypeMethodDescriptor) + .build(); + GrpcCallSettings getStoredInfoTypeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getStoredInfoTypeMethodDescriptor) + .build(); + GrpcCallSettings + listStoredInfoTypesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listStoredInfoTypesMethodDescriptor) + .build(); + GrpcCallSettings deleteStoredInfoTypeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteStoredInfoTypeMethodDescriptor) + .build(); this.inspectContentCallable = callableFactory.createUnaryCallable( @@ -626,6 +713,36 @@ protected GrpcDlpServiceStub( this.createJobTriggerCallable = callableFactory.createUnaryCallable( createJobTriggerTransportSettings, settings.createJobTriggerSettings(), clientContext); + this.createStoredInfoTypeCallable = + callableFactory.createUnaryCallable( + createStoredInfoTypeTransportSettings, + settings.createStoredInfoTypeSettings(), + clientContext); + this.updateStoredInfoTypeCallable = + callableFactory.createUnaryCallable( + updateStoredInfoTypeTransportSettings, + settings.updateStoredInfoTypeSettings(), + clientContext); + this.getStoredInfoTypeCallable = + callableFactory.createUnaryCallable( + getStoredInfoTypeTransportSettings, + settings.getStoredInfoTypeSettings(), + clientContext); + this.listStoredInfoTypesCallable = + callableFactory.createUnaryCallable( + listStoredInfoTypesTransportSettings, + settings.listStoredInfoTypesSettings(), + clientContext); + this.listStoredInfoTypesPagedCallable = + callableFactory.createPagedCallable( + listStoredInfoTypesTransportSettings, + settings.listStoredInfoTypesSettings(), + clientContext); + this.deleteStoredInfoTypeCallable = + callableFactory.createUnaryCallable( + deleteStoredInfoTypeTransportSettings, + settings.deleteStoredInfoTypeSettings(), + clientContext); backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @@ -758,6 +875,32 @@ public UnaryCallable createJobTriggerCallab return createJobTriggerCallable; } + public UnaryCallable createStoredInfoTypeCallable() { + return createStoredInfoTypeCallable; + } + + public UnaryCallable updateStoredInfoTypeCallable() { + return updateStoredInfoTypeCallable; + } + + public UnaryCallable getStoredInfoTypeCallable() { + return getStoredInfoTypeCallable; + } + + public UnaryCallable + listStoredInfoTypesPagedCallable() { + return listStoredInfoTypesPagedCallable; + } + + public UnaryCallable + listStoredInfoTypesCallable() { + return listStoredInfoTypesCallable; + } + + public UnaryCallable deleteStoredInfoTypeCallable() { + return deleteStoredInfoTypeCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-clients/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java b/google-cloud-clients/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java index f8dd8118173f..1c7aa7c79e93 100644 --- a/google-cloud-clients/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java +++ b/google-cloud-clients/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java @@ -21,6 +21,7 @@ import com.google.privacy.dlp.v2.CreateDlpJobRequest; import com.google.privacy.dlp.v2.CreateInspectTemplateRequest; import com.google.privacy.dlp.v2.CreateJobTriggerRequest; +import com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DeidentifyContentRequest; import com.google.privacy.dlp.v2.DeidentifyContentResponse; import com.google.privacy.dlp.v2.DeidentifyTemplate; @@ -28,12 +29,14 @@ import com.google.privacy.dlp.v2.DeleteDlpJobRequest; import com.google.privacy.dlp.v2.DeleteInspectTemplateRequest; import com.google.privacy.dlp.v2.DeleteJobTriggerRequest; +import com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest; import com.google.privacy.dlp.v2.DlpJob; import com.google.privacy.dlp.v2.DlpServiceGrpc.DlpServiceImplBase; import com.google.privacy.dlp.v2.GetDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.GetDlpJobRequest; import com.google.privacy.dlp.v2.GetInspectTemplateRequest; import com.google.privacy.dlp.v2.GetJobTriggerRequest; +import com.google.privacy.dlp.v2.GetStoredInfoTypeRequest; import com.google.privacy.dlp.v2.InspectContentRequest; import com.google.privacy.dlp.v2.InspectContentResponse; import com.google.privacy.dlp.v2.InspectTemplate; @@ -48,13 +51,17 @@ import com.google.privacy.dlp.v2.ListInspectTemplatesResponse; import com.google.privacy.dlp.v2.ListJobTriggersRequest; import com.google.privacy.dlp.v2.ListJobTriggersResponse; +import com.google.privacy.dlp.v2.ListStoredInfoTypesRequest; +import com.google.privacy.dlp.v2.ListStoredInfoTypesResponse; import com.google.privacy.dlp.v2.RedactImageRequest; import com.google.privacy.dlp.v2.RedactImageResponse; import com.google.privacy.dlp.v2.ReidentifyContentRequest; import com.google.privacy.dlp.v2.ReidentifyContentResponse; +import com.google.privacy.dlp.v2.StoredInfoType; import com.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.UpdateInspectTemplateRequest; import com.google.privacy.dlp.v2.UpdateJobTriggerRequest; +import com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest; import com.google.protobuf.Empty; import com.google.protobuf.GeneratedMessageV3; import io.grpc.stub.StreamObserver; @@ -471,4 +478,80 @@ public void cancelDlpJob(CancelDlpJobRequest request, StreamObserver resp responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } } + + @Override + public void createStoredInfoType( + CreateStoredInfoTypeRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof StoredInfoType) { + requests.add(request); + responseObserver.onNext((StoredInfoType) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateStoredInfoType( + UpdateStoredInfoTypeRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof StoredInfoType) { + requests.add(request); + responseObserver.onNext((StoredInfoType) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getStoredInfoType( + GetStoredInfoTypeRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof StoredInfoType) { + requests.add(request); + responseObserver.onNext((StoredInfoType) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listStoredInfoTypes( + ListStoredInfoTypesRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListStoredInfoTypesResponse) { + requests.add(request); + responseObserver.onNext((ListStoredInfoTypesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteStoredInfoType( + DeleteStoredInfoTypeRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext((Empty) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } }