diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index ac8adac9..73337e1d 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-dlp.git", - "sha": "3acf4b02aeba1e7c51df74c031ec355608d624c9" + "sha": "deb0e00f5ca2eebd41e02f5670fbd926f0ef7f6e" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "996775eca5fd934edac3c2ae34b80ff0395b1717" + "sha": "67f09bf301083798e7220137723222eb00b8f88a" } } ] diff --git a/CHANGELOG.md b/CHANGELOG.md index b1e4d8fd..665750f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.6](https://www.github.com/googleapis/java-dlp/compare/v2.2.5...v2.2.6) (2021-01-14) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.18.0 ([#399](https://www.github.com/googleapis/java-dlp/issues/399)) ([9761941](https://www.github.com/googleapis/java-dlp/commit/97619410a08a2b3cecc38f2aa650164ef6f4a696)) + ### [2.2.5](https://www.github.com/googleapis/java-dlp/compare/v2.2.4...v2.2.5) (2021-01-06) diff --git a/README.md b/README.md index 1525e916..84a56db2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file com.google.cloud libraries-bom - 16.2.0 + 16.2.1 pom import @@ -39,18 +39,25 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-dlp - 2.2.3 + 2.2.5 ``` -If you are using Gradle, add this to your dependencies +If you are using Gradle 5.x or later, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-dlp:2.2.4' +implementation platform('com.google.cloud:libraries-bom:16.2.1') + +compile 'com.google.cloud:google-cloud-dlp' +``` +If you are using Gradle without BOM, add this to your dependencies +```Groovy +compile 'com.google.cloud:google-cloud-dlp:2.2.5' ``` + If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-dlp" % "2.2.4" +libraryDependencies += "com.google.cloud" % "google-cloud-dlp" % "2.2.5" ``` ## Authentication diff --git a/google-cloud-dlp-bom/pom.xml b/google-cloud-dlp-bom/pom.xml index 11006ac0..c6f99673 100644 --- a/google-cloud-dlp-bom/pom.xml +++ b/google-cloud-dlp-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-dlp-bom - 2.2.5 + 2.2.6 pom com.google.cloud @@ -64,17 +64,17 @@ com.google.api.grpc grpc-google-cloud-dlp-v2 - 2.2.5 + 2.2.6 com.google.cloud google-cloud-dlp - 2.2.5 + 2.2.6 com.google.api.grpc proto-google-cloud-dlp-v2 - 2.2.5 + 2.2.6 diff --git a/google-cloud-dlp/pom.xml b/google-cloud-dlp/pom.xml index 8d2a1099..b333992d 100644 --- a/google-cloud-dlp/pom.xml +++ b/google-cloud-dlp/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-dlp - 2.2.5 + 2.2.6 jar Google Cloud DLP https://github.com/googleapis/java-dlp @@ -11,7 +11,7 @@ com.google.cloud google-cloud-dlp-parent - 2.2.5 + 2.2.6 google-cloud-dlp diff --git a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java index 9a0efe71..6df417b5 100644 --- a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java +++ b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceClient.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2; import com.google.api.core.ApiFunction; @@ -28,6 +29,7 @@ import com.google.cloud.dlp.v2.stub.DlpServiceStub; import com.google.cloud.dlp.v2.stub.DlpServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; +import com.google.privacy.dlp.v2.ActivateJobTriggerRequest; import com.google.privacy.dlp.v2.CancelDlpJobRequest; import com.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.CreateDlpJobRequest; @@ -96,7 +98,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: The Cloud Data Loss Prevention (DLP) API is a service that allows clients to * detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data @@ -109,16 +111,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
- *   String parent = "";
- *   ListInfoTypesResponse response = dlpServiceClient.listInfoTypes(parent);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the dlpServiceClient object to clean up resources such as + *

Note: close() needs to be called on the DlpServiceClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -146,30 +139,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * DlpServiceSettings dlpServiceSettings =
  *     DlpServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * DlpServiceClient dlpServiceClient =
- *     DlpServiceClient.create(dlpServiceSettings);
- * 
- * 
+ * DlpServiceClient dlpServiceClient = DlpServiceClient.create(dlpServiceSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * DlpServiceSettings dlpServiceSettings =
  *     DlpServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * DlpServiceClient dlpServiceClient =
- *     DlpServiceClient.create(dlpServiceSettings);
- * 
- * 
+ * DlpServiceClient dlpServiceClient = DlpServiceClient.create(dlpServiceSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class DlpServiceClient implements BackgroundResource { private final DlpServiceSettings settings; private final DlpServiceStub stub; @@ -189,7 +177,7 @@ public static final DlpServiceClient create(DlpServiceSettings settings) throws /** * Constructs an instance of DlpServiceClient, using the given stub for making calls. This is for - * advanced usage - prefer to use DlpServiceSettings}. + * advanced usage - prefer using create(DlpServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final DlpServiceClient create(DlpServiceStub stub) { @@ -220,7 +208,7 @@ public DlpServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Finds potentially sensitive info in content. This method has limits on input size, processing * time, and output size. @@ -232,15 +220,6 @@ public DlpServiceStub getStub() { *

For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images and * https://cloud.google.com/dlp/docs/inspecting-text, * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectContentRequest request = InspectContentRequest.newBuilder().build();
-   *   InspectContentResponse response = dlpServiceClient.inspectContent(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 */ @@ -248,7 +227,7 @@ public final InspectContentResponse inspectContent(InspectContentRequest request return inspectContentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Finds potentially sensitive info in content. This method has limits on input size, processing * time, and output size. @@ -261,22 +240,13 @@ public final InspectContentResponse inspectContent(InspectContentRequest request * https://cloud.google.com/dlp/docs/inspecting-text, * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectContentRequest request = InspectContentRequest.newBuilder().build();
-   *   ApiFuture<InspectContentResponse> future = dlpServiceClient.inspectContentCallable().futureCall(request);
-   *   // Do something
-   *   InspectContentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable inspectContentCallable() { return stub.inspectContentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Redacts potentially sensitive info from an image. This method has limits on input size, * processing time, and output size. See @@ -286,15 +256,6 @@ public final InspectContentResponse inspectContent(InspectContentRequest request * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   RedactImageRequest request = RedactImageRequest.newBuilder().build();
-   *   RedactImageResponse response = dlpServiceClient.redactImage(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 */ @@ -302,7 +263,7 @@ public final RedactImageResponse redactImage(RedactImageRequest request) { return redactImageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Redacts potentially sensitive info from an image. This method has limits on input size, * processing time, and output size. See @@ -313,21 +274,12 @@ public final RedactImageResponse redactImage(RedactImageRequest request) { * over time as detectors are updated. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   RedactImageRequest request = RedactImageRequest.newBuilder().build();
-   *   ApiFuture<RedactImageResponse> future = dlpServiceClient.redactImageCallable().futureCall(request);
-   *   // Do something
-   *   RedactImageResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable redactImageCallable() { return stub.redactImageCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * De-identifies potentially sensitive info from a ContentItem. This method has limits on input * size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn @@ -337,15 +289,6 @@ public final UnaryCallable redactImageC * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder().build();
-   *   DeidentifyContentResponse response = dlpServiceClient.deidentifyContent(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 */ @@ -353,7 +296,7 @@ public final DeidentifyContentResponse deidentifyContent(DeidentifyContentReques return deidentifyContentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * De-identifies potentially sensitive info from a ContentItem. This method has limits on input * size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn @@ -364,39 +307,18 @@ public final DeidentifyContentResponse deidentifyContent(DeidentifyContentReques * over time as detectors are updated. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder().build();
-   *   ApiFuture<DeidentifyContentResponse> future = dlpServiceClient.deidentifyContentCallable().futureCall(request);
-   *   // Do something
-   *   DeidentifyContentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable deidentifyContentCallable() { return stub.deidentifyContentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Re-identifies content that has been de-identified. See * https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example * to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ReidentifyContentRequest request = ReidentifyContentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ReidentifyContentResponse response = dlpServiceClient.reidentifyContent(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 */ @@ -404,45 +326,24 @@ public final ReidentifyContentResponse reidentifyContent(ReidentifyContentReques return reidentifyContentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Re-identifies content that has been de-identified. See * https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example * to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ReidentifyContentRequest request = ReidentifyContentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ReidentifyContentResponse> future = dlpServiceClient.reidentifyContentCallable().futureCall(request);
-   *   // Do something
-   *   ReidentifyContentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable reidentifyContentCallable() { return stub.reidentifyContentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of the sensitive information types that the DLP API supports. See * https://cloud.google.com/dlp/docs/infotypes-reference to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   String parent = "";
-   *   ListInfoTypesResponse response = dlpServiceClient.listInfoTypes(parent);
-   * }
-   * 
- * * @param parent The parent resource name. *

The format of this value is as follows: *

locations/<var>LOCATION_ID</var> @@ -453,20 +354,11 @@ public final ListInfoTypesResponse listInfoTypes(String parent) { return listInfoTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of the sensitive information types that the DLP API supports. See * https://cloud.google.com/dlp/docs/infotypes-reference to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ListInfoTypesRequest request = ListInfoTypesRequest.newBuilder().build();
-   *   ListInfoTypesResponse response = dlpServiceClient.listInfoTypes(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 */ @@ -474,41 +366,22 @@ public final ListInfoTypesResponse listInfoTypes(ListInfoTypesRequest request) { return listInfoTypesCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of the sensitive information types that the DLP API supports. See * https://cloud.google.com/dlp/docs/infotypes-reference to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ListInfoTypesRequest request = ListInfoTypesRequest.newBuilder().build();
-   *   ApiFuture<ListInfoTypesResponse> future = dlpServiceClient.listInfoTypesCallable().futureCall(request);
-   *   // Do something
-   *   ListInfoTypesResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable listInfoTypesCallable() { return stub.listInfoTypesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an InspectTemplate for re-using frequently used configuration for inspecting content, * images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -528,7 +401,7 @@ public final UnaryCallable listInfo * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final InspectTemplate createInspectTemplate( - OrganizationLocationName parent, InspectTemplate inspectTemplate) { + LocationName parent, InspectTemplate inspectTemplate) { CreateInspectTemplateRequest request = CreateInspectTemplateRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -537,21 +410,11 @@ public final InspectTemplate createInspectTemplate( return createInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an InspectTemplate for re-using frequently used configuration for inspecting content, * images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -571,7 +434,7 @@ public final InspectTemplate createInspectTemplate( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final InspectTemplate createInspectTemplate( - ProjectName parent, InspectTemplate inspectTemplate) { + OrganizationLocationName parent, InspectTemplate inspectTemplate) { CreateInspectTemplateRequest request = CreateInspectTemplateRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -580,21 +443,11 @@ public final InspectTemplate createInspectTemplate( return createInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an InspectTemplate for re-using frequently used configuration for inspecting content, * images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -623,21 +476,11 @@ public final InspectTemplate createInspectTemplate( return createInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an InspectTemplate for re-using frequently used configuration for inspecting content, * images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -657,7 +500,7 @@ public final InspectTemplate createInspectTemplate( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final InspectTemplate createInspectTemplate( - LocationName parent, InspectTemplate inspectTemplate) { + ProjectName parent, InspectTemplate inspectTemplate) { CreateInspectTemplateRequest request = CreateInspectTemplateRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -666,21 +509,11 @@ public final InspectTemplate createInspectTemplate( return createInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an InspectTemplate for re-using frequently used configuration for inspecting content, * images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent.toString(), inspectTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -709,25 +542,11 @@ public final InspectTemplate createInspectTemplate( return createInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an InspectTemplate for re-using frequently used configuration for inspecting content, * images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   CreateInspectTemplateRequest request = CreateInspectTemplateRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setInspectTemplate(inspectTemplate)
-   *     .build();
-   *   InspectTemplate response = dlpServiceClient.createInspectTemplate(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 */ @@ -735,48 +554,23 @@ public final InspectTemplate createInspectTemplate(CreateInspectTemplateRequest return createInspectTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an InspectTemplate for re-using frequently used configuration for inspecting content, * images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   CreateInspectTemplateRequest request = CreateInspectTemplateRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setInspectTemplate(inspectTemplate)
-   *     .build();
-   *   ApiFuture<InspectTemplate> future = dlpServiceClient.createInspectTemplateCallable().futureCall(request);
-   *   // Do something
-   *   InspectTemplate response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createInspectTemplateCallable() { return stub.createInspectTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   InspectTemplate response = dlpServiceClient.updateInspectTemplate(name, inspectTemplate, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of organization and inspectTemplate to be updated, for * example `organizations/433245324/inspectTemplates/432452342` or * projects/project-id/inspectTemplates/432452342. @@ -795,22 +589,11 @@ public final InspectTemplate updateInspectTemplate( return updateInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   InspectTemplate response = dlpServiceClient.updateInspectTemplate(name.toString(), inspectTemplate, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of organization and inspectTemplate to be updated, for * example `organizations/433245324/inspectTemplates/432452342` or * projects/project-id/inspectTemplates/432452342. @@ -829,23 +612,11 @@ public final InspectTemplate updateInspectTemplate( return updateInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   UpdateInspectTemplateRequest request = UpdateInspectTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   InspectTemplate response = dlpServiceClient.updateInspectTemplate(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 */ @@ -853,44 +624,23 @@ public final InspectTemplate updateInspectTemplate(UpdateInspectTemplateRequest return updateInspectTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   UpdateInspectTemplateRequest request = UpdateInspectTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<InspectTemplate> future = dlpServiceClient.updateInspectTemplateCallable().futureCall(request);
-   *   // Do something
-   *   InspectTemplate response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateInspectTemplateCallable() { return stub.updateInspectTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   InspectTemplate response = dlpServiceClient.getInspectTemplate(name);
-   * }
-   * 
- * * @param name Required. Resource name of the organization and inspectTemplate to be read, for * example `organizations/433245324/inspectTemplates/432452342` or * projects/project-id/inspectTemplates/432452342. @@ -904,20 +654,11 @@ public final InspectTemplate getInspectTemplate(InspectTemplateName name) { return getInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   InspectTemplate response = dlpServiceClient.getInspectTemplate(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the organization and inspectTemplate to be read, for * example `organizations/433245324/inspectTemplates/432452342` or * projects/project-id/inspectTemplates/432452342. @@ -929,23 +670,11 @@ public final InspectTemplate getInspectTemplate(String name) { return getInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   GetInspectTemplateRequest request = GetInspectTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   InspectTemplate response = dlpServiceClient.getInspectTemplate(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 */ @@ -953,45 +682,22 @@ public final InspectTemplate getInspectTemplate(GetInspectTemplateRequest reques return getInspectTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   GetInspectTemplateRequest request = GetInspectTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<InspectTemplate> future = dlpServiceClient.getInspectTemplateCallable().futureCall(request);
-   *   // Do something
-   *   InspectTemplate response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getInspectTemplateCallable() { return stub.getInspectTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   for (InspectTemplate element : dlpServiceClient.listInspectTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1009,8 +715,7 @@ public final InspectTemplate getInspectTemplate(GetInspectTemplateRequest reques *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListInspectTemplatesPagedResponse listInspectTemplates( - OrganizationLocationName parent) { + public final ListInspectTemplatesPagedResponse listInspectTemplates(LocationName parent) { ListInspectTemplatesRequest request = ListInspectTemplatesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1018,21 +723,10 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates( return listInspectTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (InspectTemplate element : dlpServiceClient.listInspectTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1050,7 +744,8 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates( *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListInspectTemplatesPagedResponse listInspectTemplates(ProjectName parent) { + public final ListInspectTemplatesPagedResponse listInspectTemplates( + OrganizationLocationName parent) { ListInspectTemplatesRequest request = ListInspectTemplatesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1058,21 +753,10 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates(ProjectName return listInspectTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   for (InspectTemplate element : dlpServiceClient.listInspectTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1098,21 +782,10 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates(Organization return listInspectTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (InspectTemplate element : dlpServiceClient.listInspectTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1130,7 +803,7 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates(Organization *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListInspectTemplatesPagedResponse listInspectTemplates(LocationName parent) { + public final ListInspectTemplatesPagedResponse listInspectTemplates(ProjectName parent) { ListInspectTemplatesRequest request = ListInspectTemplatesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1138,21 +811,10 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates(LocationName return listInspectTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   for (InspectTemplate element : dlpServiceClient.listInspectTemplates(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1176,24 +838,10 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates(String paren return listInspectTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   ListInspectTemplatesRequest request = ListInspectTemplatesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (InspectTemplate element : dlpServiceClient.listInspectTemplates(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 */ @@ -1202,77 +850,33 @@ public final ListInspectTemplatesPagedResponse listInspectTemplates( return listInspectTemplatesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   ListInspectTemplatesRequest request = ListInspectTemplatesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListInspectTemplatesPagedResponse> future = dlpServiceClient.listInspectTemplatesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (InspectTemplate element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listInspectTemplatesPagedCallable() { return stub.listInspectTemplatesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   ListInspectTemplatesRequest request = ListInspectTemplatesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListInspectTemplatesResponse response = dlpServiceClient.listInspectTemplatesCallable().call(request);
-   *     for (InspectTemplate element : response.getInspectTemplatesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listInspectTemplatesCallable() { return stub.listInspectTemplatesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   dlpServiceClient.deleteInspectTemplate(name);
-   * }
-   * 
- * * @param name Required. Resource name of the organization and inspectTemplate to be deleted, for * example `organizations/433245324/inspectTemplates/432452342` or * projects/project-id/inspectTemplates/432452342. @@ -1286,20 +890,11 @@ public final void deleteInspectTemplate(InspectTemplateName name) { deleteInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   dlpServiceClient.deleteInspectTemplate(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the organization and inspectTemplate to be deleted, for * example `organizations/433245324/inspectTemplates/432452342` or * projects/project-id/inspectTemplates/432452342. @@ -1311,23 +906,11 @@ public final void deleteInspectTemplate(String name) { deleteInspectTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   DeleteInspectTemplateRequest request = DeleteInspectTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   dlpServiceClient.deleteInspectTemplate(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 */ @@ -1335,45 +918,23 @@ public final void deleteInspectTemplate(DeleteInspectTemplateRequest request) { deleteInspectTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn * more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   InspectTemplateName name = InspectTemplateName.ofOrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]");
-   *   DeleteInspectTemplateRequest request = DeleteInspectTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = dlpServiceClient.deleteInspectTemplateCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteInspectTemplateCallable() { return stub.deleteInspectTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying * content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   DeidentifyTemplate response = dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1393,7 +954,7 @@ public final UnaryCallable deleteInspectTem * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final DeidentifyTemplate createDeidentifyTemplate( - OrganizationLocationName parent, DeidentifyTemplate deidentifyTemplate) { + LocationName parent, DeidentifyTemplate deidentifyTemplate) { CreateDeidentifyTemplateRequest request = CreateDeidentifyTemplateRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1402,22 +963,12 @@ public final DeidentifyTemplate createDeidentifyTemplate( return createDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying * content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   DeidentifyTemplate response = dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1437,7 +988,7 @@ public final DeidentifyTemplate createDeidentifyTemplate( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final DeidentifyTemplate createDeidentifyTemplate( - ProjectName parent, DeidentifyTemplate deidentifyTemplate) { + OrganizationLocationName parent, DeidentifyTemplate deidentifyTemplate) { CreateDeidentifyTemplateRequest request = CreateDeidentifyTemplateRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1446,22 +997,12 @@ public final DeidentifyTemplate createDeidentifyTemplate( return createDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying * content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   DeidentifyTemplate response = dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1490,22 +1031,12 @@ public final DeidentifyTemplate createDeidentifyTemplate( return createDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying * content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   DeidentifyTemplate response = dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1525,7 +1056,7 @@ public final DeidentifyTemplate createDeidentifyTemplate( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final DeidentifyTemplate createDeidentifyTemplate( - LocationName parent, DeidentifyTemplate deidentifyTemplate) { + ProjectName parent, DeidentifyTemplate deidentifyTemplate) { CreateDeidentifyTemplateRequest request = CreateDeidentifyTemplateRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1534,22 +1065,12 @@ public final DeidentifyTemplate createDeidentifyTemplate( return createDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying * content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   DeidentifyTemplate response = dlpServiceClient.createDeidentifyTemplate(parent.toString(), deidentifyTemplate);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1578,26 +1099,12 @@ public final DeidentifyTemplate createDeidentifyTemplate( return createDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying * content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   CreateDeidentifyTemplateRequest request = CreateDeidentifyTemplateRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setDeidentifyTemplate(deidentifyTemplate)
-   *     .build();
-   *   DeidentifyTemplate response = dlpServiceClient.createDeidentifyTemplate(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 */ @@ -1606,49 +1113,24 @@ public final DeidentifyTemplate createDeidentifyTemplate( return createDeidentifyTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying * content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   CreateDeidentifyTemplateRequest request = CreateDeidentifyTemplateRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setDeidentifyTemplate(deidentifyTemplate)
-   *     .build();
-   *   ApiFuture<DeidentifyTemplate> future = dlpServiceClient.createDeidentifyTemplateCallable().futureCall(request);
-   *   // Do something
-   *   DeidentifyTemplate response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createDeidentifyTemplateCallable() { return stub.createDeidentifyTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid * to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   DeidentifyTemplate response = dlpServiceClient.updateDeidentifyTemplate(name, deidentifyTemplate, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of organization and deidentify template to be updated, for * example `organizations/433245324/deidentifyTemplates/432452342` or * projects/project-id/deidentifyTemplates/432452342. @@ -1667,22 +1149,11 @@ public final DeidentifyTemplate updateDeidentifyTemplate( return updateDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid * to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   DeidentifyTemplate response = dlpServiceClient.updateDeidentifyTemplate(name.toString(), deidentifyTemplate, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of organization and deidentify template to be updated, for * example `organizations/433245324/deidentifyTemplates/432452342` or * projects/project-id/deidentifyTemplates/432452342. @@ -1701,23 +1172,11 @@ public final DeidentifyTemplate updateDeidentifyTemplate( return updateDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid * to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   UpdateDeidentifyTemplateRequest request = UpdateDeidentifyTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   DeidentifyTemplate response = dlpServiceClient.updateDeidentifyTemplate(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 */ @@ -1726,44 +1185,23 @@ public final DeidentifyTemplate updateDeidentifyTemplate( return updateDeidentifyTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid * to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   UpdateDeidentifyTemplateRequest request = UpdateDeidentifyTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<DeidentifyTemplate> future = dlpServiceClient.updateDeidentifyTemplateCallable().futureCall(request);
-   *   // Do something
-   *   DeidentifyTemplate response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateDeidentifyTemplateCallable() { return stub.updateDeidentifyTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   DeidentifyTemplate response = dlpServiceClient.getDeidentifyTemplate(name);
-   * }
-   * 
- * * @param name Required. Resource name of the organization and deidentify template to be read, for * example `organizations/433245324/deidentifyTemplates/432452342` or * projects/project-id/deidentifyTemplates/432452342. @@ -1777,20 +1215,11 @@ public final DeidentifyTemplate getDeidentifyTemplate(DeidentifyTemplateName nam return getDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   DeidentifyTemplate response = dlpServiceClient.getDeidentifyTemplate(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the organization and deidentify template to be read, for * example `organizations/433245324/deidentifyTemplates/432452342` or * projects/project-id/deidentifyTemplates/432452342. @@ -1802,23 +1231,11 @@ public final DeidentifyTemplate getDeidentifyTemplate(String name) { return getDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   GetDeidentifyTemplateRequest request = GetDeidentifyTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   DeidentifyTemplate response = dlpServiceClient.getDeidentifyTemplate(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 */ @@ -1826,46 +1243,23 @@ public final DeidentifyTemplate getDeidentifyTemplate(GetDeidentifyTemplateReque return getDeidentifyTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   GetDeidentifyTemplateRequest request = GetDeidentifyTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<DeidentifyTemplate> future = dlpServiceClient.getDeidentifyTemplateCallable().futureCall(request);
-   *   // Do something
-   *   DeidentifyTemplate response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getDeidentifyTemplateCallable() { return stub.getDeidentifyTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   for (DeidentifyTemplate element : dlpServiceClient.listDeidentifyTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1883,8 +1277,7 @@ public final DeidentifyTemplate getDeidentifyTemplate(GetDeidentifyTemplateReque *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates( - OrganizationLocationName parent) { + public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates(LocationName parent) { ListDeidentifyTemplatesRequest request = ListDeidentifyTemplatesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1892,22 +1285,11 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates( return listDeidentifyTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (DeidentifyTemplate element : dlpServiceClient.listDeidentifyTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1925,7 +1307,8 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates( *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates(ProjectName parent) { + public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates( + OrganizationLocationName parent) { ListDeidentifyTemplatesRequest request = ListDeidentifyTemplatesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -1933,22 +1316,11 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates(Projec return listDeidentifyTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
-   *   for (DeidentifyTemplate element : dlpServiceClient.listDeidentifyTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -1975,22 +1347,11 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates( return listDeidentifyTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (DeidentifyTemplate element : dlpServiceClient.listDeidentifyTemplates(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -2008,7 +1369,7 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates( *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates(LocationName parent) { + public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates(ProjectName parent) { ListDeidentifyTemplatesRequest request = ListDeidentifyTemplatesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -2016,22 +1377,11 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates(Locati return listDeidentifyTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   for (DeidentifyTemplate element : dlpServiceClient.listDeidentifyTemplates(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -2055,25 +1405,11 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates(String return listDeidentifyTemplates(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   ListDeidentifyTemplatesRequest request = ListDeidentifyTemplatesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (DeidentifyTemplate element : dlpServiceClient.listDeidentifyTemplates(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 */ @@ -2082,79 +1418,35 @@ public final ListDeidentifyTemplatesPagedResponse listDeidentifyTemplates( return listDeidentifyTemplatesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   ListDeidentifyTemplatesRequest request = ListDeidentifyTemplatesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListDeidentifyTemplatesPagedResponse> future = dlpServiceClient.listDeidentifyTemplatesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (DeidentifyTemplate element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listDeidentifyTemplatesPagedCallable() { return stub.listDeidentifyTemplatesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   ListDeidentifyTemplatesRequest request = ListDeidentifyTemplatesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListDeidentifyTemplatesResponse response = dlpServiceClient.listDeidentifyTemplatesCallable().call(request);
-   *     for (DeidentifyTemplate element : response.getDeidentifyTemplatesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listDeidentifyTemplatesCallable() { return stub.listDeidentifyTemplatesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   dlpServiceClient.deleteDeidentifyTemplate(name);
-   * }
-   * 
- * * @param name Required. Resource name of the organization and deidentify template to be deleted, * for example `organizations/433245324/deidentifyTemplates/432452342` or * projects/project-id/deidentifyTemplates/432452342. @@ -2168,20 +1460,11 @@ public final void deleteDeidentifyTemplate(DeidentifyTemplateName name) { deleteDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   dlpServiceClient.deleteDeidentifyTemplate(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the organization and deidentify template to be deleted, * for example `organizations/433245324/deidentifyTemplates/432452342` or * projects/project-id/deidentifyTemplates/432452342. @@ -2193,23 +1476,11 @@ public final void deleteDeidentifyTemplate(String name) { deleteDeidentifyTemplate(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   DeleteDeidentifyTemplateRequest request = DeleteDeidentifyTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   dlpServiceClient.deleteDeidentifyTemplate(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 */ @@ -2217,45 +1488,23 @@ public final void deleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest reque deleteDeidentifyTemplateCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to * learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
-   *   DeleteDeidentifyTemplateRequest request = DeleteDeidentifyTemplateRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = dlpServiceClient.deleteDeidentifyTemplateCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteDeidentifyTemplateCallable() { return stub.deleteDeidentifyTemplateCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a job trigger to run DLP actions such as scanning storage for sensitive information on * a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
-   *   JobTrigger response = dlpServiceClient.createJobTrigger(parent, jobTrigger);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -2269,7 +1518,7 @@ public final void deleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest reque * @param jobTrigger Required. The JobTrigger to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final JobTrigger createJobTrigger(ProjectName parent, JobTrigger jobTrigger) { + public final JobTrigger createJobTrigger(LocationName parent, JobTrigger jobTrigger) { CreateJobTriggerRequest request = CreateJobTriggerRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -2278,21 +1527,11 @@ public final JobTrigger createJobTrigger(ProjectName parent, JobTrigger jobTrigg return createJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a job trigger to run DLP actions such as scanning storage for sensitive information on * a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
-   *   JobTrigger response = dlpServiceClient.createJobTrigger(parent, jobTrigger);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -2306,7 +1545,7 @@ public final JobTrigger createJobTrigger(ProjectName parent, JobTrigger jobTrigg * @param jobTrigger Required. The JobTrigger to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final JobTrigger createJobTrigger(LocationName parent, JobTrigger jobTrigger) { + public final JobTrigger createJobTrigger(ProjectName parent, JobTrigger jobTrigger) { CreateJobTriggerRequest request = CreateJobTriggerRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -2315,21 +1554,11 @@ public final JobTrigger createJobTrigger(LocationName parent, JobTrigger jobTrig return createJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a job trigger to run DLP actions such as scanning storage for sensitive information on * a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
-   *   JobTrigger response = dlpServiceClient.createJobTrigger(parent.toString(), jobTrigger);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -2349,25 +1578,11 @@ public final JobTrigger createJobTrigger(String parent, JobTrigger jobTrigger) { return createJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a job trigger to run DLP actions such as scanning storage for sensitive information on * a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
-   *   CreateJobTriggerRequest request = CreateJobTriggerRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setJobTrigger(jobTrigger)
-   *     .build();
-   *   JobTrigger response = dlpServiceClient.createJobTrigger(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 */ @@ -2375,47 +1590,22 @@ public final JobTrigger createJobTrigger(CreateJobTriggerRequest request) { return createJobTriggerCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a job trigger to run DLP actions such as scanning storage for sensitive information on * a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
-   *   CreateJobTriggerRequest request = CreateJobTriggerRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setJobTrigger(jobTrigger)
-   *     .build();
-   *   ApiFuture<JobTrigger> future = dlpServiceClient.createJobTriggerCallable().futureCall(request);
-   *   // Do something
-   *   JobTrigger response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createJobTriggerCallable() { return stub.createJobTriggerCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   JobTrigger response = dlpServiceClient.updateJobTrigger(name, jobTrigger, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of the project and the triggeredJob, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @param jobTrigger New JobTrigger value. @@ -2433,22 +1623,11 @@ public final JobTrigger updateJobTrigger( return updateJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   JobTrigger response = dlpServiceClient.updateJobTrigger(name.toString(), jobTrigger, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of the project and the triggeredJob, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @param jobTrigger New JobTrigger value. @@ -2466,23 +1645,11 @@ public final JobTrigger updateJobTrigger( return updateJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   UpdateJobTriggerRequest request = UpdateJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   JobTrigger response = dlpServiceClient.updateJobTrigger(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 */ @@ -2490,45 +1657,24 @@ public final JobTrigger updateJobTrigger(UpdateJobTriggerRequest request) { return updateJobTriggerCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   UpdateJobTriggerRequest request = UpdateJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<JobTrigger> future = dlpServiceClient.updateJobTriggerCallable().futureCall(request);
-   *   // Do something
-   *   JobTrigger response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateJobTriggerCallable() { return stub.updateJobTriggerCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a trigger. The inspection will be processed * asynchronously. To review the findings monitor the jobs within the trigger. Early access * feature is in a pre-release state and might change or have limited support. For more * information, see https://cloud.google.com/products#product-launch-stages. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   HybridInspectResponse response = dlpServiceClient.hybridInspectJobTrigger(name);
-   * }
-   * 
- * * @param name Required. Resource name of the trigger to execute a hybrid inspect on, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2541,22 +1687,13 @@ public final HybridInspectResponse hybridInspectJobTrigger(JobTriggerName name) return hybridInspectJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a trigger. The inspection will be processed * asynchronously. To review the findings monitor the jobs within the trigger. Early access * feature is in a pre-release state and might change or have limited support. For more * information, see https://cloud.google.com/products#product-launch-stages. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   HybridInspectResponse response = dlpServiceClient.hybridInspectJobTrigger(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the trigger to execute a hybrid inspect on, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2567,25 +1704,13 @@ public final HybridInspectResponse hybridInspectJobTrigger(String name) { return hybridInspectJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a trigger. The inspection will be processed * asynchronously. To review the findings monitor the jobs within the trigger. Early access * feature is in a pre-release state and might change or have limited support. For more * information, see https://cloud.google.com/products#product-launch-stages. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   HybridInspectJobTriggerRequest request = HybridInspectJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   HybridInspectResponse response = dlpServiceClient.hybridInspectJobTrigger(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 */ @@ -2594,7 +1719,7 @@ public final HybridInspectResponse hybridInspectJobTrigger( return hybridInspectJobTriggerCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a trigger. The inspection will be processed * asynchronously. To review the findings monitor the jobs within the trigger. Early access @@ -2602,37 +1727,16 @@ public final HybridInspectResponse hybridInspectJobTrigger( * information, see https://cloud.google.com/products#product-launch-stages. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   HybridInspectJobTriggerRequest request = HybridInspectJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<HybridInspectResponse> future = dlpServiceClient.hybridInspectJobTriggerCallable().futureCall(request);
-   *   // Do something
-   *   HybridInspectResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable hybridInspectJobTriggerCallable() { return stub.hybridInspectJobTriggerCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   JobTrigger response = dlpServiceClient.getJobTrigger(name);
-   * }
-   * 
- * * @param name Required. Resource name of the project and the triggeredJob, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2643,19 +1747,10 @@ public final JobTrigger getJobTrigger(JobTriggerName name) { return getJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   JobTrigger response = dlpServiceClient.getJobTrigger(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the project and the triggeredJob, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2665,22 +1760,10 @@ public final JobTrigger getJobTrigger(String name) { return getJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   GetJobTriggerRequest request = GetJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   JobTrigger response = dlpServiceClient.getJobTrigger(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 */ @@ -2688,43 +1771,20 @@ public final JobTrigger getJobTrigger(GetJobTriggerRequest request) { return getJobTriggerCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   GetJobTriggerRequest request = GetJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<JobTrigger> future = dlpServiceClient.getJobTriggerCallable().futureCall(request);
-   *   // Do something
-   *   JobTrigger response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getJobTriggerCallable() { return stub.getJobTriggerCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (JobTrigger element : dlpServiceClient.listJobTriggers(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -2737,7 +1797,7 @@ public final UnaryCallable getJobTriggerCallab *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListJobTriggersPagedResponse listJobTriggers(ProjectName parent) { + public final ListJobTriggersPagedResponse listJobTriggers(LocationName parent) { ListJobTriggersRequest request = ListJobTriggersRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -2745,21 +1805,10 @@ public final ListJobTriggersPagedResponse listJobTriggers(ProjectName parent) { return listJobTriggers(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (JobTrigger element : dlpServiceClient.listJobTriggers(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -2772,7 +1821,7 @@ public final ListJobTriggersPagedResponse listJobTriggers(ProjectName parent) { *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListJobTriggersPagedResponse listJobTriggers(LocationName parent) { + public final ListJobTriggersPagedResponse listJobTriggers(ProjectName parent) { ListJobTriggersRequest request = ListJobTriggersRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -2780,21 +1829,10 @@ public final ListJobTriggersPagedResponse listJobTriggers(LocationName parent) { return listJobTriggers(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (JobTrigger element : dlpServiceClient.listJobTriggers(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -2812,24 +1850,10 @@ public final ListJobTriggersPagedResponse listJobTriggers(String parent) { return listJobTriggers(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListJobTriggersRequest request = ListJobTriggersRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (JobTrigger element : dlpServiceClient.listJobTriggers(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 */ @@ -2837,77 +1861,33 @@ public final ListJobTriggersPagedResponse listJobTriggers(ListJobTriggersRequest return listJobTriggersPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListJobTriggersRequest request = ListJobTriggersRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListJobTriggersPagedResponse> future = dlpServiceClient.listJobTriggersPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (JobTrigger element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listJobTriggersPagedCallable() { return stub.listJobTriggersPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListJobTriggersRequest request = ListJobTriggersRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListJobTriggersResponse response = dlpServiceClient.listJobTriggersCallable().call(request);
-   *     for (JobTrigger element : response.getJobTriggersList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listJobTriggersCallable() { return stub.listJobTriggersCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   dlpServiceClient.deleteJobTrigger(name);
-   * }
-   * 
- * * @param name Required. Resource name of the project and the triggeredJob, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2918,20 +1898,11 @@ public final void deleteJobTrigger(JobTriggerName name) { deleteJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   dlpServiceClient.deleteJobTrigger(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the project and the triggeredJob, for example * `projects/dlp-test-project/jobTriggers/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2941,23 +1912,11 @@ public final void deleteJobTrigger(String name) { deleteJobTrigger(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   DeleteJobTriggerRequest request = DeleteJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   dlpServiceClient.deleteJobTrigger(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 */ @@ -2965,30 +1924,41 @@ public final void deleteJobTrigger(DeleteJobTriggerRequest request) { deleteJobTriggerCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn * more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
-   *   DeleteJobTriggerRequest request = DeleteJobTriggerRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = dlpServiceClient.deleteJobTriggerCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteJobTriggerCallable() { return stub.deleteJobTriggerCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the + * trigger event to occur. + * + * @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 DlpJob activateJobTrigger(ActivateJobTriggerRequest request) { + return activateJobTriggerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the + * trigger event to occur. + * + *

Sample code: + */ + public final UnaryCallable activateJobTriggerCallable() { + return stub.activateJobTriggerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -2998,16 +1968,6 @@ public final UnaryCallable deleteJobTriggerCalla * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
-   *   DlpJob response = dlpServiceClient.createDlpJob(parent, inspectJob);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3021,7 +1981,7 @@ public final UnaryCallable deleteJobTriggerCalla * @param inspectJob Set to control what and how to inspect. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final DlpJob createDlpJob(ProjectName parent, InspectJobConfig inspectJob) { + public final DlpJob createDlpJob(LocationName parent, InspectJobConfig inspectJob) { CreateDlpJobRequest request = CreateDlpJobRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -3030,7 +1990,7 @@ public final DlpJob createDlpJob(ProjectName parent, InspectJobConfig inspectJob return createDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -3040,16 +2000,6 @@ public final DlpJob createDlpJob(ProjectName parent, InspectJobConfig inspectJob * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
-   *   DlpJob response = dlpServiceClient.createDlpJob(parent, inspectJob);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3060,19 +2010,19 @@ public final DlpJob createDlpJob(ProjectName parent, InspectJobConfig inspectJob *

The following example `parent` string specifies a parent project with the identifier * `example-project`, and specifies the `europe-west3` location for processing data: *

parent=projects/example-project/locations/europe-west3 - * @param inspectJob Set to control what and how to inspect. + * @param riskJob Set to choose what metric to calculate. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final DlpJob createDlpJob(LocationName parent, InspectJobConfig inspectJob) { + public final DlpJob createDlpJob(LocationName parent, RiskAnalysisJobConfig riskJob) { CreateDlpJobRequest request = CreateDlpJobRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) - .setInspectJob(inspectJob) + .setRiskJob(riskJob) .build(); return createDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -3082,16 +2032,6 @@ public final DlpJob createDlpJob(LocationName parent, InspectJobConfig inspectJo * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
-   *   DlpJob response = dlpServiceClient.createDlpJob(parent.toString(), inspectJob);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3105,13 +2045,16 @@ public final DlpJob createDlpJob(LocationName parent, InspectJobConfig inspectJo * @param inspectJob Set to control what and how to inspect. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final DlpJob createDlpJob(String parent, InspectJobConfig inspectJob) { + public final DlpJob createDlpJob(ProjectName parent, InspectJobConfig inspectJob) { CreateDlpJobRequest request = - CreateDlpJobRequest.newBuilder().setParent(parent).setInspectJob(inspectJob).build(); + CreateDlpJobRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setInspectJob(inspectJob) + .build(); return createDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -3121,16 +2064,6 @@ public final DlpJob createDlpJob(String parent, InspectJobConfig inspectJob) { * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
-   *   DlpJob response = dlpServiceClient.createDlpJob(parent, riskJob);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3153,7 +2086,7 @@ public final DlpJob createDlpJob(ProjectName parent, RiskAnalysisJobConfig riskJ return createDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -3163,16 +2096,6 @@ public final DlpJob createDlpJob(ProjectName parent, RiskAnalysisJobConfig riskJ * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
-   *   DlpJob response = dlpServiceClient.createDlpJob(parent, riskJob);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3183,19 +2106,16 @@ public final DlpJob createDlpJob(ProjectName parent, RiskAnalysisJobConfig riskJ *

The following example `parent` string specifies a parent project with the identifier * `example-project`, and specifies the `europe-west3` location for processing data: *

parent=projects/example-project/locations/europe-west3 - * @param riskJob Set to choose what metric to calculate. + * @param inspectJob Set to control what and how to inspect. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final DlpJob createDlpJob(LocationName parent, RiskAnalysisJobConfig riskJob) { + public final DlpJob createDlpJob(String parent, InspectJobConfig inspectJob) { CreateDlpJobRequest request = - CreateDlpJobRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setRiskJob(riskJob) - .build(); + CreateDlpJobRequest.newBuilder().setParent(parent).setInspectJob(inspectJob).build(); return createDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -3205,16 +2125,6 @@ public final DlpJob createDlpJob(LocationName parent, RiskAnalysisJobConfig risk * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
-   *   DlpJob response = dlpServiceClient.createDlpJob(parent.toString(), riskJob);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3234,7 +2144,7 @@ public final DlpJob createDlpJob(String parent, RiskAnalysisJobConfig riskJob) { return createDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -3244,18 +2154,6 @@ public final DlpJob createDlpJob(String parent, RiskAnalysisJobConfig riskJob) { * automatically choose what detectors to run. By default this may be all types, but may change * over time as detectors are updated. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   CreateDlpJobRequest request = CreateDlpJobRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   DlpJob response = dlpServiceClient.createDlpJob(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 */ @@ -3263,7 +2161,7 @@ public final DlpJob createDlpJob(CreateDlpJobRequest request) { return createDlpJobCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new job to inspect storage or calculate risk metrics. See * https://cloud.google.com/dlp/docs/inspecting-storage and @@ -3274,40 +2172,17 @@ public final DlpJob createDlpJob(CreateDlpJobRequest request) { * over time as detectors are updated. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   CreateDlpJobRequest request = CreateDlpJobRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<DlpJob> future = dlpServiceClient.createDlpJobCallable().futureCall(request);
-   *   // Do something
-   *   DlpJob response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createDlpJobCallable() { return stub.createDlpJobCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DlpJobs that match the specified filter in the request. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (DlpJob element : dlpServiceClient.listDlpJobs(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3320,7 +2195,7 @@ public final UnaryCallable createDlpJobCallable() { *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListDlpJobsPagedResponse listDlpJobs(ProjectName parent) { + public final ListDlpJobsPagedResponse listDlpJobs(LocationName parent) { ListDlpJobsRequest request = ListDlpJobsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -3328,23 +2203,12 @@ public final ListDlpJobsPagedResponse listDlpJobs(ProjectName parent) { return listDlpJobs(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DlpJobs that match the specified filter in the request. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (DlpJob element : dlpServiceClient.listDlpJobs(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3357,7 +2221,7 @@ public final ListDlpJobsPagedResponse listDlpJobs(ProjectName parent) { *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListDlpJobsPagedResponse listDlpJobs(LocationName parent) { + public final ListDlpJobsPagedResponse listDlpJobs(ProjectName parent) { ListDlpJobsRequest request = ListDlpJobsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -3365,23 +2229,12 @@ public final ListDlpJobsPagedResponse listDlpJobs(LocationName parent) { return listDlpJobs(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DlpJobs that match the specified filter in the request. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (DlpJob element : dlpServiceClient.listDlpJobs(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on whether you have [specified a processing * location](https://cloud.google.com/dlp/docs/specifying-location): @@ -3399,26 +2252,12 @@ public final ListDlpJobsPagedResponse listDlpJobs(String parent) { return listDlpJobs(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DlpJobs that match the specified filter in the request. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListDlpJobsRequest request = ListDlpJobsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (DlpJob element : dlpServiceClient.listDlpJobs(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 */ @@ -3426,81 +2265,37 @@ public final ListDlpJobsPagedResponse listDlpJobs(ListDlpJobsRequest request) { return listDlpJobsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DlpJobs that match the specified filter in the request. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListDlpJobsRequest request = ListDlpJobsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListDlpJobsPagedResponse> future = dlpServiceClient.listDlpJobsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (DlpJob element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listDlpJobsPagedCallable() { return stub.listDlpJobsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists DlpJobs that match the specified filter in the request. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListDlpJobsRequest request = ListDlpJobsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListDlpJobsResponse response = dlpServiceClient.listDlpJobsCallable().call(request);
-   *     for (DlpJob element : response.getJobsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listDlpJobsCallable() { return stub.listDlpJobsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the latest state of a long-running DlpJob. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   DlpJob response = dlpServiceClient.getDlpJob(name);
-   * }
-   * 
- * * @param name Required. The name of the DlpJob resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -3510,21 +2305,12 @@ public final DlpJob getDlpJob(DlpJobName name) { return getDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the latest state of a long-running DlpJob. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   DlpJob response = dlpServiceClient.getDlpJob(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the DlpJob resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -3533,24 +2319,12 @@ public final DlpJob getDlpJob(String name) { return getDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the latest state of a long-running DlpJob. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   GetDlpJobRequest request = GetDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   DlpJob response = dlpServiceClient.getDlpJob(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 */ @@ -3558,46 +2332,25 @@ public final DlpJob getDlpJob(GetDlpJobRequest request) { return getDlpJobCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the latest state of a long-running DlpJob. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   GetDlpJobRequest request = GetDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<DlpJob> future = dlpServiceClient.getDlpJobCallable().futureCall(request);
-   *   // Do something
-   *   DlpJob response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getDlpJobCallable() { return stub.getDlpJobCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a long-running DlpJob. This method indicates that the client is no longer interested in * the DlpJob result. The job will be cancelled if possible. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   dlpServiceClient.deleteDlpJob(name);
-   * }
-   * 
- * * @param name Required. The name of the DlpJob resource to be deleted. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -3607,22 +2360,13 @@ public final void deleteDlpJob(DlpJobName name) { deleteDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a long-running DlpJob. This method indicates that the client is no longer interested in * the DlpJob result. The job will be cancelled if possible. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   dlpServiceClient.deleteDlpJob(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the DlpJob resource to be deleted. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -3631,25 +2375,13 @@ public final void deleteDlpJob(String name) { deleteDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a long-running DlpJob. This method indicates that the client is no longer interested in * the DlpJob result. The job will be cancelled if possible. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   DeleteDlpJobRequest request = DeleteDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   dlpServiceClient.deleteDlpJob(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 */ @@ -3657,7 +2389,7 @@ public final void deleteDlpJob(DeleteDlpJobRequest request) { deleteDlpJobCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a long-running DlpJob. This method indicates that the client is no longer interested in * the DlpJob result. The job will be cancelled if possible. See @@ -3665,42 +2397,18 @@ public final void deleteDlpJob(DeleteDlpJobRequest request) { * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   DeleteDlpJobRequest request = DeleteDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = dlpServiceClient.deleteDlpJobCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteDlpJobCallable() { return stub.deleteDlpJobCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to * cancel the DlpJob, but success is not guaranteed. See * https://cloud.google.com/dlp/docs/inspecting-storage and * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   CancelDlpJobRequest request = CancelDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   dlpServiceClient.cancelDlpJob(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 */ @@ -3708,7 +2416,7 @@ public final void cancelDlpJob(CancelDlpJobRequest request) { cancelDlpJobCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to * cancel the DlpJob, but success is not guaranteed. See @@ -3716,38 +2424,16 @@ public final void cancelDlpJob(CancelDlpJobRequest request) { * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   CancelDlpJobRequest request = CancelDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = dlpServiceClient.cancelDlpJobCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable cancelDlpJobCallable() { return stub.cancelDlpJobCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -3767,7 +2453,7 @@ public final UnaryCallable cancelDlpJobCallable() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final StoredInfoType createStoredInfoType( - OrganizationLocationName parent, StoredInfoTypeConfig config) { + LocationName parent, StoredInfoTypeConfig config) { CreateStoredInfoTypeRequest request = CreateStoredInfoTypeRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -3776,21 +2462,11 @@ public final StoredInfoType createStoredInfoType( return createStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -3810,7 +2486,7 @@ public final StoredInfoType createStoredInfoType( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final StoredInfoType createStoredInfoType( - ProjectName parent, StoredInfoTypeConfig config) { + OrganizationLocationName parent, StoredInfoTypeConfig config) { CreateStoredInfoTypeRequest request = CreateStoredInfoTypeRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -3819,21 +2495,11 @@ public final StoredInfoType createStoredInfoType( return createStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -3862,21 +2528,11 @@ public final StoredInfoType createStoredInfoType( return createStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -3896,7 +2552,7 @@ public final StoredInfoType createStoredInfoType( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final StoredInfoType createStoredInfoType( - LocationName parent, StoredInfoTypeConfig config) { + ProjectName parent, StoredInfoTypeConfig config) { CreateStoredInfoTypeRequest request = CreateStoredInfoTypeRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -3905,21 +2561,11 @@ public final StoredInfoType createStoredInfoType( return createStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent.toString(), config);
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -3944,25 +2590,11 @@ public final StoredInfoType createStoredInfoType(String parent, StoredInfoTypeCo return createStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   CreateStoredInfoTypeRequest request = CreateStoredInfoTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setConfig(config)
-   *     .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 */ @@ -3970,49 +2602,24 @@ public final StoredInfoType createStoredInfoType(CreateStoredInfoTypeRequest req return createStoredInfoTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   CreateStoredInfoTypeRequest request = CreateStoredInfoTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setConfig(config)
-   *     .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 + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   StoredInfoType response = dlpServiceClient.updateStoredInfoType(name, config, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of organization and storedInfoType to be updated, for * example `organizations/433245324/storedInfoTypes/432452342` or * projects/project-id/storedInfoTypes/432452342. @@ -4032,23 +2639,12 @@ public final StoredInfoType updateStoredInfoType( return updateStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
-   *   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   StoredInfoType response = dlpServiceClient.updateStoredInfoType(name.toString(), config, updateMask);
-   * }
-   * 
- * * @param name Required. Resource name of organization and storedInfoType to be updated, for * example `organizations/433245324/storedInfoTypes/432452342` or * projects/project-id/storedInfoTypes/432452342. @@ -4068,24 +2664,12 @@ public final StoredInfoType updateStoredInfoType( return updateStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[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 */ @@ -4093,45 +2677,24 @@ public final StoredInfoType updateStoredInfoType(UpdateStoredInfoTypeRequest req return updateStoredInfoTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[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 + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
-   *   StoredInfoType response = dlpServiceClient.getStoredInfoType(name);
-   * }
-   * 
- * * @param name Required. Resource name of the organization and storedInfoType to be read, for * example `organizations/433245324/storedInfoTypes/432452342` or * projects/project-id/storedInfoTypes/432452342. @@ -4145,20 +2708,11 @@ public final StoredInfoType getStoredInfoType(StoredInfoTypeName name) { return getStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
-   *   StoredInfoType response = dlpServiceClient.getStoredInfoType(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the organization and storedInfoType to be read, for * example `organizations/433245324/storedInfoTypes/432452342` or * projects/project-id/storedInfoTypes/432452342. @@ -4169,23 +2723,11 @@ public final StoredInfoType getStoredInfoType(String name) { return getStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[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 */ @@ -4193,45 +2735,22 @@ public final StoredInfoType getStoredInfoType(GetStoredInfoTypeRequest request) return getStoredInfoTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[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 + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   for (StoredInfoType element : dlpServiceClient.listStoredInfoTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -4249,8 +2768,7 @@ public final UnaryCallable getStoredIn *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListStoredInfoTypesPagedResponse listStoredInfoTypes( - OrganizationLocationName parent) { + public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(LocationName parent) { ListStoredInfoTypesRequest request = ListStoredInfoTypesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -4258,22 +2776,11 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes( return listStoredInfoTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (StoredInfoType element : dlpServiceClient.listStoredInfoTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -4291,7 +2798,8 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes( *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(ProjectName parent) { + public final ListStoredInfoTypesPagedResponse listStoredInfoTypes( + OrganizationLocationName parent) { ListStoredInfoTypesRequest request = ListStoredInfoTypesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -4299,22 +2807,11 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(ProjectName pa return listStoredInfoTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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]");
-   *   for (StoredInfoType element : dlpServiceClient.listStoredInfoTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -4340,22 +2837,11 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(OrganizationNa return listStoredInfoTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (StoredInfoType element : dlpServiceClient.listStoredInfoTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -4373,7 +2859,7 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(OrganizationNa *

parent=projects/example-project/locations/europe-west3 * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(LocationName parent) { + public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(ProjectName parent) { ListStoredInfoTypesRequest request = ListStoredInfoTypesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) @@ -4381,22 +2867,11 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(LocationName p return listStoredInfoTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   for (StoredInfoType element : dlpServiceClient.listStoredInfoTypes(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. *

The format of this value varies depending on the scope of the request (project or * organization) and whether you have [specified a processing @@ -4420,25 +2895,11 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes(String parent) return listStoredInfoTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   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 */ @@ -4447,79 +2908,35 @@ public final ListStoredInfoTypesPagedResponse listStoredInfoTypes( return listStoredInfoTypesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   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 + // 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()) {
-   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
-   *   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 + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
-   *   dlpServiceClient.deleteStoredInfoType(name);
-   * }
-   * 
- * * @param name Required. Resource name of the organization and storedInfoType to be deleted, for * example `organizations/433245324/storedInfoTypes/432452342` or * projects/project-id/storedInfoTypes/432452342. @@ -4533,20 +2950,11 @@ public final void deleteStoredInfoType(StoredInfoTypeName name) { deleteStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
-   *   dlpServiceClient.deleteStoredInfoType(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the organization and storedInfoType to be deleted, for * example `organizations/433245324/storedInfoTypes/432452342` or * projects/project-id/storedInfoTypes/432452342. @@ -4558,23 +2966,11 @@ public final void deleteStoredInfoType(String name) { deleteStoredInfoType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[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 */ @@ -4582,45 +2978,24 @@ public final void deleteStoredInfoType(DeleteStoredInfoTypeRequest request) { deleteStoredInfoTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // 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 = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[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(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a job. To review the findings inspect the job. * Inspection will occur asynchronously. Early access feature is in a pre-release state and might * change or have limited support. For more information, see * https://cloud.google.com/products#product-launch-stages. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   HybridInspectResponse response = dlpServiceClient.hybridInspectDlpJob(name);
-   * }
-   * 
- * * @param name Required. Resource name of the job to execute a hybrid inspect on, for example * `projects/dlp-test-project/dlpJob/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -4633,22 +3008,13 @@ public final HybridInspectResponse hybridInspectDlpJob(DlpJobName name) { return hybridInspectDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a job. To review the findings inspect the job. * Inspection will occur asynchronously. Early access feature is in a pre-release state and might * change or have limited support. For more information, see * https://cloud.google.com/products#product-launch-stages. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   HybridInspectResponse response = dlpServiceClient.hybridInspectDlpJob(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the job to execute a hybrid inspect on, for example * `projects/dlp-test-project/dlpJob/53234423`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -4659,25 +3025,13 @@ public final HybridInspectResponse hybridInspectDlpJob(String name) { return hybridInspectDlpJob(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a job. To review the findings inspect the job. * Inspection will occur asynchronously. Early access feature is in a pre-release state and might * change or have limited support. For more information, see * https://cloud.google.com/products#product-launch-stages. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   HybridInspectDlpJobRequest request = HybridInspectDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   HybridInspectResponse response = dlpServiceClient.hybridInspectDlpJob(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 */ @@ -4685,7 +3039,7 @@ public final HybridInspectResponse hybridInspectDlpJob(HybridInspectDlpJobReques return hybridInspectDlpJobCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Inspect hybrid content and store findings to a job. To review the findings inspect the job. * Inspection will occur asynchronously. Early access feature is in a pre-release state and might @@ -4693,43 +3047,19 @@ public final HybridInspectResponse hybridInspectDlpJob(HybridInspectDlpJobReques * https://cloud.google.com/products#product-launch-stages. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   HybridInspectDlpJobRequest request = HybridInspectDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<HybridInspectResponse> future = dlpServiceClient.hybridInspectDlpJobCallable().futureCall(request);
-   *   // Do something
-   *   HybridInspectResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable hybridInspectDlpJobCallable() { return stub.hybridInspectDlpJobCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Finish a running hybrid DlpJob. Triggers the finalization steps and running of any enabled * actions that have not yet run. Early access feature is in a pre-release state and might change * or have limited support. For more information, see * https://cloud.google.com/products#product-launch-stages. * - *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   FinishDlpJobRequest request = FinishDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   dlpServiceClient.finishDlpJob(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 */ @@ -4737,7 +3067,7 @@ public final void finishDlpJob(FinishDlpJobRequest request) { finishDlpJobCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Finish a running hybrid DlpJob. Triggers the finalization steps and running of any enabled * actions that have not yet run. Early access feature is in a pre-release state and might change @@ -4745,18 +3075,6 @@ public final void finishDlpJob(FinishDlpJobRequest request) { * https://cloud.google.com/products#product-launch-stages. * *

Sample code: - * - *


-   * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
-   *   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
-   *   FinishDlpJobRequest request = FinishDlpJobRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = dlpServiceClient.finishDlpJobCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable finishDlpJobCallable() { return stub.finishDlpJobCallable(); diff --git a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java index 87c9bd0a..25f34814 100644 --- a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java +++ b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/DlpServiceSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2; import static com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse; @@ -33,6 +34,7 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dlp.v2.stub.DlpServiceStubSettings; +import com.google.privacy.dlp.v2.ActivateJobTriggerRequest; import com.google.privacy.dlp.v2.CancelDlpJobRequest; import com.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.CreateDlpJobRequest; @@ -87,7 +89,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link DlpServiceClient}. * @@ -102,25 +104,25 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of listInfoTypes to 30 seconds: + *

For example, to set the total timeout of inspectContent to 30 seconds: * - *

- * 
- * DlpServiceSettings.Builder dlpServiceSettingsBuilder =
- *     DlpServiceSettings.newBuilder();
+ * 
{@code
+ * DlpServiceSettings.Builder dlpServiceSettingsBuilder = DlpServiceSettings.newBuilder();
  * dlpServiceSettingsBuilder
- *     .listInfoTypesSettings()
+ *     .inspectContentSettings()
  *     .setRetrySettings(
- *         dlpServiceSettingsBuilder.listInfoTypesSettings().getRetrySettings().toBuilder()
+ *         dlpServiceSettingsBuilder
+ *             .inspectContentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * DlpServiceSettings dlpServiceSettings = dlpServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class DlpServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to inspectContent. */ public UnaryCallSettings inspectContentSettings() { return ((DlpServiceStubSettings) getStubSettings()).inspectContentSettings(); @@ -246,6 +248,11 @@ public UnaryCallSettings deleteJobTriggerSetting return ((DlpServiceStubSettings) getStubSettings()).deleteJobTriggerSettings(); } + /** Returns the object with the settings used for calls to activateJobTrigger. */ + public UnaryCallSettings activateJobTriggerSettings() { + return ((DlpServiceStubSettings) getStubSettings()).activateJobTriggerSettings(); + } + /** Returns the object with the settings used for calls to createDlpJob. */ public UnaryCallSettings createDlpJobSettings() { return ((DlpServiceStubSettings) getStubSettings()).createDlpJobSettings(); @@ -371,18 +378,15 @@ protected DlpServiceSettings(Builder settingsBuilder) throws IOException { /** Builder for DlpServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(DlpServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(DlpServiceStubSettings.newBuilder()); - } - protected Builder(DlpServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -391,11 +395,15 @@ protected Builder(DlpServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(DlpServiceStubSettings.newBuilder()); + } + public DlpServiceStubSettings.Builder getStubSettingsBuilder() { return ((DlpServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -539,6 +547,12 @@ public UnaryCallSettings.Builder deleteJobTrigge return getStubSettingsBuilder().deleteJobTriggerSettings(); } + /** Returns the builder for the settings used for calls to activateJobTrigger. */ + public UnaryCallSettings.Builder + activateJobTriggerSettings() { + return getStubSettingsBuilder().activateJobTriggerSettings(); + } + /** Returns the builder for the settings used for calls to createDlpJob. */ public UnaryCallSettings.Builder createDlpJobSettings() { return getStubSettingsBuilder().createDlpJobSettings(); diff --git a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/package-info.java b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/package-info.java index 714e038f..f4e561b3 100644 --- a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/package-info.java +++ b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/package-info.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -15,11 +15,9 @@ */ /** - * A client to Cloud Data Loss Prevention (DLP) API. + * The interfaces provided are listed below, along with usage samples. * - *

The interfaces provided are listed below, along with usage samples. - * - *

================ DlpServiceClient ================ + *

======================= DlpServiceClient ======================= * *

Service Description: The Cloud Data Loss Prevention (DLP) API is a service that allows clients * to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive @@ -30,17 +28,8 @@ *

To learn more about concepts and find how-to guides see https://cloud.google.com/dlp/docs/. * *

Sample for DlpServiceClient: - * - *

- * 
- * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
- *   String parent = "";
- *   ListInfoTypesResponse response = dlpServiceClient.listInfoTypes(parent);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.dlp.v2; import javax.annotation.Generated; diff --git a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java index 1c964edf..5ac9f40e 100644 --- a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java +++ b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2.stub; import static com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse; @@ -21,9 +22,9 @@ 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; import com.google.api.gax.rpc.UnaryCallable; +import com.google.privacy.dlp.v2.ActivateJobTriggerRequest; import com.google.privacy.dlp.v2.CancelDlpJobRequest; import com.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.CreateDlpJobRequest; @@ -76,14 +77,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Cloud Data Loss Prevention (DLP) API. + * Base stub class for the DlpService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public abstract class DlpServiceStub implements BackgroundResource { public UnaryCallable inspectContentCallable() { @@ -196,6 +196,10 @@ public UnaryCallable deleteJobTriggerCallable() throw new UnsupportedOperationException("Not implemented: deleteJobTriggerCallable()"); } + public UnaryCallable activateJobTriggerCallable() { + throw new UnsupportedOperationException("Not implemented: activateJobTriggerCallable()"); + } + public UnaryCallable createDlpJobCallable() { throw new UnsupportedOperationException("Not implemented: createDlpJobCallable()"); } diff --git a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java index ab1cc368..2d690b87 100644 --- a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java +++ b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/DlpServiceStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2.stub; import static com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse; @@ -47,6 +48,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; +import com.google.privacy.dlp.v2.ActivateJobTriggerRequest; import com.google.privacy.dlp.v2.CancelDlpJobRequest; import com.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.CreateDlpJobRequest; @@ -102,7 +104,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link DlpServiceStub}. * @@ -117,24 +119,23 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of listInfoTypes to 30 seconds: + *

For example, to set the total timeout of inspectContent to 30 seconds: * - *

- * 
- * DlpServiceStubSettings.Builder dlpServiceSettingsBuilder =
- *     DlpServiceStubSettings.newBuilder();
+ * 
{@code
+ * DlpServiceStubSettings.Builder dlpServiceSettingsBuilder = DlpServiceStubSettings.newBuilder();
  * dlpServiceSettingsBuilder
- *     .listInfoTypesSettings()
+ *     .inspectContentSettings()
  *     .setRetrySettings(
- *         dlpServiceSettingsBuilder.listInfoTypesSettings().getRetrySettings().toBuilder()
+ *         dlpServiceSettingsBuilder
+ *             .inspectContentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * DlpServiceStubSettings dlpServiceSettings = dlpServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class DlpServiceStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -184,6 +185,7 @@ public class DlpServiceStubSettings extends StubSettings ListJobTriggersRequest, ListJobTriggersResponse, ListJobTriggersPagedResponse> listJobTriggersSettings; private final UnaryCallSettings deleteJobTriggerSettings; + private final UnaryCallSettings activateJobTriggerSettings; private final UnaryCallSettings createDlpJobSettings; private final PagedCallSettings listDlpJobsSettings; @@ -204,612 +206,617 @@ public class DlpServiceStubSettings extends StubSettings hybridInspectDlpJobSettings; private final UnaryCallSettings finishDlpJobSettings; - /** Returns the object with the settings used for calls to inspectContent. */ - public UnaryCallSettings inspectContentSettings() { - return inspectContentSettings; - } + private static final PagedListDescriptor< + ListInspectTemplatesRequest, ListInspectTemplatesResponse, InspectTemplate> + LIST_INSPECT_TEMPLATES_PAGE_STR_DESC = + new PagedListDescriptor< + ListInspectTemplatesRequest, ListInspectTemplatesResponse, InspectTemplate>() { + @Override + public String emptyToken() { + return ""; + } - /** Returns the object with the settings used for calls to redactImage. */ - public UnaryCallSettings redactImageSettings() { - return redactImageSettings; - } + @Override + public ListInspectTemplatesRequest injectToken( + ListInspectTemplatesRequest payload, String token) { + return ListInspectTemplatesRequest.newBuilder(payload).setPageToken(token).build(); + } - /** Returns the object with the settings used for calls to deidentifyContent. */ - public UnaryCallSettings - deidentifyContentSettings() { - return deidentifyContentSettings; - } + @Override + public ListInspectTemplatesRequest injectPageSize( + ListInspectTemplatesRequest payload, int pageSize) { + return ListInspectTemplatesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } - /** Returns the object with the settings used for calls to reidentifyContent. */ - public UnaryCallSettings - reidentifyContentSettings() { - return reidentifyContentSettings; - } + @Override + public Integer extractPageSize(ListInspectTemplatesRequest payload) { + return payload.getPageSize(); + } - /** Returns the object with the settings used for calls to listInfoTypes. */ - public UnaryCallSettings listInfoTypesSettings() { - return listInfoTypesSettings; - } + @Override + public String extractNextToken(ListInspectTemplatesResponse payload) { + return payload.getNextPageToken(); + } - /** Returns the object with the settings used for calls to createInspectTemplate. */ - public UnaryCallSettings - createInspectTemplateSettings() { - return createInspectTemplateSettings; - } + @Override + public Iterable extractResources( + ListInspectTemplatesResponse payload) { + return payload.getInspectTemplatesList() == null + ? ImmutableList.of() + : payload.getInspectTemplatesList(); + } + }; - /** Returns the object with the settings used for calls to updateInspectTemplate. */ - public UnaryCallSettings - updateInspectTemplateSettings() { - return updateInspectTemplateSettings; - } + private static final PagedListDescriptor< + ListDeidentifyTemplatesRequest, ListDeidentifyTemplatesResponse, DeidentifyTemplate> + LIST_DEIDENTIFY_TEMPLATES_PAGE_STR_DESC = + new PagedListDescriptor< + ListDeidentifyTemplatesRequest, + ListDeidentifyTemplatesResponse, + DeidentifyTemplate>() { + @Override + public String emptyToken() { + return ""; + } - /** Returns the object with the settings used for calls to getInspectTemplate. */ - public UnaryCallSettings - getInspectTemplateSettings() { - return getInspectTemplateSettings; - } + @Override + public ListDeidentifyTemplatesRequest injectToken( + ListDeidentifyTemplatesRequest payload, String token) { + return ListDeidentifyTemplatesRequest.newBuilder(payload).setPageToken(token).build(); + } - /** Returns the object with the settings used for calls to listInspectTemplates. */ - public PagedCallSettings< - ListInspectTemplatesRequest, - ListInspectTemplatesResponse, - ListInspectTemplatesPagedResponse> - listInspectTemplatesSettings() { - return listInspectTemplatesSettings; - } + @Override + public ListDeidentifyTemplatesRequest injectPageSize( + ListDeidentifyTemplatesRequest payload, int pageSize) { + return ListDeidentifyTemplatesRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } - /** Returns the object with the settings used for calls to deleteInspectTemplate. */ - public UnaryCallSettings deleteInspectTemplateSettings() { - return deleteInspectTemplateSettings; - } + @Override + public Integer extractPageSize(ListDeidentifyTemplatesRequest payload) { + return payload.getPageSize(); + } - /** Returns the object with the settings used for calls to createDeidentifyTemplate. */ - public UnaryCallSettings - createDeidentifyTemplateSettings() { - return createDeidentifyTemplateSettings; - } + @Override + public String extractNextToken(ListDeidentifyTemplatesResponse payload) { + return payload.getNextPageToken(); + } - /** Returns the object with the settings used for calls to updateDeidentifyTemplate. */ - public UnaryCallSettings - updateDeidentifyTemplateSettings() { - return updateDeidentifyTemplateSettings; - } + @Override + public Iterable extractResources( + ListDeidentifyTemplatesResponse payload) { + return payload.getDeidentifyTemplatesList() == null + ? ImmutableList.of() + : payload.getDeidentifyTemplatesList(); + } + }; - /** Returns the object with the settings used for calls to getDeidentifyTemplate. */ - public UnaryCallSettings - getDeidentifyTemplateSettings() { - return getDeidentifyTemplateSettings; - } + private static final PagedListDescriptor< + ListJobTriggersRequest, ListJobTriggersResponse, JobTrigger> + LIST_JOB_TRIGGERS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } - /** Returns the object with the settings used for calls to listDeidentifyTemplates. */ - public PagedCallSettings< - ListDeidentifyTemplatesRequest, - ListDeidentifyTemplatesResponse, - ListDeidentifyTemplatesPagedResponse> - listDeidentifyTemplatesSettings() { - return listDeidentifyTemplatesSettings; - } + @Override + public ListJobTriggersRequest injectToken( + ListJobTriggersRequest payload, String token) { + return ListJobTriggersRequest.newBuilder(payload).setPageToken(token).build(); + } - /** Returns the object with the settings used for calls to deleteDeidentifyTemplate. */ - public UnaryCallSettings - deleteDeidentifyTemplateSettings() { - return deleteDeidentifyTemplateSettings; - } + @Override + public ListJobTriggersRequest injectPageSize( + ListJobTriggersRequest payload, int pageSize) { + return ListJobTriggersRequest.newBuilder(payload).setPageSize(pageSize).build(); + } - /** Returns the object with the settings used for calls to createJobTrigger. */ - public UnaryCallSettings createJobTriggerSettings() { - return createJobTriggerSettings; - } + @Override + public Integer extractPageSize(ListJobTriggersRequest payload) { + return payload.getPageSize(); + } - /** Returns the object with the settings used for calls to updateJobTrigger. */ - public UnaryCallSettings updateJobTriggerSettings() { - return updateJobTriggerSettings; - } + @Override + public String extractNextToken(ListJobTriggersResponse payload) { + return payload.getNextPageToken(); + } - /** Returns the object with the settings used for calls to hybridInspectJobTrigger. */ - public UnaryCallSettings - hybridInspectJobTriggerSettings() { - return hybridInspectJobTriggerSettings; - } + @Override + public Iterable extractResources(ListJobTriggersResponse payload) { + return payload.getJobTriggersList() == null + ? ImmutableList.of() + : payload.getJobTriggersList(); + } + }; - /** Returns the object with the settings used for calls to getJobTrigger. */ - public UnaryCallSettings getJobTriggerSettings() { - return getJobTriggerSettings; - } + private static final PagedListDescriptor + LIST_DLP_JOBS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } - /** Returns the object with the settings used for calls to listJobTriggers. */ - public PagedCallSettings< - ListJobTriggersRequest, ListJobTriggersResponse, ListJobTriggersPagedResponse> - listJobTriggersSettings() { - return listJobTriggersSettings; - } + @Override + public ListDlpJobsRequest injectToken(ListDlpJobsRequest payload, String token) { + return ListDlpJobsRequest.newBuilder(payload).setPageToken(token).build(); + } - /** Returns the object with the settings used for calls to deleteJobTrigger. */ - public UnaryCallSettings deleteJobTriggerSettings() { - return deleteJobTriggerSettings; - } + @Override + public ListDlpJobsRequest injectPageSize(ListDlpJobsRequest payload, int pageSize) { + return ListDlpJobsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } - /** Returns the object with the settings used for calls to createDlpJob. */ - public UnaryCallSettings createDlpJobSettings() { - return createDlpJobSettings; - } + @Override + public Integer extractPageSize(ListDlpJobsRequest payload) { + return payload.getPageSize(); + } - /** Returns the object with the settings used for calls to listDlpJobs. */ - public PagedCallSettings - listDlpJobsSettings() { - return listDlpJobsSettings; - } + @Override + public String extractNextToken(ListDlpJobsResponse payload) { + return payload.getNextPageToken(); + } - /** Returns the object with the settings used for calls to getDlpJob. */ - public UnaryCallSettings getDlpJobSettings() { - return getDlpJobSettings; - } + @Override + public Iterable extractResources(ListDlpJobsResponse payload) { + return payload.getJobsList() == null + ? ImmutableList.of() + : payload.getJobsList(); + } + }; - /** Returns the object with the settings used for calls to deleteDlpJob. */ - public UnaryCallSettings deleteDlpJobSettings() { - return deleteDlpJobSettings; - } + private static final PagedListDescriptor< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType> + LIST_STORED_INFO_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType>() { + @Override + public String emptyToken() { + return ""; + } - /** Returns the object with the settings used for calls to cancelDlpJob. */ - public UnaryCallSettings cancelDlpJobSettings() { - return cancelDlpJobSettings; - } + @Override + public ListStoredInfoTypesRequest injectToken( + ListStoredInfoTypesRequest payload, String token) { + return ListStoredInfoTypesRequest.newBuilder(payload).setPageToken(token).build(); + } - /** Returns the object with the settings used for calls to createStoredInfoType. */ - public UnaryCallSettings - createStoredInfoTypeSettings() { - return createStoredInfoTypeSettings; - } + @Override + public ListStoredInfoTypesRequest injectPageSize( + ListStoredInfoTypesRequest payload, int pageSize) { + return ListStoredInfoTypesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } - /** Returns the object with the settings used for calls to updateStoredInfoType. */ - public UnaryCallSettings - updateStoredInfoTypeSettings() { - return updateStoredInfoTypeSettings; - } + @Override + public Integer extractPageSize(ListStoredInfoTypesRequest payload) { + return payload.getPageSize(); + } - /** Returns the object with the settings used for calls to getStoredInfoType. */ - public UnaryCallSettings getStoredInfoTypeSettings() { - return getStoredInfoTypeSettings; - } + @Override + public String extractNextToken(ListStoredInfoTypesResponse payload) { + return payload.getNextPageToken(); + } - /** Returns the object with the settings used for calls to listStoredInfoTypes. */ - public PagedCallSettings< + @Override + public Iterable extractResources(ListStoredInfoTypesResponse payload) { + return payload.getStoredInfoTypesList() == null + ? ImmutableList.of() + : payload.getStoredInfoTypesList(); + } + }; + + private static final PagedListResponseFactory< + ListInspectTemplatesRequest, + ListInspectTemplatesResponse, + ListInspectTemplatesPagedResponse> + LIST_INSPECT_TEMPLATES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInspectTemplatesRequest, + ListInspectTemplatesResponse, + ListInspectTemplatesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListInspectTemplatesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInspectTemplatesRequest, ListInspectTemplatesResponse, InspectTemplate> + pageContext = + PageContext.create( + callable, LIST_INSPECT_TEMPLATES_PAGE_STR_DESC, request, context); + return ListInspectTemplatesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListDeidentifyTemplatesRequest, + ListDeidentifyTemplatesResponse, + ListDeidentifyTemplatesPagedResponse> + LIST_DEIDENTIFY_TEMPLATES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListDeidentifyTemplatesRequest, + ListDeidentifyTemplatesResponse, + ListDeidentifyTemplatesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListDeidentifyTemplatesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListDeidentifyTemplatesRequest, + ListDeidentifyTemplatesResponse, + DeidentifyTemplate> + pageContext = + PageContext.create( + callable, LIST_DEIDENTIFY_TEMPLATES_PAGE_STR_DESC, request, context); + return ListDeidentifyTemplatesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListJobTriggersRequest, ListJobTriggersResponse, ListJobTriggersPagedResponse> + LIST_JOB_TRIGGERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListJobTriggersRequest, ListJobTriggersResponse, ListJobTriggersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListJobTriggersRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_JOB_TRIGGERS_PAGE_STR_DESC, request, context); + return ListJobTriggersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListDlpJobsRequest, ListDlpJobsResponse, ListDlpJobsPagedResponse> + LIST_DLP_JOBS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListDlpJobsRequest, ListDlpJobsResponse, ListDlpJobsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListDlpJobsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_DLP_JOBS_PAGE_STR_DESC, request, context); + return ListDlpJobsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, ListStoredInfoTypesPagedResponse> - listStoredInfoTypesSettings() { - return listStoredInfoTypesSettings; + 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); + } + }; + + /** Returns the object with the settings used for calls to inspectContent. */ + public UnaryCallSettings inspectContentSettings() { + return inspectContentSettings; } - /** Returns the object with the settings used for calls to deleteStoredInfoType. */ - public UnaryCallSettings deleteStoredInfoTypeSettings() { - return deleteStoredInfoTypeSettings; + /** Returns the object with the settings used for calls to redactImage. */ + public UnaryCallSettings redactImageSettings() { + return redactImageSettings; } - /** Returns the object with the settings used for calls to hybridInspectDlpJob. */ - public UnaryCallSettings - hybridInspectDlpJobSettings() { - return hybridInspectDlpJobSettings; + /** Returns the object with the settings used for calls to deidentifyContent. */ + public UnaryCallSettings + deidentifyContentSettings() { + return deidentifyContentSettings; } - /** Returns the object with the settings used for calls to finishDlpJob. */ - public UnaryCallSettings finishDlpJobSettings() { - return finishDlpJobSettings; + /** Returns the object with the settings used for calls to reidentifyContent. */ + public UnaryCallSettings + reidentifyContentSettings() { + return reidentifyContentSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public DlpServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcDlpServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); - } + /** Returns the object with the settings used for calls to listInfoTypes. */ + public UnaryCallSettings listInfoTypesSettings() { + return listInfoTypesSettings; } - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); + /** Returns the object with the settings used for calls to createInspectTemplate. */ + public UnaryCallSettings + createInspectTemplateSettings() { + return createInspectTemplateSettings; } - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "dlp.googleapis.com:443"; + /** Returns the object with the settings used for calls to updateInspectTemplate. */ + public UnaryCallSettings + updateInspectTemplateSettings() { + return updateInspectTemplateSettings; } - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; + /** Returns the object with the settings used for calls to getInspectTemplate. */ + public UnaryCallSettings + getInspectTemplateSettings() { + return getInspectTemplateSettings; } - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + /** Returns the object with the settings used for calls to listInspectTemplates. */ + public PagedCallSettings< + ListInspectTemplatesRequest, + ListInspectTemplatesResponse, + ListInspectTemplatesPagedResponse> + listInspectTemplatesSettings() { + return listInspectTemplatesSettings; } - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); + /** Returns the object with the settings used for calls to deleteInspectTemplate. */ + public UnaryCallSettings deleteInspectTemplateSettings() { + return deleteInspectTemplateSettings; } - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); + /** Returns the object with the settings used for calls to createDeidentifyTemplate. */ + public UnaryCallSettings + createDeidentifyTemplateSettings() { + return createDeidentifyTemplateSettings; } - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(DlpServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + /** Returns the object with the settings used for calls to updateDeidentifyTemplate. */ + public UnaryCallSettings + updateDeidentifyTemplateSettings() { + return updateDeidentifyTemplateSettings; } - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); + /** Returns the object with the settings used for calls to getDeidentifyTemplate. */ + public UnaryCallSettings + getDeidentifyTemplateSettings() { + return getDeidentifyTemplateSettings; } - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); + /** Returns the object with the settings used for calls to listDeidentifyTemplates. */ + public PagedCallSettings< + ListDeidentifyTemplatesRequest, + ListDeidentifyTemplatesResponse, + ListDeidentifyTemplatesPagedResponse> + listDeidentifyTemplatesSettings() { + return listDeidentifyTemplatesSettings; } - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); + /** Returns the object with the settings used for calls to deleteDeidentifyTemplate. */ + public UnaryCallSettings + deleteDeidentifyTemplateSettings() { + return deleteDeidentifyTemplateSettings; } - protected DlpServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - inspectContentSettings = settingsBuilder.inspectContentSettings().build(); - redactImageSettings = settingsBuilder.redactImageSettings().build(); - deidentifyContentSettings = settingsBuilder.deidentifyContentSettings().build(); - reidentifyContentSettings = settingsBuilder.reidentifyContentSettings().build(); - listInfoTypesSettings = settingsBuilder.listInfoTypesSettings().build(); - createInspectTemplateSettings = settingsBuilder.createInspectTemplateSettings().build(); - updateInspectTemplateSettings = settingsBuilder.updateInspectTemplateSettings().build(); - getInspectTemplateSettings = settingsBuilder.getInspectTemplateSettings().build(); - listInspectTemplatesSettings = settingsBuilder.listInspectTemplatesSettings().build(); - deleteInspectTemplateSettings = settingsBuilder.deleteInspectTemplateSettings().build(); - createDeidentifyTemplateSettings = settingsBuilder.createDeidentifyTemplateSettings().build(); - updateDeidentifyTemplateSettings = settingsBuilder.updateDeidentifyTemplateSettings().build(); - getDeidentifyTemplateSettings = settingsBuilder.getDeidentifyTemplateSettings().build(); - listDeidentifyTemplatesSettings = settingsBuilder.listDeidentifyTemplatesSettings().build(); - deleteDeidentifyTemplateSettings = settingsBuilder.deleteDeidentifyTemplateSettings().build(); - createJobTriggerSettings = settingsBuilder.createJobTriggerSettings().build(); - updateJobTriggerSettings = settingsBuilder.updateJobTriggerSettings().build(); - hybridInspectJobTriggerSettings = settingsBuilder.hybridInspectJobTriggerSettings().build(); - getJobTriggerSettings = settingsBuilder.getJobTriggerSettings().build(); - listJobTriggersSettings = settingsBuilder.listJobTriggersSettings().build(); - deleteJobTriggerSettings = settingsBuilder.deleteJobTriggerSettings().build(); - createDlpJobSettings = settingsBuilder.createDlpJobSettings().build(); - listDlpJobsSettings = settingsBuilder.listDlpJobsSettings().build(); - getDlpJobSettings = settingsBuilder.getDlpJobSettings().build(); - deleteDlpJobSettings = settingsBuilder.deleteDlpJobSettings().build(); - cancelDlpJobSettings = settingsBuilder.cancelDlpJobSettings().build(); - createStoredInfoTypeSettings = settingsBuilder.createStoredInfoTypeSettings().build(); - updateStoredInfoTypeSettings = settingsBuilder.updateStoredInfoTypeSettings().build(); - getStoredInfoTypeSettings = settingsBuilder.getStoredInfoTypeSettings().build(); - listStoredInfoTypesSettings = settingsBuilder.listStoredInfoTypesSettings().build(); - deleteStoredInfoTypeSettings = settingsBuilder.deleteStoredInfoTypeSettings().build(); - hybridInspectDlpJobSettings = settingsBuilder.hybridInspectDlpJobSettings().build(); - finishDlpJobSettings = settingsBuilder.finishDlpJobSettings().build(); + /** Returns the object with the settings used for calls to createJobTrigger. */ + public UnaryCallSettings createJobTriggerSettings() { + return createJobTriggerSettings; } - private static final PagedListDescriptor< - ListInspectTemplatesRequest, ListInspectTemplatesResponse, InspectTemplate> - LIST_INSPECT_TEMPLATES_PAGE_STR_DESC = - new PagedListDescriptor< - ListInspectTemplatesRequest, ListInspectTemplatesResponse, InspectTemplate>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListInspectTemplatesRequest injectToken( - ListInspectTemplatesRequest payload, String token) { - return ListInspectTemplatesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListInspectTemplatesRequest injectPageSize( - ListInspectTemplatesRequest payload, int pageSize) { - return ListInspectTemplatesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListInspectTemplatesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListInspectTemplatesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - ListInspectTemplatesResponse payload) { - return payload.getInspectTemplatesList() != null - ? payload.getInspectTemplatesList() - : ImmutableList.of(); - } - }; - - private static final PagedListDescriptor< - ListDeidentifyTemplatesRequest, ListDeidentifyTemplatesResponse, DeidentifyTemplate> - LIST_DEIDENTIFY_TEMPLATES_PAGE_STR_DESC = - new PagedListDescriptor< - ListDeidentifyTemplatesRequest, - ListDeidentifyTemplatesResponse, - DeidentifyTemplate>() { - @Override - public String emptyToken() { - return ""; - } + /** Returns the object with the settings used for calls to updateJobTrigger. */ + public UnaryCallSettings updateJobTriggerSettings() { + return updateJobTriggerSettings; + } - @Override - public ListDeidentifyTemplatesRequest injectToken( - ListDeidentifyTemplatesRequest payload, String token) { - return ListDeidentifyTemplatesRequest.newBuilder(payload).setPageToken(token).build(); - } + /** Returns the object with the settings used for calls to hybridInspectJobTrigger. */ + public UnaryCallSettings + hybridInspectJobTriggerSettings() { + return hybridInspectJobTriggerSettings; + } - @Override - public ListDeidentifyTemplatesRequest injectPageSize( - ListDeidentifyTemplatesRequest payload, int pageSize) { - return ListDeidentifyTemplatesRequest.newBuilder(payload) - .setPageSize(pageSize) - .build(); - } + /** Returns the object with the settings used for calls to getJobTrigger. */ + public UnaryCallSettings getJobTriggerSettings() { + return getJobTriggerSettings; + } - @Override - public Integer extractPageSize(ListDeidentifyTemplatesRequest payload) { - return payload.getPageSize(); - } + /** Returns the object with the settings used for calls to listJobTriggers. */ + public PagedCallSettings< + ListJobTriggersRequest, ListJobTriggersResponse, ListJobTriggersPagedResponse> + listJobTriggersSettings() { + return listJobTriggersSettings; + } - @Override - public String extractNextToken(ListDeidentifyTemplatesResponse payload) { - return payload.getNextPageToken(); - } + /** Returns the object with the settings used for calls to deleteJobTrigger. */ + public UnaryCallSettings deleteJobTriggerSettings() { + return deleteJobTriggerSettings; + } - @Override - public Iterable extractResources( - ListDeidentifyTemplatesResponse payload) { - return payload.getDeidentifyTemplatesList() != null - ? payload.getDeidentifyTemplatesList() - : ImmutableList.of(); - } - }; + /** Returns the object with the settings used for calls to activateJobTrigger. */ + public UnaryCallSettings activateJobTriggerSettings() { + return activateJobTriggerSettings; + } - private static final PagedListDescriptor< - ListJobTriggersRequest, ListJobTriggersResponse, JobTrigger> - LIST_JOB_TRIGGERS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } + /** Returns the object with the settings used for calls to createDlpJob. */ + public UnaryCallSettings createDlpJobSettings() { + return createDlpJobSettings; + } - @Override - public ListJobTriggersRequest injectToken( - ListJobTriggersRequest payload, String token) { - return ListJobTriggersRequest.newBuilder(payload).setPageToken(token).build(); - } + /** Returns the object with the settings used for calls to listDlpJobs. */ + public PagedCallSettings + listDlpJobsSettings() { + return listDlpJobsSettings; + } - @Override - public ListJobTriggersRequest injectPageSize( - ListJobTriggersRequest payload, int pageSize) { - return ListJobTriggersRequest.newBuilder(payload).setPageSize(pageSize).build(); - } + /** Returns the object with the settings used for calls to getDlpJob. */ + public UnaryCallSettings getDlpJobSettings() { + return getDlpJobSettings; + } - @Override - public Integer extractPageSize(ListJobTriggersRequest payload) { - return payload.getPageSize(); - } + /** Returns the object with the settings used for calls to deleteDlpJob. */ + public UnaryCallSettings deleteDlpJobSettings() { + return deleteDlpJobSettings; + } - @Override - public String extractNextToken(ListJobTriggersResponse payload) { - return payload.getNextPageToken(); - } + /** Returns the object with the settings used for calls to cancelDlpJob. */ + public UnaryCallSettings cancelDlpJobSettings() { + return cancelDlpJobSettings; + } - @Override - public Iterable extractResources(ListJobTriggersResponse payload) { - return payload.getJobTriggersList() != null - ? payload.getJobTriggersList() - : ImmutableList.of(); - } - }; + /** Returns the object with the settings used for calls to createStoredInfoType. */ + public UnaryCallSettings + createStoredInfoTypeSettings() { + return createStoredInfoTypeSettings; + } - private static final PagedListDescriptor - LIST_DLP_JOBS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } + /** Returns the object with the settings used for calls to updateStoredInfoType. */ + public UnaryCallSettings + updateStoredInfoTypeSettings() { + return updateStoredInfoTypeSettings; + } - @Override - public ListDlpJobsRequest injectToken(ListDlpJobsRequest payload, String token) { - return ListDlpJobsRequest.newBuilder(payload).setPageToken(token).build(); - } + /** Returns the object with the settings used for calls to getStoredInfoType. */ + public UnaryCallSettings getStoredInfoTypeSettings() { + return getStoredInfoTypeSettings; + } - @Override - public ListDlpJobsRequest injectPageSize(ListDlpJobsRequest payload, int pageSize) { - return ListDlpJobsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } + /** Returns the object with the settings used for calls to listStoredInfoTypes. */ + public PagedCallSettings< + ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, ListStoredInfoTypesPagedResponse> + listStoredInfoTypesSettings() { + return listStoredInfoTypesSettings; + } - @Override - public Integer extractPageSize(ListDlpJobsRequest payload) { - return payload.getPageSize(); - } + /** Returns the object with the settings used for calls to deleteStoredInfoType. */ + public UnaryCallSettings deleteStoredInfoTypeSettings() { + return deleteStoredInfoTypeSettings; + } - @Override - public String extractNextToken(ListDlpJobsResponse payload) { - return payload.getNextPageToken(); - } + /** Returns the object with the settings used for calls to hybridInspectDlpJob. */ + public UnaryCallSettings + hybridInspectDlpJobSettings() { + return hybridInspectDlpJobSettings; + } - @Override - public Iterable extractResources(ListDlpJobsResponse payload) { - return payload.getJobsList() != null - ? payload.getJobsList() - : ImmutableList.of(); - } - }; + /** Returns the object with the settings used for calls to finishDlpJob. */ + public UnaryCallSettings finishDlpJobSettings() { + return finishDlpJobSettings; + } - private static final PagedListDescriptor< - ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType> - LIST_STORED_INFO_TYPES_PAGE_STR_DESC = - new PagedListDescriptor< - ListStoredInfoTypesRequest, ListStoredInfoTypesResponse, StoredInfoType>() { - @Override - public String emptyToken() { - return ""; - } + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DlpServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcDlpServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } - @Override - public ListStoredInfoTypesRequest injectToken( - ListStoredInfoTypesRequest payload, String token) { - return ListStoredInfoTypesRequest.newBuilder(payload).setPageToken(token).build(); - } + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } - @Override - public ListStoredInfoTypesRequest injectPageSize( - ListStoredInfoTypesRequest payload, int pageSize) { - return ListStoredInfoTypesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "dlp.googleapis.com:443"; + } - @Override - public Integer extractPageSize(ListStoredInfoTypesRequest payload) { - return payload.getPageSize(); - } + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } - @Override - public String extractNextToken(ListStoredInfoTypesResponse payload) { - return payload.getNextPageToken(); - } + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } - @Override - public Iterable extractResources(ListStoredInfoTypesResponse payload) { - return payload.getStoredInfoTypesList() != null - ? payload.getStoredInfoTypesList() - : ImmutableList.of(); - } - }; + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } - private static final PagedListResponseFactory< - ListInspectTemplatesRequest, - ListInspectTemplatesResponse, - ListInspectTemplatesPagedResponse> - LIST_INSPECT_TEMPLATES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListInspectTemplatesRequest, - ListInspectTemplatesResponse, - ListInspectTemplatesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListInspectTemplatesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListInspectTemplatesRequest, ListInspectTemplatesResponse, InspectTemplate> - pageContext = - PageContext.create( - callable, LIST_INSPECT_TEMPLATES_PAGE_STR_DESC, request, context); - return ListInspectTemplatesPagedResponse.createAsync(pageContext, futureResponse); - } - }; + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } - private static final PagedListResponseFactory< - ListDeidentifyTemplatesRequest, - ListDeidentifyTemplatesResponse, - ListDeidentifyTemplatesPagedResponse> - LIST_DEIDENTIFY_TEMPLATES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListDeidentifyTemplatesRequest, - ListDeidentifyTemplatesResponse, - ListDeidentifyTemplatesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable - callable, - ListDeidentifyTemplatesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListDeidentifyTemplatesRequest, - ListDeidentifyTemplatesResponse, - DeidentifyTemplate> - pageContext = - PageContext.create( - callable, LIST_DEIDENTIFY_TEMPLATES_PAGE_STR_DESC, request, context); - return ListDeidentifyTemplatesPagedResponse.createAsync(pageContext, futureResponse); - } - }; + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(DlpServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } - private static final PagedListResponseFactory< - ListJobTriggersRequest, ListJobTriggersResponse, ListJobTriggersPagedResponse> - LIST_JOB_TRIGGERS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListJobTriggersRequest, ListJobTriggersResponse, ListJobTriggersPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListJobTriggersRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_JOB_TRIGGERS_PAGE_STR_DESC, request, context); - return ListJobTriggersPagedResponse.createAsync(pageContext, futureResponse); - } - }; + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } - private static final PagedListResponseFactory< - ListDlpJobsRequest, ListDlpJobsResponse, ListDlpJobsPagedResponse> - LIST_DLP_JOBS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListDlpJobsRequest, ListDlpJobsResponse, ListDlpJobsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListDlpJobsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_DLP_JOBS_PAGE_STR_DESC, request, context); - return ListDlpJobsPagedResponse.createAsync(pageContext, futureResponse); - } - }; + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } - 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); - } - }; + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DlpServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + inspectContentSettings = settingsBuilder.inspectContentSettings().build(); + redactImageSettings = settingsBuilder.redactImageSettings().build(); + deidentifyContentSettings = settingsBuilder.deidentifyContentSettings().build(); + reidentifyContentSettings = settingsBuilder.reidentifyContentSettings().build(); + listInfoTypesSettings = settingsBuilder.listInfoTypesSettings().build(); + createInspectTemplateSettings = settingsBuilder.createInspectTemplateSettings().build(); + updateInspectTemplateSettings = settingsBuilder.updateInspectTemplateSettings().build(); + getInspectTemplateSettings = settingsBuilder.getInspectTemplateSettings().build(); + listInspectTemplatesSettings = settingsBuilder.listInspectTemplatesSettings().build(); + deleteInspectTemplateSettings = settingsBuilder.deleteInspectTemplateSettings().build(); + createDeidentifyTemplateSettings = settingsBuilder.createDeidentifyTemplateSettings().build(); + updateDeidentifyTemplateSettings = settingsBuilder.updateDeidentifyTemplateSettings().build(); + getDeidentifyTemplateSettings = settingsBuilder.getDeidentifyTemplateSettings().build(); + listDeidentifyTemplatesSettings = settingsBuilder.listDeidentifyTemplatesSettings().build(); + deleteDeidentifyTemplateSettings = settingsBuilder.deleteDeidentifyTemplateSettings().build(); + createJobTriggerSettings = settingsBuilder.createJobTriggerSettings().build(); + updateJobTriggerSettings = settingsBuilder.updateJobTriggerSettings().build(); + hybridInspectJobTriggerSettings = settingsBuilder.hybridInspectJobTriggerSettings().build(); + getJobTriggerSettings = settingsBuilder.getJobTriggerSettings().build(); + listJobTriggersSettings = settingsBuilder.listJobTriggersSettings().build(); + deleteJobTriggerSettings = settingsBuilder.deleteJobTriggerSettings().build(); + activateJobTriggerSettings = settingsBuilder.activateJobTriggerSettings().build(); + createDlpJobSettings = settingsBuilder.createDlpJobSettings().build(); + listDlpJobsSettings = settingsBuilder.listDlpJobsSettings().build(); + getDlpJobSettings = settingsBuilder.getDlpJobSettings().build(); + deleteDlpJobSettings = settingsBuilder.deleteDlpJobSettings().build(); + cancelDlpJobSettings = settingsBuilder.cancelDlpJobSettings().build(); + createStoredInfoTypeSettings = settingsBuilder.createStoredInfoTypeSettings().build(); + updateStoredInfoTypeSettings = settingsBuilder.updateStoredInfoTypeSettings().build(); + getStoredInfoTypeSettings = settingsBuilder.getStoredInfoTypeSettings().build(); + listStoredInfoTypesSettings = settingsBuilder.listStoredInfoTypesSettings().build(); + deleteStoredInfoTypeSettings = settingsBuilder.deleteStoredInfoTypeSettings().build(); + hybridInspectDlpJobSettings = settingsBuilder.hybridInspectDlpJobSettings().build(); + finishDlpJobSettings = settingsBuilder.finishDlpJobSettings().build(); + } /** Builder for DlpServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder inspectContentSettings; private final UnaryCallSettings.Builder @@ -858,6 +865,8 @@ public static class Builder extends StubSettings.Builder deleteJobTriggerSettings; + private final UnaryCallSettings.Builder + activateJobTriggerSettings; private final UnaryCallSettings.Builder createDlpJobSettings; private final PagedCallSettings.Builder< ListDlpJobsRequest, ListDlpJobsResponse, ListDlpJobsPagedResponse> @@ -881,7 +890,6 @@ public static class Builder extends StubSettings.Builder hybridInspectDlpJobSettings; private final UnaryCallSettings.Builder finishDlpJobSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -889,11 +897,10 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); @@ -914,9 +921,7 @@ public static class Builder extends StubSettings.Builder>of( + inspectContentSettings, + redactImageSettings, + deidentifyContentSettings, + reidentifyContentSettings, + listInfoTypesSettings, + createInspectTemplateSettings, + updateInspectTemplateSettings, + getInspectTemplateSettings, + listInspectTemplatesSettings, + deleteInspectTemplateSettings, + createDeidentifyTemplateSettings, + updateDeidentifyTemplateSettings, + getDeidentifyTemplateSettings, + listDeidentifyTemplatesSettings, + deleteDeidentifyTemplateSettings, + createJobTriggerSettings, + updateJobTriggerSettings, + hybridInspectJobTriggerSettings, + getJobTriggerSettings, + listJobTriggersSettings, + deleteJobTriggerSettings, + activateJobTriggerSettings, + createDlpJobSettings, + listDlpJobsSettings, + getDlpJobSettings, + deleteDlpJobSettings, + cancelDlpJobSettings, + createStoredInfoTypeSettings, + updateStoredInfoTypeSettings, + getStoredInfoTypeSettings, + listStoredInfoTypesSettings, + deleteStoredInfoTypeSettings, + hybridInspectDlpJobSettings, + finishDlpJobSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .inspectContentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .redactImageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deidentifyContentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .reidentifyContentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listInfoTypesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createInspectTemplateSettings() @@ -1091,18 +1142,18 @@ private static Builder initDefaults(Builder builder) { builder .getInspectTemplateSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listInspectTemplatesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteInspectTemplateSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createDeidentifyTemplateSettings() @@ -1116,18 +1167,18 @@ private static Builder initDefaults(Builder builder) { builder .getDeidentifyTemplateSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listDeidentifyTemplatesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteDeidentifyTemplateSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createJobTriggerSettings() @@ -1146,18 +1197,23 @@ private static Builder initDefaults(Builder builder) { builder .getJobTriggerSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listJobTriggersSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteJobTriggerSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .activateJobTriggerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .createDlpJobSettings() @@ -1166,18 +1222,18 @@ private static Builder initDefaults(Builder builder) { builder .listDlpJobsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getDlpJobSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteDlpJobSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .cancelDlpJobSettings() @@ -1196,18 +1252,18 @@ private static Builder initDefaults(Builder builder) { builder .getStoredInfoTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listStoredInfoTypesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteStoredInfoTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .hybridInspectDlpJobSettings() @@ -1222,81 +1278,7 @@ private static Builder initDefaults(Builder builder) { return builder; } - protected Builder(DlpServiceStubSettings settings) { - super(settings); - - inspectContentSettings = settings.inspectContentSettings.toBuilder(); - redactImageSettings = settings.redactImageSettings.toBuilder(); - deidentifyContentSettings = settings.deidentifyContentSettings.toBuilder(); - reidentifyContentSettings = settings.reidentifyContentSettings.toBuilder(); - listInfoTypesSettings = settings.listInfoTypesSettings.toBuilder(); - createInspectTemplateSettings = settings.createInspectTemplateSettings.toBuilder(); - updateInspectTemplateSettings = settings.updateInspectTemplateSettings.toBuilder(); - getInspectTemplateSettings = settings.getInspectTemplateSettings.toBuilder(); - listInspectTemplatesSettings = settings.listInspectTemplatesSettings.toBuilder(); - deleteInspectTemplateSettings = settings.deleteInspectTemplateSettings.toBuilder(); - createDeidentifyTemplateSettings = settings.createDeidentifyTemplateSettings.toBuilder(); - updateDeidentifyTemplateSettings = settings.updateDeidentifyTemplateSettings.toBuilder(); - getDeidentifyTemplateSettings = settings.getDeidentifyTemplateSettings.toBuilder(); - listDeidentifyTemplatesSettings = settings.listDeidentifyTemplatesSettings.toBuilder(); - deleteDeidentifyTemplateSettings = settings.deleteDeidentifyTemplateSettings.toBuilder(); - createJobTriggerSettings = settings.createJobTriggerSettings.toBuilder(); - updateJobTriggerSettings = settings.updateJobTriggerSettings.toBuilder(); - hybridInspectJobTriggerSettings = settings.hybridInspectJobTriggerSettings.toBuilder(); - getJobTriggerSettings = settings.getJobTriggerSettings.toBuilder(); - listJobTriggersSettings = settings.listJobTriggersSettings.toBuilder(); - deleteJobTriggerSettings = settings.deleteJobTriggerSettings.toBuilder(); - createDlpJobSettings = settings.createDlpJobSettings.toBuilder(); - listDlpJobsSettings = settings.listDlpJobsSettings.toBuilder(); - getDlpJobSettings = settings.getDlpJobSettings.toBuilder(); - deleteDlpJobSettings = settings.deleteDlpJobSettings.toBuilder(); - cancelDlpJobSettings = settings.cancelDlpJobSettings.toBuilder(); - createStoredInfoTypeSettings = settings.createStoredInfoTypeSettings.toBuilder(); - updateStoredInfoTypeSettings = settings.updateStoredInfoTypeSettings.toBuilder(); - getStoredInfoTypeSettings = settings.getStoredInfoTypeSettings.toBuilder(); - listStoredInfoTypesSettings = settings.listStoredInfoTypesSettings.toBuilder(); - deleteStoredInfoTypeSettings = settings.deleteStoredInfoTypeSettings.toBuilder(); - hybridInspectDlpJobSettings = settings.hybridInspectDlpJobSettings.toBuilder(); - finishDlpJobSettings = settings.finishDlpJobSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - inspectContentSettings, - redactImageSettings, - deidentifyContentSettings, - reidentifyContentSettings, - listInfoTypesSettings, - createInspectTemplateSettings, - updateInspectTemplateSettings, - getInspectTemplateSettings, - listInspectTemplatesSettings, - deleteInspectTemplateSettings, - createDeidentifyTemplateSettings, - updateDeidentifyTemplateSettings, - getDeidentifyTemplateSettings, - listDeidentifyTemplatesSettings, - deleteDeidentifyTemplateSettings, - createJobTriggerSettings, - updateJobTriggerSettings, - hybridInspectJobTriggerSettings, - getJobTriggerSettings, - listJobTriggersSettings, - deleteJobTriggerSettings, - createDlpJobSettings, - listDlpJobsSettings, - getDlpJobSettings, - deleteDlpJobSettings, - cancelDlpJobSettings, - createStoredInfoTypeSettings, - updateStoredInfoTypeSettings, - getStoredInfoTypeSettings, - listStoredInfoTypesSettings, - deleteStoredInfoTypeSettings, - hybridInspectDlpJobSettings, - finishDlpJobSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -1443,6 +1425,12 @@ public UnaryCallSettings.Builder deleteJobTrigge return deleteJobTriggerSettings; } + /** Returns the builder for the settings used for calls to activateJobTrigger. */ + public UnaryCallSettings.Builder + activateJobTriggerSettings() { + return activateJobTriggerSettings; + } + /** Returns the builder for the settings used for calls to createDlpJob. */ public UnaryCallSettings.Builder createDlpJobSettings() { return createDlpJobSettings; diff --git a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceCallableFactory.java b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceCallableFactory.java index cff33469..3e24d821 100644 --- a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceCallableFactory.java +++ b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Cloud Data Loss Prevention (DLP) API. + * gRPC callable factory implementation for the DlpService service API. * *

This class is for advanced usage. */ -@Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +@Generated("by gapic-generator-java") public class GrpcDlpServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java index ab0fa527..a7f8c8f6 100644 --- a/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java +++ b/google-cloud-dlp/src/main/java/com/google/cloud/dlp/v2/stub/GrpcDlpServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2.stub; import static com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse; @@ -21,7 +22,6 @@ 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; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -30,6 +30,8 @@ import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.privacy.dlp.v2.ActivateJobTriggerRequest; import com.google.privacy.dlp.v2.CancelDlpJobRequest; import com.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.CreateDlpJobRequest; @@ -87,16 +89,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Cloud Data Loss Prevention (DLP) API. + * gRPC stub implementation for the DlpService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcDlpServiceStub extends DlpServiceStub { - private static final MethodDescriptor inspectContentMethodDescriptor = MethodDescriptor.newBuilder() @@ -107,6 +107,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(InspectContentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor redactImageMethodDescriptor = MethodDescriptor.newBuilder() @@ -116,6 +117,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(RedactImageResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor deidentifyContentMethodDescriptor = MethodDescriptor.newBuilder() @@ -126,6 +128,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(DeidentifyContentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor reidentifyContentMethodDescriptor = MethodDescriptor.newBuilder() @@ -136,6 +139,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ReidentifyContentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor listInfoTypesMethodDescriptor = MethodDescriptor.newBuilder() @@ -146,6 +150,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListInfoTypesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor createInspectTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -155,6 +160,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(CreateInspectTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(InspectTemplate.getDefaultInstance())) .build(); + private static final MethodDescriptor updateInspectTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -164,6 +170,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(UpdateInspectTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(InspectTemplate.getDefaultInstance())) .build(); + private static final MethodDescriptor getInspectTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -173,6 +180,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(GetInspectTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(InspectTemplate.getDefaultInstance())) .build(); + private static final MethodDescriptor listInspectTemplatesMethodDescriptor = MethodDescriptor.newBuilder() @@ -183,6 +191,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListInspectTemplatesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteInspectTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -192,6 +201,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(DeleteInspectTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor createDeidentifyTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -201,6 +211,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(CreateDeidentifyTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(DeidentifyTemplate.getDefaultInstance())) .build(); + private static final MethodDescriptor updateDeidentifyTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -210,6 +221,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(UpdateDeidentifyTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(DeidentifyTemplate.getDefaultInstance())) .build(); + private static final MethodDescriptor getDeidentifyTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -219,6 +231,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(GetDeidentifyTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(DeidentifyTemplate.getDefaultInstance())) .build(); + private static final MethodDescriptor< ListDeidentifyTemplatesRequest, ListDeidentifyTemplatesResponse> listDeidentifyTemplatesMethodDescriptor = @@ -231,6 +244,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListDeidentifyTemplatesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteDeidentifyTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -240,6 +254,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(DeleteDeidentifyTemplateRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor createJobTriggerMethodDescriptor = MethodDescriptor.newBuilder() @@ -249,6 +264,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(CreateJobTriggerRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(JobTrigger.getDefaultInstance())) .build(); + private static final MethodDescriptor updateJobTriggerMethodDescriptor = MethodDescriptor.newBuilder() @@ -258,6 +274,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(UpdateJobTriggerRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(JobTrigger.getDefaultInstance())) .build(); + private static final MethodDescriptor hybridInspectJobTriggerMethodDescriptor = MethodDescriptor.newBuilder() @@ -268,6 +285,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(HybridInspectResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getJobTriggerMethodDescriptor = MethodDescriptor.newBuilder() @@ -277,6 +295,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(GetJobTriggerRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(JobTrigger.getDefaultInstance())) .build(); + private static final MethodDescriptor listJobTriggersMethodDescriptor = MethodDescriptor.newBuilder() @@ -287,6 +306,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListJobTriggersResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteJobTriggerMethodDescriptor = MethodDescriptor.newBuilder() @@ -296,6 +316,17 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(DeleteJobTriggerRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + + private static final MethodDescriptor + activateJobTriggerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.privacy.dlp.v2.DlpService/ActivateJobTrigger") + .setRequestMarshaller( + ProtoUtils.marshaller(ActivateJobTriggerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(DlpJob.getDefaultInstance())) + .build(); + private static final MethodDescriptor createDlpJobMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -303,6 +334,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateDlpJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(DlpJob.getDefaultInstance())) .build(); + private static final MethodDescriptor listDlpJobsMethodDescriptor = MethodDescriptor.newBuilder() @@ -312,6 +344,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListDlpJobsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getDlpJobMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -319,6 +352,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(GetDlpJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(DlpJob.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteDlpJobMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -326,6 +360,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteDlpJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor cancelDlpJobMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -333,6 +368,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(CancelDlpJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor createStoredInfoTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -342,6 +378,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(CreateStoredInfoTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(StoredInfoType.getDefaultInstance())) .build(); + private static final MethodDescriptor updateStoredInfoTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -351,6 +388,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(UpdateStoredInfoTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(StoredInfoType.getDefaultInstance())) .build(); + private static final MethodDescriptor getStoredInfoTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -360,6 +398,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(GetStoredInfoTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(StoredInfoType.getDefaultInstance())) .build(); + private static final MethodDescriptor listStoredInfoTypesMethodDescriptor = MethodDescriptor.newBuilder() @@ -370,6 +409,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListStoredInfoTypesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteStoredInfoTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -379,6 +419,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { ProtoUtils.marshaller(DeleteStoredInfoTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor hybridInspectDlpJobMethodDescriptor = MethodDescriptor.newBuilder() @@ -389,6 +430,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(HybridInspectResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor finishDlpJobMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -397,8 +439,6 @@ public class GrpcDlpServiceStub extends DlpServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable inspectContentCallable; private final UnaryCallable redactImageCallable; private final UnaryCallable @@ -439,6 +479,7 @@ public class GrpcDlpServiceStub extends DlpServiceStub { private final UnaryCallable listJobTriggersPagedCallable; private final UnaryCallable deleteJobTriggerCallable; + private final UnaryCallable activateJobTriggerCallable; private final UnaryCallable createDlpJobCallable; private final UnaryCallable listDlpJobsCallable; private final UnaryCallable @@ -460,6 +501,8 @@ public class GrpcDlpServiceStub extends DlpServiceStub { hybridInspectDlpJobCallable; private final UnaryCallable finishDlpJobCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcDlpServiceStub create(DlpServiceStubSettings settings) @@ -498,6 +541,7 @@ protected GrpcDlpServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings inspectContentTransportSettings = @@ -557,15 +601,6 @@ public Map extract(ReidentifyContentRequest request) { GrpcCallSettings listInfoTypesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listInfoTypesMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListInfoTypesRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } - }) .build(); GrpcCallSettings createInspectTemplateTransportSettings = @@ -787,6 +822,19 @@ public Map extract(DeleteJobTriggerRequest request) { } }) .build(); + GrpcCallSettings activateJobTriggerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(activateJobTriggerMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ActivateJobTriggerRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); GrpcCallSettings createDlpJobTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createDlpJobMethodDescriptor) @@ -1050,6 +1098,11 @@ public Map extract(FinishDlpJobRequest request) { this.deleteJobTriggerCallable = callableFactory.createUnaryCallable( deleteJobTriggerTransportSettings, settings.deleteJobTriggerSettings(), clientContext); + this.activateJobTriggerCallable = + callableFactory.createUnaryCallable( + activateJobTriggerTransportSettings, + settings.activateJobTriggerSettings(), + clientContext); this.createDlpJobCallable = callableFactory.createUnaryCallable( createDlpJobTransportSettings, settings.createDlpJobSettings(), clientContext); @@ -1107,7 +1160,12 @@ public Map extract(FinishDlpJobRequest request) { callableFactory.createUnaryCallable( finishDlpJobTransportSettings, settings.finishDlpJobSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable inspectContentCallable() { @@ -1146,16 +1204,16 @@ public UnaryCallable getInspectTempl return getInspectTemplateCallable; } - public UnaryCallable - listInspectTemplatesPagedCallable() { - return listInspectTemplatesPagedCallable; - } - public UnaryCallable listInspectTemplatesCallable() { return listInspectTemplatesCallable; } + public UnaryCallable + listInspectTemplatesPagedCallable() { + return listInspectTemplatesPagedCallable; + } + public UnaryCallable deleteInspectTemplateCallable() { return deleteInspectTemplateCallable; } @@ -1175,16 +1233,16 @@ public UnaryCallable deleteInspectTemplateC return getDeidentifyTemplateCallable; } - public UnaryCallable - listDeidentifyTemplatesPagedCallable() { - return listDeidentifyTemplatesPagedCallable; - } - public UnaryCallable listDeidentifyTemplatesCallable() { return listDeidentifyTemplatesCallable; } + public UnaryCallable + listDeidentifyTemplatesPagedCallable() { + return listDeidentifyTemplatesPagedCallable; + } + public UnaryCallable deleteDeidentifyTemplateCallable() { return deleteDeidentifyTemplateCallable; } @@ -1206,31 +1264,35 @@ public UnaryCallable getJobTriggerCallable() { return getJobTriggerCallable; } + public UnaryCallable listJobTriggersCallable() { + return listJobTriggersCallable; + } + public UnaryCallable listJobTriggersPagedCallable() { return listJobTriggersPagedCallable; } - public UnaryCallable listJobTriggersCallable() { - return listJobTriggersCallable; - } - public UnaryCallable deleteJobTriggerCallable() { return deleteJobTriggerCallable; } - public UnaryCallable createDlpJobCallable() { - return createDlpJobCallable; + public UnaryCallable activateJobTriggerCallable() { + return activateJobTriggerCallable; } - public UnaryCallable listDlpJobsPagedCallable() { - return listDlpJobsPagedCallable; + public UnaryCallable createDlpJobCallable() { + return createDlpJobCallable; } public UnaryCallable listDlpJobsCallable() { return listDlpJobsCallable; } + public UnaryCallable listDlpJobsPagedCallable() { + return listDlpJobsPagedCallable; + } + public UnaryCallable getDlpJobCallable() { return getDlpJobCallable; } @@ -1255,16 +1317,16 @@ public UnaryCallable getStoredInfoType return getStoredInfoTypeCallable; } - public UnaryCallable - listStoredInfoTypesPagedCallable() { - return listStoredInfoTypesPagedCallable; - } - public UnaryCallable listStoredInfoTypesCallable() { return listStoredInfoTypesCallable; } + public UnaryCallable + listStoredInfoTypesPagedCallable() { + return listStoredInfoTypesPagedCallable; + } + public UnaryCallable deleteStoredInfoTypeCallable() { return deleteStoredInfoTypeCallable; } diff --git a/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/DlpServiceClientTest.java b/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/DlpServiceClientTest.java index 3579927d..cf99df30 100644 --- a/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/DlpServiceClientTest.java +++ b/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/DlpServiceClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2; import static com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse; @@ -29,12 +30,16 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.common.collect.Lists; +import com.google.privacy.dlp.v2.ActivateJobTriggerRequest; +import com.google.privacy.dlp.v2.ByteContentItem; import com.google.privacy.dlp.v2.CancelDlpJobRequest; +import com.google.privacy.dlp.v2.ContentItem; import com.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest; 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.DeidentifyConfig; import com.google.privacy.dlp.v2.DeidentifyContentRequest; import com.google.privacy.dlp.v2.DeidentifyContentResponse; import com.google.privacy.dlp.v2.DeidentifyTemplate; @@ -44,8 +49,10 @@ 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.DlpContentName; import com.google.privacy.dlp.v2.DlpJob; import com.google.privacy.dlp.v2.DlpJobName; +import com.google.privacy.dlp.v2.Error; import com.google.privacy.dlp.v2.FinishDlpJobRequest; import com.google.privacy.dlp.v2.GetDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.GetDlpJobRequest; @@ -55,9 +62,12 @@ import com.google.privacy.dlp.v2.HybridInspectDlpJobRequest; import com.google.privacy.dlp.v2.HybridInspectJobTriggerRequest; import com.google.privacy.dlp.v2.HybridInspectResponse; +import com.google.privacy.dlp.v2.InfoTypeDescription; +import com.google.privacy.dlp.v2.InspectConfig; import com.google.privacy.dlp.v2.InspectContentRequest; import com.google.privacy.dlp.v2.InspectContentResponse; import com.google.privacy.dlp.v2.InspectJobConfig; +import com.google.privacy.dlp.v2.InspectResult; import com.google.privacy.dlp.v2.InspectTemplate; import com.google.privacy.dlp.v2.InspectTemplateName; import com.google.privacy.dlp.v2.JobTrigger; @@ -74,7 +84,9 @@ 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.LocationName; import com.google.privacy.dlp.v2.OrganizationLocationName; +import com.google.privacy.dlp.v2.OrganizationName; import com.google.privacy.dlp.v2.ProjectName; import com.google.privacy.dlp.v2.RedactImageRequest; import com.google.privacy.dlp.v2.RedactImageResponse; @@ -84,6 +96,8 @@ import com.google.privacy.dlp.v2.StoredInfoType; import com.google.privacy.dlp.v2.StoredInfoTypeConfig; import com.google.privacy.dlp.v2.StoredInfoTypeName; +import com.google.privacy.dlp.v2.StoredInfoTypeVersion; +import com.google.privacy.dlp.v2.TransformationOverview; import com.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.UpdateInspectTemplateRequest; import com.google.privacy.dlp.v2.UpdateJobTriggerRequest; @@ -92,12 +106,14 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; +import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -105,31 +121,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class DlpServiceClientTest { - private static MockDlpService mockDlpService; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private DlpServiceClient client; + private static MockDlpService mockDlpService; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockDlpService = new MockDlpService(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockDlpService)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); DlpServiceSettings settings = DlpServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -144,20 +160,32 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void inspectContentTest() { - InspectContentResponse expectedResponse = InspectContentResponse.newBuilder().build(); + public void inspectContentTest() throws Exception { + InspectContentResponse expectedResponse = + InspectContentResponse.newBuilder().setResult(InspectResult.newBuilder().build()).build(); mockDlpService.addResponse(expectedResponse); - InspectContentRequest request = InspectContentRequest.newBuilder().build(); + InspectContentRequest request = + InspectContentRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setInspectConfig(InspectConfig.newBuilder().build()) + .setItem(ContentItem.newBuilder().build()) + .setInspectTemplateName("inspectTemplateName1828857433") + .setLocationId("locationId1541836720") + .build(); InspectContentResponse actualResponse = client.inspectContent(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - InspectContentRequest actualRequest = (InspectContentRequest) actualRequests.get(0); + InspectContentRequest actualRequest = ((InspectContentRequest) actualRequests.get(0)); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getInspectConfig(), actualRequest.getInspectConfig()); + Assert.assertEquals(request.getItem(), actualRequest.getItem()); + Assert.assertEquals(request.getInspectTemplateName(), actualRequest.getInspectTemplateName()); + Assert.assertEquals(request.getLocationId(), actualRequest.getLocationId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -165,42 +193,60 @@ public void inspectContentTest() { } @Test - @SuppressWarnings("all") public void inspectContentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - InspectContentRequest request = InspectContentRequest.newBuilder().build(); - + InspectContentRequest request = + InspectContentRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setInspectConfig(InspectConfig.newBuilder().build()) + .setItem(ContentItem.newBuilder().build()) + .setInspectTemplateName("inspectTemplateName1828857433") + .setLocationId("locationId1541836720") + .build(); client.inspectContent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void redactImageTest() { - ByteString redactedImage = ByteString.copyFromUtf8("28"); - String extractedText = "extractedText998260012"; + public void redactImageTest() throws Exception { RedactImageResponse expectedResponse = RedactImageResponse.newBuilder() - .setRedactedImage(redactedImage) - .setExtractedText(extractedText) + .setRedactedImage(ByteString.EMPTY) + .setExtractedText("extractedText-106686931") + .setInspectResult(InspectResult.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - RedactImageRequest request = RedactImageRequest.newBuilder().build(); + RedactImageRequest request = + RedactImageRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setLocationId("locationId1541836720") + .setInspectConfig(InspectConfig.newBuilder().build()) + .addAllImageRedactionConfigs(new ArrayList()) + .setIncludeFindings(true) + .setByteItem(ByteContentItem.newBuilder().build()) + .build(); RedactImageResponse actualResponse = client.redactImage(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - RedactImageRequest actualRequest = (RedactImageRequest) actualRequests.get(0); - + RedactImageRequest actualRequest = ((RedactImageRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getLocationId(), actualRequest.getLocationId()); + Assert.assertEquals(request.getInspectConfig(), actualRequest.getInspectConfig()); + Assert.assertEquals( + request.getImageRedactionConfigsList(), actualRequest.getImageRedactionConfigsList()); + Assert.assertEquals(request.getIncludeFindings(), actualRequest.getIncludeFindings()); + Assert.assertEquals(request.getByteItem(), actualRequest.getByteItem()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -208,36 +254,62 @@ public void redactImageTest() { } @Test - @SuppressWarnings("all") public void redactImageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - RedactImageRequest request = RedactImageRequest.newBuilder().build(); - + RedactImageRequest request = + RedactImageRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setLocationId("locationId1541836720") + .setInspectConfig(InspectConfig.newBuilder().build()) + .addAllImageRedactionConfigs(new ArrayList()) + .setIncludeFindings(true) + .setByteItem(ByteContentItem.newBuilder().build()) + .build(); client.redactImage(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deidentifyContentTest() { - DeidentifyContentResponse expectedResponse = DeidentifyContentResponse.newBuilder().build(); + public void deidentifyContentTest() throws Exception { + DeidentifyContentResponse expectedResponse = + DeidentifyContentResponse.newBuilder() + .setItem(ContentItem.newBuilder().build()) + .setOverview(TransformationOverview.newBuilder().build()) + .build(); mockDlpService.addResponse(expectedResponse); - DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder().build(); + DeidentifyContentRequest request = + DeidentifyContentRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) + .setItem(ContentItem.newBuilder().build()) + .setInspectTemplateName("inspectTemplateName1828857433") + .setDeidentifyTemplateName("deidentifyTemplateName-1374666414") + .setLocationId("locationId1541836720") + .build(); DeidentifyContentResponse actualResponse = client.deidentifyContent(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeidentifyContentRequest actualRequest = (DeidentifyContentRequest) actualRequests.get(0); - + DeidentifyContentRequest actualRequest = ((DeidentifyContentRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getDeidentifyConfig(), actualRequest.getDeidentifyConfig()); + Assert.assertEquals(request.getInspectConfig(), actualRequest.getInspectConfig()); + Assert.assertEquals(request.getItem(), actualRequest.getItem()); + Assert.assertEquals(request.getInspectTemplateName(), actualRequest.getInspectTemplateName()); + Assert.assertEquals( + request.getDeidentifyTemplateName(), actualRequest.getDeidentifyTemplateName()); + Assert.assertEquals(request.getLocationId(), actualRequest.getLocationId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -245,39 +317,63 @@ public void deidentifyContentTest() { } @Test - @SuppressWarnings("all") public void deidentifyContentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder().build(); - + DeidentifyContentRequest request = + DeidentifyContentRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) + .setItem(ContentItem.newBuilder().build()) + .setInspectTemplateName("inspectTemplateName1828857433") + .setDeidentifyTemplateName("deidentifyTemplateName-1374666414") + .setLocationId("locationId1541836720") + .build(); client.deidentifyContent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void reidentifyContentTest() { - ReidentifyContentResponse expectedResponse = ReidentifyContentResponse.newBuilder().build(); + public void reidentifyContentTest() throws Exception { + ReidentifyContentResponse expectedResponse = + ReidentifyContentResponse.newBuilder() + .setItem(ContentItem.newBuilder().build()) + .setOverview(TransformationOverview.newBuilder().build()) + .build(); mockDlpService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); ReidentifyContentRequest request = - ReidentifyContentRequest.newBuilder().setParent(parent.toString()).build(); + ReidentifyContentRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setReidentifyConfig(DeidentifyConfig.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) + .setItem(ContentItem.newBuilder().build()) + .setInspectTemplateName("inspectTemplateName1828857433") + .setReidentifyTemplateName("reidentifyTemplateName157316612") + .setLocationId("locationId1541836720") + .build(); ReidentifyContentResponse actualResponse = client.reidentifyContent(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ReidentifyContentRequest actualRequest = (ReidentifyContentRequest) actualRequests.get(0); - - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + ReidentifyContentRequest actualRequest = ((ReidentifyContentRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getReidentifyConfig(), actualRequest.getReidentifyConfig()); + Assert.assertEquals(request.getInspectConfig(), actualRequest.getInspectConfig()); + Assert.assertEquals(request.getItem(), actualRequest.getItem()); + Assert.assertEquals(request.getInspectTemplateName(), actualRequest.getInspectTemplateName()); + Assert.assertEquals( + request.getReidentifyTemplateName(), actualRequest.getReidentifyTemplateName()); + Assert.assertEquals(request.getLocationId(), actualRequest.getLocationId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -285,27 +381,34 @@ public void reidentifyContentTest() { } @Test - @SuppressWarnings("all") public void reidentifyContentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); ReidentifyContentRequest request = - ReidentifyContentRequest.newBuilder().setParent(parent.toString()).build(); - + ReidentifyContentRequest.newBuilder() + .setParent(DlpContentName.ofProjectName("[PROJECT]").toString()) + .setReidentifyConfig(DeidentifyConfig.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) + .setItem(ContentItem.newBuilder().build()) + .setInspectTemplateName("inspectTemplateName1828857433") + .setReidentifyTemplateName("reidentifyTemplateName157316612") + .setLocationId("locationId1541836720") + .build(); client.reidentifyContent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listInfoTypesTest() { - ListInfoTypesResponse expectedResponse = ListInfoTypesResponse.newBuilder().build(); + public void listInfoTypesTest() throws Exception { + ListInfoTypesResponse expectedResponse = + ListInfoTypesResponse.newBuilder() + .addAllInfoTypes(new ArrayList()) + .build(); mockDlpService.addResponse(expectedResponse); String parent = "parent-995424086"; @@ -315,7 +418,7 @@ public void listInfoTypesTest() { List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListInfoTypesRequest actualRequest = (ListInfoTypesRequest) actualRequests.get(0); + ListInfoTypesRequest actualRequest = ((ListInfoTypesRequest) actualRequests.get(0)); Assert.assertEquals(parent, actualRequest.getParent()); Assert.assertTrue( @@ -325,38 +428,36 @@ public void listInfoTypesTest() { } @Test - @SuppressWarnings("all") public void listInfoTypesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { String parent = "parent-995424086"; - client.listInfoTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createInspectTemplateTest() { - InspectTemplateName name = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void createInspectTemplateTest() throws Exception { InspectTemplate expectedResponse = InspectTemplate.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); InspectTemplate actualResponse = client.createInspectTemplate(parent, inspectTemplate); @@ -365,9 +466,9 @@ public void createInspectTemplateTest() { List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateInspectTemplateRequest actualRequest = - (CreateInspectTemplateRequest) actualRequests.get(0); + ((CreateInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(parent, OrganizationLocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(inspectTemplate, actualRequest.getInspectTemplate()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -376,56 +477,49 @@ public void createInspectTemplateTest() { } @Test - @SuppressWarnings("all") public void createInspectTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); - client.createInspectTemplate(parent, inspectTemplate); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateInspectTemplateTest() { - InspectTemplateName name2 = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void createInspectTemplateTest2() throws Exception { InspectTemplate expectedResponse = InspectTemplate.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - InspectTemplateName name = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - InspectTemplate actualResponse = - client.updateInspectTemplate(name, inspectTemplate, updateMask); + InspectTemplate actualResponse = client.createInspectTemplate(parent, inspectTemplate); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateInspectTemplateRequest actualRequest = - (UpdateInspectTemplateRequest) actualRequests.get(0); + CreateInspectTemplateRequest actualRequest = + ((CreateInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(name, InspectTemplateName.parse(actualRequest.getName())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(inspectTemplate, actualRequest.getInspectTemplate()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -433,53 +527,49 @@ public void updateInspectTemplateTest() { } @Test - @SuppressWarnings("all") - public void updateInspectTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createInspectTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - InspectTemplateName name = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - - client.updateInspectTemplate(name, inspectTemplate, updateMask); + client.createInspectTemplate(parent, inspectTemplate); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getInspectTemplateTest() { - InspectTemplateName name2 = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void createInspectTemplateTest3() throws Exception { InspectTemplate expectedResponse = InspectTemplate.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - InspectTemplateName name = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); - InspectTemplate actualResponse = client.getInspectTemplate(name); + InspectTemplate actualResponse = client.createInspectTemplate(parent, inspectTemplate); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetInspectTemplateRequest actualRequest = (GetInspectTemplateRequest) actualRequests.get(0); + CreateInspectTemplateRequest actualRequest = + ((CreateInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(name, InspectTemplateName.parse(actualRequest.getName())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(inspectTemplate, actualRequest.getInspectTemplate()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -487,49 +577,49 @@ public void getInspectTemplateTest() { } @Test - @SuppressWarnings("all") - public void getInspectTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createInspectTemplateExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - InspectTemplateName name = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); - - client.getInspectTemplate(name); + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); + client.createInspectTemplate(parent, inspectTemplate); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listInspectTemplatesTest() { - String nextPageToken = ""; - InspectTemplate inspectTemplatesElement = InspectTemplate.newBuilder().build(); - List inspectTemplates = Arrays.asList(inspectTemplatesElement); - ListInspectTemplatesResponse expectedResponse = - ListInspectTemplatesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllInspectTemplates(inspectTemplates) + public void createInspectTemplateTest4() throws Exception { + InspectTemplate expectedResponse = + InspectTemplate.newBuilder() + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - - ListInspectTemplatesPagedResponse pagedListResponse = client.listInspectTemplates(parent); + ProjectName parent = ProjectName.of("[PROJECT]"); + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getInspectTemplatesList().get(0), resources.get(0)); + InspectTemplate actualResponse = client.createInspectTemplate(parent, inspectTemplate); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListInspectTemplatesRequest actualRequest = (ListInspectTemplatesRequest) actualRequests.get(0); + CreateInspectTemplateRequest actualRequest = + ((CreateInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(parent, OrganizationLocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(inspectTemplate, actualRequest.getInspectTemplate()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -537,39 +627,49 @@ public void listInspectTemplatesTest() { } @Test - @SuppressWarnings("all") - public void listInspectTemplatesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createInspectTemplateExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - - client.listInspectTemplates(parent); + ProjectName parent = ProjectName.of("[PROJECT]"); + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); + client.createInspectTemplate(parent, inspectTemplate); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteInspectTemplateTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void createInspectTemplateTest5() throws Exception { + InspectTemplate expectedResponse = + InspectTemplate.newBuilder() + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) + .build(); mockDlpService.addResponse(expectedResponse); - InspectTemplateName name = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + String parent = "parent-995424086"; + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); - client.deleteInspectTemplate(name); + InspectTemplate actualResponse = client.createInspectTemplate(parent, inspectTemplate); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteInspectTemplateRequest actualRequest = - (DeleteInspectTemplateRequest) actualRequests.get(0); + CreateInspectTemplateRequest actualRequest = + ((CreateInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(name, InspectTemplateName.parse(actualRequest.getName())); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(inspectTemplate, actualRequest.getInspectTemplate()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -577,52 +677,54 @@ public void deleteInspectTemplateTest() { } @Test - @SuppressWarnings("all") - public void deleteInspectTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createInspectTemplateExceptionTest5() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - InspectTemplateName name = - InspectTemplateName.ofOrganizationInspectTemplateName( - "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); - - client.deleteInspectTemplate(name); + String parent = "parent-995424086"; + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); + client.createInspectTemplate(parent, inspectTemplate); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createDeidentifyTemplateTest() { - DeidentifyTemplateName name = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - DeidentifyTemplate expectedResponse = - DeidentifyTemplate.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + public void updateInspectTemplateTest() throws Exception { + InspectTemplate expectedResponse = + InspectTemplate.newBuilder() + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + InspectTemplateName name = + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); - DeidentifyTemplate actualResponse = client.createDeidentifyTemplate(parent, deidentifyTemplate); + InspectTemplate actualResponse = + client.updateInspectTemplate(name, inspectTemplate, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateDeidentifyTemplateRequest actualRequest = - (CreateDeidentifyTemplateRequest) actualRequests.get(0); + UpdateInspectTemplateRequest actualRequest = + ((UpdateInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(parent, OrganizationLocationName.parse(actualRequest.getParent())); - Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(inspectTemplate, actualRequest.getInspectTemplate()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -630,55 +732,54 @@ public void createDeidentifyTemplateTest() { } @Test - @SuppressWarnings("all") - public void createDeidentifyTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void updateInspectTemplateExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); - - client.createDeidentifyTemplate(parent, deidentifyTemplate); + InspectTemplateName name = + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateInspectTemplate(name, inspectTemplate, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateDeidentifyTemplateTest() { - DeidentifyTemplateName name2 = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - DeidentifyTemplate expectedResponse = - DeidentifyTemplate.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + public void updateInspectTemplateTest2() throws Exception { + InspectTemplate expectedResponse = + InspectTemplate.newBuilder() + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - DeidentifyTemplateName name = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); - DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + String name = "name3373707"; + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - DeidentifyTemplate actualResponse = - client.updateDeidentifyTemplate(name, deidentifyTemplate, updateMask); + InspectTemplate actualResponse = + client.updateInspectTemplate(name, inspectTemplate, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateDeidentifyTemplateRequest actualRequest = - (UpdateDeidentifyTemplateRequest) actualRequests.get(0); + UpdateInspectTemplateRequest actualRequest = + ((UpdateInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(name, DeidentifyTemplateName.parse(actualRequest.getName())); - Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(inspectTemplate, actualRequest.getInspectTemplate()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -687,54 +788,49 @@ public void updateDeidentifyTemplateTest() { } @Test - @SuppressWarnings("all") - public void updateDeidentifyTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void updateInspectTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DeidentifyTemplateName name = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); - DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + String name = "name3373707"; + InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - - client.updateDeidentifyTemplate(name, deidentifyTemplate, updateMask); + client.updateInspectTemplate(name, inspectTemplate, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getDeidentifyTemplateTest() { - DeidentifyTemplateName name2 = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - DeidentifyTemplate expectedResponse = - DeidentifyTemplate.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + public void getInspectTemplateTest() throws Exception { + InspectTemplate expectedResponse = + InspectTemplate.newBuilder() + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - DeidentifyTemplateName name = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + InspectTemplateName name = + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); - DeidentifyTemplate actualResponse = client.getDeidentifyTemplate(name); + InspectTemplate actualResponse = client.getInspectTemplate(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetDeidentifyTemplateRequest actualRequest = - (GetDeidentifyTemplateRequest) actualRequests.get(0); + GetInspectTemplateRequest actualRequest = ((GetInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(name, DeidentifyTemplateName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -742,50 +838,47 @@ public void getDeidentifyTemplateTest() { } @Test - @SuppressWarnings("all") - public void getDeidentifyTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getInspectTemplateExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DeidentifyTemplateName name = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); - - client.getDeidentifyTemplate(name); + InspectTemplateName name = + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + client.getInspectTemplate(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listDeidentifyTemplatesTest() { - String nextPageToken = ""; - DeidentifyTemplate deidentifyTemplatesElement = DeidentifyTemplate.newBuilder().build(); - List deidentifyTemplates = Arrays.asList(deidentifyTemplatesElement); - ListDeidentifyTemplatesResponse expectedResponse = - ListDeidentifyTemplatesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllDeidentifyTemplates(deidentifyTemplates) + public void getInspectTemplateTest2() throws Exception { + InspectTemplate expectedResponse = + InspectTemplate.newBuilder() + .setName( + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInspectConfig(InspectConfig.newBuilder().build()) .build(); mockDlpService.addResponse(expectedResponse); - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - - ListDeidentifyTemplatesPagedResponse pagedListResponse = client.listDeidentifyTemplates(parent); + String name = "name3373707"; - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDeidentifyTemplatesList().get(0), resources.get(0)); + InspectTemplate actualResponse = client.getInspectTemplate(name); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListDeidentifyTemplatesRequest actualRequest = - (ListDeidentifyTemplatesRequest) actualRequests.get(0); + GetInspectTemplateRequest actualRequest = ((GetInspectTemplateRequest) actualRequests.get(0)); - Assert.assertEquals(parent, OrganizationLocationName.parse(actualRequest.getParent())); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -793,39 +886,44 @@ public void listDeidentifyTemplatesTest() { } @Test - @SuppressWarnings("all") - public void listDeidentifyTemplatesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getInspectTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - - client.listDeidentifyTemplates(parent); + String name = "name3373707"; + client.getInspectTemplate(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteDeidentifyTemplateTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void listInspectTemplatesTest() throws Exception { + InspectTemplate responsesElement = InspectTemplate.newBuilder().build(); + ListInspectTemplatesResponse expectedResponse = + ListInspectTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllInspectTemplates(Arrays.asList(responsesElement)) + .build(); mockDlpService.addResponse(expectedResponse); - DeidentifyTemplateName name = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - client.deleteDeidentifyTemplate(name); + ListInspectTemplatesPagedResponse pagedListResponse = client.listInspectTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInspectTemplatesList().get(0), resources.get(0)); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteDeidentifyTemplateRequest actualRequest = - (DeleteDeidentifyTemplateRequest) actualRequests.get(0); + ListInspectTemplatesRequest actualRequest = + ((ListInspectTemplatesRequest) actualRequests.get(0)); - Assert.assertEquals(name, DeidentifyTemplateName.parse(actualRequest.getName())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -833,49 +931,2086 @@ public void deleteDeidentifyTemplateTest() { } @Test - @SuppressWarnings("all") - public void deleteDeidentifyTemplateExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listInspectTemplatesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DeidentifyTemplateName name = - DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( - "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); - - client.deleteDeidentifyTemplate(name); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listInspectTemplates(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createJobTriggerTest() { - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - JobTrigger expectedResponse = - JobTrigger.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + public void listInspectTemplatesTest2() throws Exception { + InspectTemplate responsesElement = InspectTemplate.newBuilder().build(); + ListInspectTemplatesResponse expectedResponse = + ListInspectTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllInspectTemplates(Arrays.asList(responsesElement)) .build(); mockDlpService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - JobTrigger actualResponse = client.createJobTrigger(parent, jobTrigger); - Assert.assertEquals(expectedResponse, actualResponse); + ListInspectTemplatesPagedResponse pagedListResponse = client.listInspectTemplates(parent); - List actualRequests = mockDlpService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - CreateJobTriggerRequest actualRequest = (CreateJobTriggerRequest) actualRequests.get(0); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInspectTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInspectTemplatesRequest actualRequest = + ((ListInspectTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInspectTemplatesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + client.listInspectTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInspectTemplatesTest3() throws Exception { + InspectTemplate responsesElement = InspectTemplate.newBuilder().build(); + ListInspectTemplatesResponse expectedResponse = + ListInspectTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllInspectTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + + ListInspectTemplatesPagedResponse pagedListResponse = client.listInspectTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInspectTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInspectTemplatesRequest actualRequest = + ((ListInspectTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInspectTemplatesExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + client.listInspectTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInspectTemplatesTest4() throws Exception { + InspectTemplate responsesElement = InspectTemplate.newBuilder().build(); + ListInspectTemplatesResponse expectedResponse = + ListInspectTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllInspectTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListInspectTemplatesPagedResponse pagedListResponse = client.listInspectTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInspectTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInspectTemplatesRequest actualRequest = + ((ListInspectTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInspectTemplatesExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listInspectTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInspectTemplatesTest5() throws Exception { + InspectTemplate responsesElement = InspectTemplate.newBuilder().build(); + ListInspectTemplatesResponse expectedResponse = + ListInspectTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllInspectTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListInspectTemplatesPagedResponse pagedListResponse = client.listInspectTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInspectTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInspectTemplatesRequest actualRequest = + ((ListInspectTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInspectTemplatesExceptionTest5() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listInspectTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteInspectTemplateTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + InspectTemplateName name = + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + + client.deleteInspectTemplate(name); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteInspectTemplateRequest actualRequest = + ((DeleteInspectTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteInspectTemplateExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + InspectTemplateName name = + InspectTemplateName.ofOrganizationInspectTemplateName( + "[ORGANIZATION]", "[INSPECT_TEMPLATE]"); + client.deleteInspectTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteInspectTemplateTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteInspectTemplate(name); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteInspectTemplateRequest actualRequest = + ((DeleteInspectTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteInspectTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + client.deleteInspectTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDeidentifyTemplateTest() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + + DeidentifyTemplate actualResponse = client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDeidentifyTemplateRequest actualRequest = + ((CreateDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDeidentifyTemplateExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDeidentifyTemplateTest2() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + + DeidentifyTemplate actualResponse = client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDeidentifyTemplateRequest actualRequest = + ((CreateDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDeidentifyTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDeidentifyTemplateTest3() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + + DeidentifyTemplate actualResponse = client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDeidentifyTemplateRequest actualRequest = + ((CreateDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDeidentifyTemplateExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDeidentifyTemplateTest4() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + + DeidentifyTemplate actualResponse = client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDeidentifyTemplateRequest actualRequest = + ((CreateDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDeidentifyTemplateExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDeidentifyTemplateTest5() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + + DeidentifyTemplate actualResponse = client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDeidentifyTemplateRequest actualRequest = + ((CreateDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDeidentifyTemplateExceptionTest5() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String parent = "parent-995424086"; + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + client.createDeidentifyTemplate(parent, deidentifyTemplate); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateDeidentifyTemplateTest() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + DeidentifyTemplateName name = + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DeidentifyTemplate actualResponse = + client.updateDeidentifyTemplate(name, deidentifyTemplate, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateDeidentifyTemplateRequest actualRequest = + ((UpdateDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateDeidentifyTemplateExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + DeidentifyTemplateName name = + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDeidentifyTemplate(name, deidentifyTemplate, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateDeidentifyTemplateTest2() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DeidentifyTemplate actualResponse = + client.updateDeidentifyTemplate(name, deidentifyTemplate, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateDeidentifyTemplateRequest actualRequest = + ((UpdateDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateDeidentifyTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDeidentifyTemplate(name, deidentifyTemplate, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDeidentifyTemplateTest() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + DeidentifyTemplateName name = + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + + DeidentifyTemplate actualResponse = client.getDeidentifyTemplate(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetDeidentifyTemplateRequest actualRequest = + ((GetDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getDeidentifyTemplateExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + DeidentifyTemplateName name = + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + client.getDeidentifyTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDeidentifyTemplateTest2() throws Exception { + DeidentifyTemplate expectedResponse = + DeidentifyTemplate.newBuilder() + .setName( + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeidentifyConfig(DeidentifyConfig.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + + DeidentifyTemplate actualResponse = client.getDeidentifyTemplate(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetDeidentifyTemplateRequest actualRequest = + ((GetDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getDeidentifyTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + client.getDeidentifyTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDeidentifyTemplatesTest() throws Exception { + DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build(); + ListDeidentifyTemplatesResponse expectedResponse = + ListDeidentifyTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllDeidentifyTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListDeidentifyTemplatesPagedResponse pagedListResponse = client.listDeidentifyTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDeidentifyTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDeidentifyTemplatesRequest actualRequest = + ((ListDeidentifyTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDeidentifyTemplatesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listDeidentifyTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDeidentifyTemplatesTest2() throws Exception { + DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build(); + ListDeidentifyTemplatesResponse expectedResponse = + ListDeidentifyTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllDeidentifyTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + + ListDeidentifyTemplatesPagedResponse pagedListResponse = client.listDeidentifyTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDeidentifyTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDeidentifyTemplatesRequest actualRequest = + ((ListDeidentifyTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDeidentifyTemplatesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + client.listDeidentifyTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDeidentifyTemplatesTest3() throws Exception { + DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build(); + ListDeidentifyTemplatesResponse expectedResponse = + ListDeidentifyTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllDeidentifyTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + + ListDeidentifyTemplatesPagedResponse pagedListResponse = client.listDeidentifyTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDeidentifyTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDeidentifyTemplatesRequest actualRequest = + ((ListDeidentifyTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDeidentifyTemplatesExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + client.listDeidentifyTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDeidentifyTemplatesTest4() throws Exception { + DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build(); + ListDeidentifyTemplatesResponse expectedResponse = + ListDeidentifyTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllDeidentifyTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListDeidentifyTemplatesPagedResponse pagedListResponse = client.listDeidentifyTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDeidentifyTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDeidentifyTemplatesRequest actualRequest = + ((ListDeidentifyTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDeidentifyTemplatesExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listDeidentifyTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDeidentifyTemplatesTest5() throws Exception { + DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build(); + ListDeidentifyTemplatesResponse expectedResponse = + ListDeidentifyTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllDeidentifyTemplates(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListDeidentifyTemplatesPagedResponse pagedListResponse = client.listDeidentifyTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDeidentifyTemplatesList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDeidentifyTemplatesRequest actualRequest = + ((ListDeidentifyTemplatesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDeidentifyTemplatesExceptionTest5() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listDeidentifyTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDeidentifyTemplateTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + DeidentifyTemplateName name = + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + + client.deleteDeidentifyTemplate(name); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteDeidentifyTemplateRequest actualRequest = + ((DeleteDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteDeidentifyTemplateExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + DeidentifyTemplateName name = + DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName( + "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]"); + client.deleteDeidentifyTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDeidentifyTemplateTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteDeidentifyTemplate(name); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteDeidentifyTemplateRequest actualRequest = + ((DeleteDeidentifyTemplateRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteDeidentifyTemplateExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + client.deleteDeidentifyTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createJobTriggerTest() throws Exception { + JobTrigger expectedResponse = + JobTrigger.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTriggers(new ArrayList()) + .addAllErrors(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunTime(Timestamp.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + + JobTrigger actualResponse = client.createJobTrigger(parent, jobTrigger); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateJobTriggerRequest actualRequest = ((CreateJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createJobTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + client.createJobTrigger(parent, jobTrigger); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createJobTriggerTest2() throws Exception { + JobTrigger expectedResponse = + JobTrigger.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTriggers(new ArrayList()) + .addAllErrors(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunTime(Timestamp.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + + JobTrigger actualResponse = client.createJobTrigger(parent, jobTrigger); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateJobTriggerRequest actualRequest = ((CreateJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createJobTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + client.createJobTrigger(parent, jobTrigger); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createJobTriggerTest3() throws Exception { + JobTrigger expectedResponse = + JobTrigger.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTriggers(new ArrayList()) + .addAllErrors(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunTime(Timestamp.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + + JobTrigger actualResponse = client.createJobTrigger(parent, jobTrigger); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateJobTriggerRequest actualRequest = ((CreateJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createJobTriggerExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String parent = "parent-995424086"; + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + client.createJobTrigger(parent, jobTrigger); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateJobTriggerTest() throws Exception { + JobTrigger expectedResponse = + JobTrigger.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTriggers(new ArrayList()) + .addAllErrors(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunTime(Timestamp.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + JobTrigger actualResponse = client.updateJobTrigger(name, jobTrigger, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateJobTriggerRequest actualRequest = ((UpdateJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateJobTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateJobTrigger(name, jobTrigger, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateJobTriggerTest2() throws Exception { + JobTrigger expectedResponse = + JobTrigger.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTriggers(new ArrayList()) + .addAllErrors(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunTime(Timestamp.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + JobTrigger actualResponse = client.updateJobTrigger(name, jobTrigger, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateJobTriggerRequest actualRequest = ((UpdateJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateJobTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateJobTrigger(name, jobTrigger, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void hybridInspectJobTriggerTest() throws Exception { + HybridInspectResponse expectedResponse = HybridInspectResponse.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + + HybridInspectResponse actualResponse = client.hybridInspectJobTrigger(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + HybridInspectJobTriggerRequest actualRequest = + ((HybridInspectJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void hybridInspectJobTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + client.hybridInspectJobTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void hybridInspectJobTriggerTest2() throws Exception { + HybridInspectResponse expectedResponse = HybridInspectResponse.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + + HybridInspectResponse actualResponse = client.hybridInspectJobTrigger(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + HybridInspectJobTriggerRequest actualRequest = + ((HybridInspectJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void hybridInspectJobTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + client.hybridInspectJobTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getJobTriggerTest() throws Exception { + JobTrigger expectedResponse = + JobTrigger.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTriggers(new ArrayList()) + .addAllErrors(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunTime(Timestamp.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + + JobTrigger actualResponse = client.getJobTrigger(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetJobTriggerRequest actualRequest = ((GetJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getJobTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + client.getJobTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getJobTriggerTest2() throws Exception { + JobTrigger expectedResponse = + JobTrigger.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTriggers(new ArrayList()) + .addAllErrors(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunTime(Timestamp.newBuilder().build()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + + JobTrigger actualResponse = client.getJobTrigger(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetJobTriggerRequest actualRequest = ((GetJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getJobTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + client.getJobTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listJobTriggersTest() throws Exception { + JobTrigger responsesElement = JobTrigger.newBuilder().build(); + ListJobTriggersResponse expectedResponse = + ListJobTriggersResponse.newBuilder() + .setNextPageToken("") + .addAllJobTriggers(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListJobTriggersPagedResponse pagedListResponse = client.listJobTriggers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobTriggersList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListJobTriggersRequest actualRequest = ((ListJobTriggersRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listJobTriggersExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listJobTriggers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listJobTriggersTest2() throws Exception { + JobTrigger responsesElement = JobTrigger.newBuilder().build(); + ListJobTriggersResponse expectedResponse = + ListJobTriggersResponse.newBuilder() + .setNextPageToken("") + .addAllJobTriggers(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListJobTriggersPagedResponse pagedListResponse = client.listJobTriggers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobTriggersList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListJobTriggersRequest actualRequest = ((ListJobTriggersRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listJobTriggersExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listJobTriggers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listJobTriggersTest3() throws Exception { + JobTrigger responsesElement = JobTrigger.newBuilder().build(); + ListJobTriggersResponse expectedResponse = + ListJobTriggersResponse.newBuilder() + .setNextPageToken("") + .addAllJobTriggers(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListJobTriggersPagedResponse pagedListResponse = client.listJobTriggers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobTriggersList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListJobTriggersRequest actualRequest = ((ListJobTriggersRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listJobTriggersExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listJobTriggers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteJobTriggerTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + + client.deleteJobTrigger(name); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteJobTriggerRequest actualRequest = ((DeleteJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteJobTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + client.deleteJobTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteJobTriggerTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteJobTrigger(name); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteJobTriggerRequest actualRequest = ((DeleteJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteJobTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String name = "name3373707"; + client.deleteJobTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void activateJobTriggerTest() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + ActivateJobTriggerRequest request = + ActivateJobTriggerRequest.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .build(); + + DlpJob actualResponse = client.activateJobTrigger(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ActivateJobTriggerRequest actualRequest = ((ActivateJobTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void activateJobTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ActivateJobTriggerRequest request = + ActivateJobTriggerRequest.newBuilder() + .setName( + JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()) + .build(); + client.activateJobTrigger(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDlpJobTest() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); + + DlpJob actualResponse = client.createDlpJob(parent, inspectJob); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDlpJobRequest actualRequest = ((CreateDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(inspectJob, actualRequest.getInspectJob()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDlpJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); + client.createDlpJob(parent, inspectJob); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDlpJobTest2() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); + + DlpJob actualResponse = client.createDlpJob(parent, riskJob); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDlpJobRequest actualRequest = ((CreateDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(riskJob, actualRequest.getRiskJob()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDlpJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); + client.createDlpJob(parent, riskJob); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDlpJobTest3() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); + + DlpJob actualResponse = client.createDlpJob(parent, inspectJob); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDlpJobRequest actualRequest = ((CreateDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(inspectJob, actualRequest.getInspectJob()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDlpJobExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); + client.createDlpJob(parent, inspectJob); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDlpJobTest4() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); + + DlpJob actualResponse = client.createDlpJob(parent, riskJob); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDlpJobRequest actualRequest = ((CreateDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(riskJob, actualRequest.getRiskJob()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDlpJobExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); + client.createDlpJob(parent, riskJob); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDlpJobTest5() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); + + DlpJob actualResponse = client.createDlpJob(parent, inspectJob); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDlpJobRequest actualRequest = ((CreateDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(inspectJob, actualRequest.getInspectJob()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDlpJobExceptionTest5() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String parent = "parent-995424086"; + InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); + client.createDlpJob(parent, inspectJob); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDlpJobTest6() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); + + DlpJob actualResponse = client.createDlpJob(parent, riskJob); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDlpJobRequest actualRequest = ((CreateDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(riskJob, actualRequest.getRiskJob()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDlpJobExceptionTest6() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + String parent = "parent-995424086"; + RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); + client.createDlpJob(parent, riskJob); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDlpJobsTest() throws Exception { + DlpJob responsesElement = DlpJob.newBuilder().build(); + ListDlpJobsResponse expectedResponse = + ListDlpJobsResponse.newBuilder() + .setNextPageToken("") + .addAllJobs(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListDlpJobsPagedResponse pagedListResponse = client.listDlpJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobsList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDlpJobsRequest actualRequest = ((ListDlpJobsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDlpJobsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listDlpJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDlpJobsTest2() throws Exception { + DlpJob responsesElement = DlpJob.newBuilder().build(); + ListDlpJobsResponse expectedResponse = + ListDlpJobsResponse.newBuilder() + .setNextPageToken("") + .addAllJobs(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListDlpJobsPagedResponse pagedListResponse = client.listDlpJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobsList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDlpJobsRequest actualRequest = ((ListDlpJobsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); - Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger()); + @Test + public void listDlpJobsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listDlpJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDlpJobsTest3() throws Exception { + DlpJob responsesElement = DlpJob.newBuilder().build(); + ListDlpJobsResponse expectedResponse = + ListDlpJobsResponse.newBuilder() + .setNextPageToken("") + .addAllJobs(Arrays.asList(responsesElement)) + .build(); + mockDlpService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListDlpJobsPagedResponse pagedListResponse = client.listDlpJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobsList().get(0), resources.get(0)); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDlpJobsRequest actualRequest = ((ListDlpJobsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -883,50 +3018,85 @@ public void createJobTriggerTest() { } @Test - @SuppressWarnings("all") - public void createJobTriggerExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listDlpJobsExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - JobTrigger jobTrigger = JobTrigger.newBuilder().build(); + String parent = "parent-995424086"; + client.listDlpJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } - client.createJobTrigger(parent, jobTrigger); + @Test + public void getDlpJobTest() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + + DlpJob actualResponse = client.getDlpJob(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetDlpJobRequest actualRequest = ((GetDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getDlpJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + client.getDlpJob(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateJobTriggerTest() { - JobTriggerName name2 = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - JobTrigger expectedResponse = - JobTrigger.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + public void getDlpJobTest2() throws Exception { + DlpJob expectedResponse = + DlpJob.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setJobTriggerName("jobTriggerName494333030") + .addAllErrors(new ArrayList()) .build(); mockDlpService.addResponse(expectedResponse); - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); - JobTrigger jobTrigger = JobTrigger.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); + String name = "name3373707"; - JobTrigger actualResponse = client.updateJobTrigger(name, jobTrigger, updateMask); + DlpJob actualResponse = client.getDlpJob(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateJobTriggerRequest actualRequest = (UpdateJobTriggerRequest) actualRequests.get(0); + GetDlpJobRequest actualRequest = ((GetDlpJobRequest) actualRequests.get(0)); - Assert.assertEquals(name, JobTriggerName.parse(actualRequest.getName())); - Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -934,40 +3104,67 @@ public void updateJobTriggerTest() { } @Test - @SuppressWarnings("all") - public void updateJobTriggerExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getDlpJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); - JobTrigger jobTrigger = JobTrigger.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); + String name = "name3373707"; + client.getDlpJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } - client.updateJobTrigger(name, jobTrigger, updateMask); + @Test + public void deleteDlpJobTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + + client.deleteDlpJob(name); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteDlpJobRequest actualRequest = ((DeleteDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteDlpJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + client.deleteDlpJob(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void hybridInspectJobTriggerTest() { - HybridInspectResponse expectedResponse = HybridInspectResponse.newBuilder().build(); + public void deleteDlpJobTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockDlpService.addResponse(expectedResponse); - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + String name = "name3373707"; - HybridInspectResponse actualResponse = client.hybridInspectJobTrigger(name); - Assert.assertEquals(expectedResponse, actualResponse); + client.deleteDlpJob(name); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - HybridInspectJobTriggerRequest actualRequest = - (HybridInspectJobTriggerRequest) actualRequests.get(0); + DeleteDlpJobRequest actualRequest = ((DeleteDlpJobRequest) actualRequests.get(0)); - Assert.assertEquals(name, JobTriggerName.parse(actualRequest.getName())); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -975,45 +3172,85 @@ public void hybridInspectJobTriggerTest() { } @Test - @SuppressWarnings("all") - public void hybridInspectJobTriggerExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void deleteDlpJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + String name = "name3373707"; + client.deleteDlpJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } - client.hybridInspectJobTrigger(name); + @Test + public void cancelDlpJobTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDlpService.addResponse(expectedResponse); + + CancelDlpJobRequest request = + CancelDlpJobRequest.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .build(); + + client.cancelDlpJob(request); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CancelDlpJobRequest actualRequest = ((CancelDlpJobRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void cancelDlpJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + CancelDlpJobRequest request = + CancelDlpJobRequest.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .build(); + client.cancelDlpJob(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getJobTriggerTest() { - JobTriggerName name2 = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - JobTrigger expectedResponse = - JobTrigger.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + public void createStoredInfoTypeTest() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) .build(); mockDlpService.addResponse(expectedResponse); - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); - JobTrigger actualResponse = client.getJobTrigger(name); + StoredInfoType actualResponse = client.createStoredInfoType(parent, config); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetJobTriggerRequest actualRequest = (GetJobTriggerRequest) actualRequests.get(0); + CreateStoredInfoTypeRequest actualRequest = + ((CreateStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, JobTriggerName.parse(actualRequest.getName())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(config, actualRequest.getConfig()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1021,47 +3258,187 @@ public void getJobTriggerTest() { } @Test - @SuppressWarnings("all") - public void getJobTriggerExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createStoredInfoTypeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + client.createStoredInfoType(parent, config); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } - client.getJobTrigger(name); + @Test + public void createStoredInfoTypeTest2() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + + StoredInfoType actualResponse = client.createStoredInfoType(parent, config); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateStoredInfoTypeRequest actualRequest = + ((CreateStoredInfoTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createStoredInfoTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + client.createStoredInfoType(parent, config); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listJobTriggersTest() { - String nextPageToken = ""; - JobTrigger jobTriggersElement = JobTrigger.newBuilder().build(); - List jobTriggers = Arrays.asList(jobTriggersElement); - ListJobTriggersResponse expectedResponse = - ListJobTriggersResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllJobTriggers(jobTriggers) + public void createStoredInfoTypeTest3() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); + + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + + StoredInfoType actualResponse = client.createStoredInfoType(parent, config); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateStoredInfoTypeRequest actualRequest = + ((CreateStoredInfoTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createStoredInfoTypeExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + client.createStoredInfoType(parent, config); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createStoredInfoTypeTest4() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) .build(); mockDlpService.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + + StoredInfoType actualResponse = client.createStoredInfoType(parent, config); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDlpService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateStoredInfoTypeRequest actualRequest = + ((CreateStoredInfoTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createStoredInfoTypeExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDlpService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + client.createStoredInfoType(parent, config); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createStoredInfoTypeTest5() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) + .build(); + mockDlpService.addResponse(expectedResponse); - ListJobTriggersPagedResponse pagedListResponse = client.listJobTriggers(parent); + String parent = "parent-995424086"; + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getJobTriggersList().get(0), resources.get(0)); + StoredInfoType actualResponse = client.createStoredInfoType(parent, config); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListJobTriggersRequest actualRequest = (ListJobTriggersRequest) actualRequests.get(0); + CreateStoredInfoTypeRequest actualRequest = + ((CreateStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(config, actualRequest.getConfig()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1069,36 +3446,49 @@ public void listJobTriggersTest() { } @Test - @SuppressWarnings("all") - public void listJobTriggersExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createStoredInfoTypeExceptionTest5() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - - client.listJobTriggers(parent); + String parent = "parent-995424086"; + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + client.createStoredInfoType(parent, config); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteJobTriggerTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void updateStoredInfoTypeTest() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) + .build(); mockDlpService.addResponse(expectedResponse); - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); + StoredInfoTypeName name = + StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); - client.deleteJobTrigger(name); + StoredInfoType actualResponse = client.updateStoredInfoType(name, config, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteJobTriggerRequest actualRequest = (DeleteJobTriggerRequest) actualRequests.get(0); + UpdateStoredInfoTypeRequest actualRequest = + ((UpdateStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, JobTriggerName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1106,42 +3496,51 @@ public void deleteJobTriggerTest() { } @Test - @SuppressWarnings("all") - public void deleteJobTriggerExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void updateStoredInfoTypeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"); - - client.deleteJobTrigger(name); + StoredInfoTypeName name = + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]"); + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateStoredInfoType(name, config, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createDlpJobTest() { - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - String jobTriggerName = "jobTriggerName1819490804"; - DlpJob expectedResponse = - DlpJob.newBuilder().setName(name.toString()).setJobTriggerName(jobTriggerName).build(); + public void updateStoredInfoTypeTest2() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) + .build(); mockDlpService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); + String name = "name3373707"; + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); - DlpJob actualResponse = client.createDlpJob(parent, inspectJob); + StoredInfoType actualResponse = client.updateStoredInfoType(name, config, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateDlpJobRequest actualRequest = (CreateDlpJobRequest) actualRequests.get(0); + UpdateStoredInfoTypeRequest actualRequest = + ((UpdateStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); - Assert.assertEquals(inspectJob, actualRequest.getInspectJob()); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1149,43 +3548,45 @@ public void createDlpJobTest() { } @Test - @SuppressWarnings("all") - public void createDlpJobExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void updateStoredInfoTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build(); - - client.createDlpJob(parent, inspectJob); + String name = "name3373707"; + StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateStoredInfoType(name, config, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createDlpJobTest2() { - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - String jobTriggerName = "jobTriggerName1819490804"; - DlpJob expectedResponse = - DlpJob.newBuilder().setName(name.toString()).setJobTriggerName(jobTriggerName).build(); + public void getStoredInfoTypeTest() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) + .build(); mockDlpService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); + StoredInfoTypeName name = + StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); - DlpJob actualResponse = client.createDlpJob(parent, riskJob); + StoredInfoType actualResponse = client.getStoredInfoType(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateDlpJobRequest actualRequest = (CreateDlpJobRequest) actualRequests.get(0); + GetStoredInfoTypeRequest actualRequest = ((GetStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); - Assert.assertEquals(riskJob, actualRequest.getRiskJob()); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1193,45 +3594,44 @@ public void createDlpJobTest2() { } @Test - @SuppressWarnings("all") - public void createDlpJobExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getStoredInfoTypeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build(); - - client.createDlpJob(parent, riskJob); + StoredInfoTypeName name = + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]"); + client.getStoredInfoType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listDlpJobsTest() { - String nextPageToken = ""; - DlpJob jobsElement = DlpJob.newBuilder().build(); - List jobs = Arrays.asList(jobsElement); - ListDlpJobsResponse expectedResponse = - ListDlpJobsResponse.newBuilder().setNextPageToken(nextPageToken).addAllJobs(jobs).build(); + public void getStoredInfoTypeTest2() throws Exception { + StoredInfoType expectedResponse = + StoredInfoType.newBuilder() + .setName( + StoredInfoTypeName.ofOrganizationStoredInfoTypeName( + "[ORGANIZATION]", "[STORED_INFO_TYPE]") + .toString()) + .setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()) + .addAllPendingVersions(new ArrayList()) + .build(); mockDlpService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - - ListDlpJobsPagedResponse pagedListResponse = client.listDlpJobs(parent); + String name = "name3373707"; - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getJobsList().get(0), resources.get(0)); + StoredInfoType actualResponse = client.getStoredInfoType(name); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListDlpJobsRequest actualRequest = (ListDlpJobsRequest) actualRequests.get(0); + GetStoredInfoTypeRequest actualRequest = ((GetStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1239,40 +3639,43 @@ public void listDlpJobsTest() { } @Test - @SuppressWarnings("all") - public void listDlpJobsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getStoredInfoTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - - client.listDlpJobs(parent); + String name = "name3373707"; + client.getStoredInfoType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getDlpJobTest() { - DlpJobName name2 = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - String jobTriggerName = "jobTriggerName1819490804"; - DlpJob expectedResponse = - DlpJob.newBuilder().setName(name2.toString()).setJobTriggerName(jobTriggerName).build(); + public void listStoredInfoTypesTest() throws Exception { + StoredInfoType responsesElement = StoredInfoType.newBuilder().build(); + ListStoredInfoTypesResponse expectedResponse = + ListStoredInfoTypesResponse.newBuilder() + .setNextPageToken("") + .addAllStoredInfoTypes(Arrays.asList(responsesElement)) + .build(); mockDlpService.addResponse(expectedResponse); - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - DlpJob actualResponse = client.getDlpJob(name); - Assert.assertEquals(expectedResponse, actualResponse); + ListStoredInfoTypesPagedResponse pagedListResponse = client.listStoredInfoTypes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStoredInfoTypesList().get(0), resources.get(0)); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetDlpJobRequest actualRequest = (GetDlpJobRequest) actualRequests.get(0); + ListStoredInfoTypesRequest actualRequest = ((ListStoredInfoTypesRequest) actualRequests.get(0)); - Assert.assertEquals(name, DlpJobName.parse(actualRequest.getName())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1280,36 +3683,43 @@ public void getDlpJobTest() { } @Test - @SuppressWarnings("all") - public void getDlpJobExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listStoredInfoTypesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - - client.getDlpJob(name); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listStoredInfoTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteDlpJobTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void listStoredInfoTypesTest2() throws Exception { + StoredInfoType responsesElement = StoredInfoType.newBuilder().build(); + ListStoredInfoTypesResponse expectedResponse = + ListStoredInfoTypesResponse.newBuilder() + .setNextPageToken("") + .addAllStoredInfoTypes(Arrays.asList(responsesElement)) + .build(); mockDlpService.addResponse(expectedResponse); - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - client.deleteDlpJob(name); + ListStoredInfoTypesPagedResponse pagedListResponse = client.listStoredInfoTypes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStoredInfoTypesList().get(0), resources.get(0)); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteDlpJobRequest actualRequest = (DeleteDlpJobRequest) actualRequests.get(0); + ListStoredInfoTypesRequest actualRequest = ((ListStoredInfoTypesRequest) actualRequests.get(0)); - Assert.assertEquals(name, DlpJobName.parse(actualRequest.getName())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1317,37 +3727,43 @@ public void deleteDlpJobTest() { } @Test - @SuppressWarnings("all") - public void deleteDlpJobExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listStoredInfoTypesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - - client.deleteDlpJob(name); + OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); + client.listStoredInfoTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void cancelDlpJobTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void listStoredInfoTypesTest3() throws Exception { + StoredInfoType responsesElement = StoredInfoType.newBuilder().build(); + ListStoredInfoTypesResponse expectedResponse = + ListStoredInfoTypesResponse.newBuilder() + .setNextPageToken("") + .addAllStoredInfoTypes(Arrays.asList(responsesElement)) + .build(); mockDlpService.addResponse(expectedResponse); - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - CancelDlpJobRequest request = CancelDlpJobRequest.newBuilder().setName(name.toString()).build(); + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); - client.cancelDlpJob(request); + ListStoredInfoTypesPagedResponse pagedListResponse = client.listStoredInfoTypes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStoredInfoTypesList().get(0), resources.get(0)); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CancelDlpJobRequest actualRequest = (CancelDlpJobRequest) actualRequests.get(0); + ListStoredInfoTypesRequest actualRequest = ((ListStoredInfoTypesRequest) actualRequests.get(0)); - Assert.assertEquals(name, DlpJobName.parse(actualRequest.getName())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1355,43 +3771,43 @@ public void cancelDlpJobTest() { } @Test - @SuppressWarnings("all") - public void cancelDlpJobExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listStoredInfoTypesExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - CancelDlpJobRequest request = - CancelDlpJobRequest.newBuilder().setName(name.toString()).build(); - - client.cancelDlpJob(request); + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + client.listStoredInfoTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createStoredInfoTypeTest() { - StoredInfoTypeName name = - StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); - StoredInfoType expectedResponse = StoredInfoType.newBuilder().setName(name.toString()).build(); + public void listStoredInfoTypesTest4() throws Exception { + StoredInfoType responsesElement = StoredInfoType.newBuilder().build(); + ListStoredInfoTypesResponse expectedResponse = + ListStoredInfoTypesResponse.newBuilder() + .setNextPageToken("") + .addAllStoredInfoTypes(Arrays.asList(responsesElement)) + .build(); mockDlpService.addResponse(expectedResponse); - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); + ProjectName parent = ProjectName.of("[PROJECT]"); - StoredInfoType actualResponse = client.createStoredInfoType(parent, config); - Assert.assertEquals(expectedResponse, actualResponse); + ListStoredInfoTypesPagedResponse pagedListResponse = client.listStoredInfoTypes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStoredInfoTypesList().get(0), resources.get(0)); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateStoredInfoTypeRequest actualRequest = (CreateStoredInfoTypeRequest) actualRequests.get(0); + ListStoredInfoTypesRequest actualRequest = ((ListStoredInfoTypesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, OrganizationLocationName.parse(actualRequest.getParent())); - Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1399,45 +3815,43 @@ public void createStoredInfoTypeTest() { } @Test - @SuppressWarnings("all") - public void createStoredInfoTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listStoredInfoTypesExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); - - client.createStoredInfoType(parent, config); + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listStoredInfoTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateStoredInfoTypeTest() { - StoredInfoTypeName name2 = - StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); - StoredInfoType expectedResponse = StoredInfoType.newBuilder().setName(name2.toString()).build(); + public void listStoredInfoTypesTest5() throws Exception { + StoredInfoType responsesElement = StoredInfoType.newBuilder().build(); + ListStoredInfoTypesResponse expectedResponse = + ListStoredInfoTypesResponse.newBuilder() + .setNextPageToken("") + .addAllStoredInfoTypes(Arrays.asList(responsesElement)) + .build(); mockDlpService.addResponse(expectedResponse); - StoredInfoTypeName name = - StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); - StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); + String parent = "parent-995424086"; - StoredInfoType actualResponse = client.updateStoredInfoType(name, config, updateMask); - Assert.assertEquals(expectedResponse, actualResponse); + ListStoredInfoTypesPagedResponse pagedListResponse = client.listStoredInfoTypes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStoredInfoTypesList().get(0), resources.get(0)); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateStoredInfoTypeRequest actualRequest = (UpdateStoredInfoTypeRequest) actualRequests.get(0); + ListStoredInfoTypesRequest actualRequest = ((ListStoredInfoTypesRequest) actualRequests.get(0)); - Assert.assertEquals(name, StoredInfoTypeName.parse(actualRequest.getName())); - Assert.assertEquals(config, actualRequest.getConfig()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(parent, actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1445,44 +3859,35 @@ public void updateStoredInfoTypeTest() { } @Test - @SuppressWarnings("all") - public void updateStoredInfoTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listStoredInfoTypesExceptionTest5() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - StoredInfoTypeName name = - StoredInfoTypeName.ofOrganizationStoredInfoTypeName( - "[ORGANIZATION]", "[STORED_INFO_TYPE]"); - StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - - client.updateStoredInfoType(name, config, updateMask); + String parent = "parent-995424086"; + client.listStoredInfoTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getStoredInfoTypeTest() { - StoredInfoTypeName name2 = - StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); - StoredInfoType expectedResponse = StoredInfoType.newBuilder().setName(name2.toString()).build(); + public void deleteStoredInfoTypeTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockDlpService.addResponse(expectedResponse); StoredInfoTypeName name = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); - StoredInfoType actualResponse = client.getStoredInfoType(name); - Assert.assertEquals(expectedResponse, actualResponse); + client.deleteStoredInfoType(name); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetStoredInfoTypeRequest actualRequest = (GetStoredInfoTypeRequest) actualRequests.get(0); + DeleteStoredInfoTypeRequest actualRequest = + ((DeleteStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, StoredInfoTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1490,49 +3895,36 @@ public void getStoredInfoTypeTest() { } @Test - @SuppressWarnings("all") - public void getStoredInfoTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void deleteStoredInfoTypeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { StoredInfoTypeName name = StoredInfoTypeName.ofOrganizationStoredInfoTypeName( "[ORGANIZATION]", "[STORED_INFO_TYPE]"); - - client.getStoredInfoType(name); + client.deleteStoredInfoType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listStoredInfoTypesTest() { - String nextPageToken = ""; - StoredInfoType storedInfoTypesElement = StoredInfoType.newBuilder().build(); - List storedInfoTypes = Arrays.asList(storedInfoTypesElement); - ListStoredInfoTypesResponse expectedResponse = - ListStoredInfoTypesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllStoredInfoTypes(storedInfoTypes) - .build(); + public void deleteStoredInfoTypeTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockDlpService.addResponse(expectedResponse); - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - - ListStoredInfoTypesPagedResponse pagedListResponse = client.listStoredInfoTypes(parent); + String name = "name3373707"; - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getStoredInfoTypesList().get(0), resources.get(0)); + client.deleteStoredInfoType(name); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListStoredInfoTypesRequest actualRequest = (ListStoredInfoTypesRequest) actualRequests.get(0); + DeleteStoredInfoTypeRequest actualRequest = + ((DeleteStoredInfoTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, OrganizationLocationName.parse(actualRequest.getParent())); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1540,37 +3932,34 @@ public void listStoredInfoTypesTest() { } @Test - @SuppressWarnings("all") - public void listStoredInfoTypesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void deleteStoredInfoTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); - - client.listStoredInfoTypes(parent); + String name = "name3373707"; + client.deleteStoredInfoType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteStoredInfoTypeTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void hybridInspectDlpJobTest() throws Exception { + HybridInspectResponse expectedResponse = HybridInspectResponse.newBuilder().build(); mockDlpService.addResponse(expectedResponse); - StoredInfoTypeName name = - StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]"); + DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - client.deleteStoredInfoType(name); + HybridInspectResponse actualResponse = client.hybridInspectDlpJob(name); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteStoredInfoTypeRequest actualRequest = (DeleteStoredInfoTypeRequest) actualRequests.get(0); + HybridInspectDlpJobRequest actualRequest = ((HybridInspectDlpJobRequest) actualRequests.get(0)); - Assert.assertEquals(name, StoredInfoTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1578,39 +3967,34 @@ public void deleteStoredInfoTypeTest() { } @Test - @SuppressWarnings("all") - public void deleteStoredInfoTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void hybridInspectDlpJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - StoredInfoTypeName name = - StoredInfoTypeName.ofOrganizationStoredInfoTypeName( - "[ORGANIZATION]", "[STORED_INFO_TYPE]"); - - client.deleteStoredInfoType(name); + DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + client.hybridInspectDlpJob(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void hybridInspectDlpJobTest() { + public void hybridInspectDlpJobTest2() throws Exception { HybridInspectResponse expectedResponse = HybridInspectResponse.newBuilder().build(); mockDlpService.addResponse(expectedResponse); - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); + String name = "name3373707"; HybridInspectResponse actualResponse = client.hybridInspectDlpJob(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - HybridInspectDlpJobRequest actualRequest = (HybridInspectDlpJobRequest) actualRequests.get(0); + HybridInspectDlpJobRequest actualRequest = ((HybridInspectDlpJobRequest) actualRequests.get(0)); - Assert.assertEquals(name, DlpJobName.parse(actualRequest.getName())); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1618,37 +4002,36 @@ public void hybridInspectDlpJobTest() { } @Test - @SuppressWarnings("all") - public void hybridInspectDlpJobExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void hybridInspectDlpJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - + String name = "name3373707"; client.hybridInspectDlpJob(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void finishDlpJobTest() { + public void finishDlpJobTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockDlpService.addResponse(expectedResponse); - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); - FinishDlpJobRequest request = FinishDlpJobRequest.newBuilder().setName(name.toString()).build(); + FinishDlpJobRequest request = + FinishDlpJobRequest.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .build(); client.finishDlpJob(request); List actualRequests = mockDlpService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - FinishDlpJobRequest actualRequest = (FinishDlpJobRequest) actualRequests.get(0); + FinishDlpJobRequest actualRequest = ((FinishDlpJobRequest) actualRequests.get(0)); - Assert.assertEquals(name, DlpJobName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1656,20 +4039,19 @@ public void finishDlpJobTest() { } @Test - @SuppressWarnings("all") public void finishDlpJobExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockDlpService.addException(exception); try { - DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]"); FinishDlpJobRequest request = - FinishDlpJobRequest.newBuilder().setName(name.toString()).build(); - + FinishDlpJobRequest.newBuilder() + .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()) + .build(); client.finishDlpJob(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpService.java b/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpService.java index 92d0c61b..980e9138 100644 --- a/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpService.java +++ b/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpService.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockDlpService implements MockGrpcService { private final MockDlpServiceImpl serviceImpl; diff --git a/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java b/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java index 30df799c..049cab1e 100644 --- a/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java +++ b/google-cloud-dlp/src/test/java/com/google/cloud/dlp/v2/MockDlpServiceImpl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dlp.v2; import com.google.api.core.BetaApi; +import com.google.privacy.dlp.v2.ActivateJobTriggerRequest; import com.google.privacy.dlp.v2.CancelDlpJobRequest; import com.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest; import com.google.privacy.dlp.v2.CreateDlpJobRequest; @@ -73,9 +75,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockDlpServiceImpl extends DlpServiceImplBase { private List requests; private Queue responses; @@ -112,10 +115,10 @@ public void inspectContent( Object response = responses.remove(); if (response instanceof InspectContentResponse) { requests.add(request); - responseObserver.onNext((InspectContentResponse) response); + responseObserver.onNext(((InspectContentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -127,10 +130,10 @@ public void redactImage( Object response = responses.remove(); if (response instanceof RedactImageResponse) { requests.add(request); - responseObserver.onNext((RedactImageResponse) response); + responseObserver.onNext(((RedactImageResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -143,10 +146,10 @@ public void deidentifyContent( Object response = responses.remove(); if (response instanceof DeidentifyContentResponse) { requests.add(request); - responseObserver.onNext((DeidentifyContentResponse) response); + responseObserver.onNext(((DeidentifyContentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -159,10 +162,10 @@ public void reidentifyContent( Object response = responses.remove(); if (response instanceof ReidentifyContentResponse) { requests.add(request); - responseObserver.onNext((ReidentifyContentResponse) response); + responseObserver.onNext(((ReidentifyContentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -174,10 +177,10 @@ public void listInfoTypes( Object response = responses.remove(); if (response instanceof ListInfoTypesResponse) { requests.add(request); - responseObserver.onNext((ListInfoTypesResponse) response); + responseObserver.onNext(((ListInfoTypesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -189,10 +192,10 @@ public void createInspectTemplate( Object response = responses.remove(); if (response instanceof InspectTemplate) { requests.add(request); - responseObserver.onNext((InspectTemplate) response); + responseObserver.onNext(((InspectTemplate) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -204,10 +207,10 @@ public void updateInspectTemplate( Object response = responses.remove(); if (response instanceof InspectTemplate) { requests.add(request); - responseObserver.onNext((InspectTemplate) response); + responseObserver.onNext(((InspectTemplate) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -219,10 +222,10 @@ public void getInspectTemplate( Object response = responses.remove(); if (response instanceof InspectTemplate) { requests.add(request); - responseObserver.onNext((InspectTemplate) response); + responseObserver.onNext(((InspectTemplate) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -235,10 +238,10 @@ public void listInspectTemplates( Object response = responses.remove(); if (response instanceof ListInspectTemplatesResponse) { requests.add(request); - responseObserver.onNext((ListInspectTemplatesResponse) response); + responseObserver.onNext(((ListInspectTemplatesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -250,10 +253,10 @@ public void deleteInspectTemplate( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -266,10 +269,10 @@ public void createDeidentifyTemplate( Object response = responses.remove(); if (response instanceof DeidentifyTemplate) { requests.add(request); - responseObserver.onNext((DeidentifyTemplate) response); + responseObserver.onNext(((DeidentifyTemplate) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -282,10 +285,10 @@ public void updateDeidentifyTemplate( Object response = responses.remove(); if (response instanceof DeidentifyTemplate) { requests.add(request); - responseObserver.onNext((DeidentifyTemplate) response); + responseObserver.onNext(((DeidentifyTemplate) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -297,10 +300,10 @@ public void getDeidentifyTemplate( Object response = responses.remove(); if (response instanceof DeidentifyTemplate) { requests.add(request); - responseObserver.onNext((DeidentifyTemplate) response); + responseObserver.onNext(((DeidentifyTemplate) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -313,10 +316,10 @@ public void listDeidentifyTemplates( Object response = responses.remove(); if (response instanceof ListDeidentifyTemplatesResponse) { requests.add(request); - responseObserver.onNext((ListDeidentifyTemplatesResponse) response); + responseObserver.onNext(((ListDeidentifyTemplatesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -328,10 +331,10 @@ public void deleteDeidentifyTemplate( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -343,10 +346,10 @@ public void createJobTrigger( Object response = responses.remove(); if (response instanceof JobTrigger) { requests.add(request); - responseObserver.onNext((JobTrigger) response); + responseObserver.onNext(((JobTrigger) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -358,10 +361,10 @@ public void updateJobTrigger( Object response = responses.remove(); if (response instanceof JobTrigger) { requests.add(request); - responseObserver.onNext((JobTrigger) response); + responseObserver.onNext(((JobTrigger) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -374,10 +377,10 @@ public void hybridInspectJobTrigger( Object response = responses.remove(); if (response instanceof HybridInspectResponse) { requests.add(request); - responseObserver.onNext((HybridInspectResponse) response); + responseObserver.onNext(((HybridInspectResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -389,10 +392,10 @@ public void getJobTrigger( Object response = responses.remove(); if (response instanceof JobTrigger) { requests.add(request); - responseObserver.onNext((JobTrigger) response); + responseObserver.onNext(((JobTrigger) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -404,10 +407,10 @@ public void listJobTriggers( Object response = responses.remove(); if (response instanceof ListJobTriggersResponse) { requests.add(request); - responseObserver.onNext((ListJobTriggersResponse) response); + responseObserver.onNext(((ListJobTriggersResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -419,10 +422,25 @@ public void deleteJobTrigger( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void activateJobTrigger( + ActivateJobTriggerRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof DlpJob) { + requests.add(request); + responseObserver.onNext(((DlpJob) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -433,10 +451,10 @@ public void createDlpJob(CreateDlpJobRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof DlpJob) { requests.add(request); - responseObserver.onNext((DlpJob) response); + responseObserver.onNext(((DlpJob) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -448,10 +466,10 @@ public void listDlpJobs( Object response = responses.remove(); if (response instanceof ListDlpJobsResponse) { requests.add(request); - responseObserver.onNext((ListDlpJobsResponse) response); + responseObserver.onNext(((ListDlpJobsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -462,10 +480,10 @@ public void getDlpJob(GetDlpJobRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof DlpJob) { requests.add(request); - responseObserver.onNext((DlpJob) response); + responseObserver.onNext(((DlpJob) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -476,10 +494,10 @@ public void deleteDlpJob(DeleteDlpJobRequest request, StreamObserver resp Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -490,10 +508,10 @@ public void cancelDlpJob(CancelDlpJobRequest request, StreamObserver resp Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -505,10 +523,10 @@ public void createStoredInfoType( Object response = responses.remove(); if (response instanceof StoredInfoType) { requests.add(request); - responseObserver.onNext((StoredInfoType) response); + responseObserver.onNext(((StoredInfoType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -520,10 +538,10 @@ public void updateStoredInfoType( Object response = responses.remove(); if (response instanceof StoredInfoType) { requests.add(request); - responseObserver.onNext((StoredInfoType) response); + responseObserver.onNext(((StoredInfoType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -535,10 +553,10 @@ public void getStoredInfoType( Object response = responses.remove(); if (response instanceof StoredInfoType) { requests.add(request); - responseObserver.onNext((StoredInfoType) response); + responseObserver.onNext(((StoredInfoType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -551,10 +569,10 @@ public void listStoredInfoTypes( Object response = responses.remove(); if (response instanceof ListStoredInfoTypesResponse) { requests.add(request); - responseObserver.onNext((ListStoredInfoTypesResponse) response); + responseObserver.onNext(((ListStoredInfoTypesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -566,10 +584,10 @@ public void deleteStoredInfoType( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -581,10 +599,10 @@ public void hybridInspectDlpJob( Object response = responses.remove(); if (response instanceof HybridInspectResponse) { requests.add(request); - responseObserver.onNext((HybridInspectResponse) response); + responseObserver.onNext(((HybridInspectResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -595,10 +613,10 @@ public void finishDlpJob(FinishDlpJobRequest request, StreamObserver resp Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/grpc-google-cloud-dlp-v2/pom.xml b/grpc-google-cloud-dlp-v2/pom.xml index a0581ffb..a3ec381c 100644 --- a/grpc-google-cloud-dlp-v2/pom.xml +++ b/grpc-google-cloud-dlp-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-dlp-v2 - 2.2.5 + 2.2.6 grpc-google-cloud-dlp-v2 GRPC library for grpc-google-cloud-dlp-v2 com.google.cloud google-cloud-dlp-parent - 2.2.5 + 2.2.6 diff --git a/pom.xml b/pom.xml index 94b5696f..0616f9a3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-dlp-parent pom - 2.2.5 + 2.2.6 Google Cloud DLP Parent https://github.com/googleapis/java-dlp @@ -70,23 +70,23 @@ com.google.api.grpc proto-google-cloud-dlp-v2 - 2.2.5 + 2.2.6 com.google.api.grpc grpc-google-cloud-dlp-v2 - 2.2.5 + 2.2.6 com.google.cloud google-cloud-dlp - 2.2.5 + 2.2.6 com.google.cloud google-cloud-shared-dependencies - 0.17.0 + 0.18.0 pom import diff --git a/proto-google-cloud-dlp-v2/pom.xml b/proto-google-cloud-dlp-v2/pom.xml index ca91126d..3f9a082c 100644 --- a/proto-google-cloud-dlp-v2/pom.xml +++ b/proto-google-cloud-dlp-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-dlp-v2 - 2.2.5 + 2.2.6 proto-google-cloud-dlp-v2 PROTO library for proto-google-cloud-dlp-v2 com.google.cloud google-cloud-dlp-parent - 2.2.5 + 2.2.6 diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java index c7d25571..a6338893 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -24,76 +24,85 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class DeidentifyTemplateName implements ResourceName { - - @Deprecated - protected DeidentifyTemplateName() {} - - private static final PathTemplate ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION_DEIDENTIFY_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/deidentifyTemplates/{deidentify_template}"); - private static final PathTemplate PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_DEIDENTIFY_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/deidentifyTemplates/{deidentify_template}"); - private static final PathTemplate ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}"); - private static final PathTemplate PROJECT_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_DEIDENTIFY_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}"); - private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String organization; + private final String deidentifyTemplate; + private final String project; + private final String location; - private String organization; - private String deidentifyTemplate; - private String project; - private String location; - - public String getOrganization() { - return organization; - } - - public String getDeidentifyTemplate() { - return deidentifyTemplate; - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; + @Deprecated + protected DeidentifyTemplateName() { + organization = null; + deidentifyTemplate = null; + project = null; + location = null; } private DeidentifyTemplateName(Builder builder) { organization = Preconditions.checkNotNull(builder.getOrganization()); deidentifyTemplate = Preconditions.checkNotNull(builder.getDeidentifyTemplate()); - pathTemplate = ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE; + project = null; + location = null; + pathTemplate = ORGANIZATION_DEIDENTIFY_TEMPLATE; } private DeidentifyTemplateName(ProjectDeidentifyTemplateBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); deidentifyTemplate = Preconditions.checkNotNull(builder.getDeidentifyTemplate()); - pathTemplate = PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE; + organization = null; + location = null; + pathTemplate = PROJECT_DEIDENTIFY_TEMPLATE; } private DeidentifyTemplateName(OrganizationLocationDeidentifyTemplateBuilder builder) { organization = Preconditions.checkNotNull(builder.getOrganization()); location = Preconditions.checkNotNull(builder.getLocation()); deidentifyTemplate = Preconditions.checkNotNull(builder.getDeidentifyTemplate()); - pathTemplate = ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE; + project = null; + pathTemplate = ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE; } private DeidentifyTemplateName(ProjectLocationDeidentifyTemplateBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); location = Preconditions.checkNotNull(builder.getLocation()); deidentifyTemplate = Preconditions.checkNotNull(builder.getDeidentifyTemplate()); - pathTemplate = PROJECT_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE; + organization = null; + pathTemplate = PROJECT_LOCATION_DEIDENTIFY_TEMPLATE; + } + + public String getOrganization() { + return organization; + } + + public String getDeidentifyTemplate() { + return deidentifyTemplate; + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; } public static Builder newBuilder() { @@ -127,7 +136,7 @@ public Builder toBuilder() { } public static DeidentifyTemplateName of(String organization, String deidentifyTemplate) { - return newOrganizationDeidentifyTemplateBuilder() + return newBuilder() .setOrganization(organization) .setDeidentifyTemplate(deidentifyTemplate) .build(); @@ -136,7 +145,7 @@ public static DeidentifyTemplateName of(String organization, String deidentifyTe @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static DeidentifyTemplateName ofOrganizationDeidentifyTemplateName( String organization, String deidentifyTemplate) { - return newOrganizationDeidentifyTemplateBuilder() + return newBuilder() .setOrganization(organization) .setDeidentifyTemplate(deidentifyTemplate) .build(); @@ -225,37 +234,35 @@ public static DeidentifyTemplateName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.match(formattedString); + if (ORGANIZATION_DEIDENTIFY_TEMPLATE.matches(formattedString)) { + Map matchMap = ORGANIZATION_DEIDENTIFY_TEMPLATE.match(formattedString); return ofOrganizationDeidentifyTemplateName( matchMap.get("organization"), matchMap.get("deidentify_template")); - } else if (PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_DEIDENTIFY_TEMPLATE.matches(formattedString)) { + Map matchMap = PROJECT_DEIDENTIFY_TEMPLATE.match(formattedString); return ofProjectDeidentifyTemplateName( matchMap.get("project"), matchMap.get("deidentify_template")); - } else if (ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { + } else if (ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE.matches(formattedString)) { Map matchMap = - ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.match(formattedString); + ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE.match(formattedString); return ofOrganizationLocationDeidentifyTemplateName( matchMap.get("organization"), matchMap.get("location"), matchMap.get("deidentify_template")); - } else if (PROJECT_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - PROJECT_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_LOCATION_DEIDENTIFY_TEMPLATE.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_DEIDENTIFY_TEMPLATE.match(formattedString); return ofProjectLocationDeidentifyTemplateName( matchMap.get("project"), matchMap.get("location"), matchMap.get("deidentify_template")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException( + "DeidentifyTemplateName.parse: formattedString not in valid format"); } public static boolean isParsableFrom(String formattedString) { - return ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString) - || ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.matches(formattedString); + return ORGANIZATION_DEIDENTIFY_TEMPLATE.matches(formattedString) + || PROJECT_DEIDENTIFY_TEMPLATE.matches(formattedString) + || ORGANIZATION_LOCATION_DEIDENTIFY_TEMPLATE.matches(formattedString) + || PROJECT_LOCATION_DEIDENTIFY_TEMPLATE.matches(formattedString); } @Override @@ -292,9 +299,39 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + DeidentifyTemplateName that = ((DeidentifyTemplateName) o); + return Objects.equals(this.organization, that.organization) + && Objects.equals(this.deidentifyTemplate, that.deidentifyTemplate) + && Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(organization); + h *= 1000003; + h ^= Objects.hashCode(deidentifyTemplate); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + /** Builder for organizations/{organization}/deidentifyTemplates/{deidentify_template}. */ public static class Builder { - private String organization; private String deidentifyTemplate; @@ -320,9 +357,8 @@ public Builder setDeidentifyTemplate(String deidentifyTemplate) { private Builder(DeidentifyTemplateName deidentifyTemplateName) { Preconditions.checkArgument( - deidentifyTemplateName.pathTemplate == ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE, - "toBuilder is only supported when DeidentifyTemplateName has the pattern of " - + "organizations/{organization}/deidentifyTemplates/{deidentify_template}."); + Objects.equals(deidentifyTemplateName.pathTemplate, ORGANIZATION_DEIDENTIFY_TEMPLATE), + "toBuilder is only supported when DeidentifyTemplateName has the pattern of organizations/{organization}/deidentifyTemplates/{deidentify_template}"); organization = deidentifyTemplateName.organization; deidentifyTemplate = deidentifyTemplateName.deidentifyTemplate; } @@ -335,11 +371,10 @@ public DeidentifyTemplateName build() { /** Builder for projects/{project}/deidentifyTemplates/{deidentify_template}. */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectDeidentifyTemplateBuilder { - private String project; private String deidentifyTemplate; - private ProjectDeidentifyTemplateBuilder() {} + protected ProjectDeidentifyTemplateBuilder() {} public String getProject() { return project; @@ -370,12 +405,11 @@ public DeidentifyTemplateName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationLocationDeidentifyTemplateBuilder { - private String organization; private String location; private String deidentifyTemplate; - private OrganizationLocationDeidentifyTemplateBuilder() {} + protected OrganizationLocationDeidentifyTemplateBuilder() {} public String getOrganization() { return organization; @@ -415,12 +449,11 @@ public DeidentifyTemplateName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationDeidentifyTemplateBuilder { - private String project; private String location; private String deidentifyTemplate; - private ProjectLocationDeidentifyTemplateBuilder() {} + protected ProjectLocationDeidentifyTemplateBuilder() {} public String getProject() { return project; @@ -454,35 +487,4 @@ public DeidentifyTemplateName build() { return new DeidentifyTemplateName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - DeidentifyTemplateName that = (DeidentifyTemplateName) o; - return (Objects.equals(this.organization, that.organization)) - && (Objects.equals(this.deidentifyTemplate, that.deidentifyTemplate)) - && (Objects.equals(this.project, that.project)) - && (Objects.equals(this.location, that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(organization); - h *= 1000003; - h ^= Objects.hashCode(deidentifyTemplate); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpContentName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpContentName.java new file mode 100644 index 00000000..bb38cc09 --- /dev/null +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpContentName.java @@ -0,0 +1,264 @@ +/* + * Copyright 2020 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 + * + * https://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.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.pathtemplate.ValidationException; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class DlpContentName implements ResourceName { + private static final PathTemplate PROJECT = + PathTemplate.createWithoutUrlEncoding("projects/{project}/dlpContent"); + private static final PathTemplate PROJECT_LOCATION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/dlpContent"); + private volatile Map fieldValuesMap; + private PathTemplate pathTemplate; + private String fixedValue; + private final String project; + private final String location; + + @Deprecated + protected DlpContentName() { + project = null; + location = null; + } + + private DlpContentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = null; + pathTemplate = PROJECT; + } + + private DlpContentName(ProjectLocationBuilder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + pathTemplate = PROJECT_LOCATION; + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static Builder newProjectBuilder() { + return new Builder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static ProjectLocationBuilder newProjectLocationBuilder() { + return new ProjectLocationBuilder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static DlpContentName of(String project) { + return newBuilder().setProject(project).build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static DlpContentName ofProjectName(String project) { + return newBuilder().setProject(project).build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static DlpContentName ofProjectLocationName(String project, String location) { + return newProjectLocationBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project) { + return newBuilder().setProject(project).build().toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatProjectName(String project) { + return newBuilder().setProject(project).build().toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatProjectLocationName(String project, String location) { + return newProjectLocationBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static DlpContentName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + if (PROJECT.matches(formattedString)) { + Map matchMap = PROJECT.match(formattedString); + return ofProjectName(matchMap.get("project")); + } else if (PROJECT_LOCATION.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION.match(formattedString); + return ofProjectLocationName(matchMap.get("project"), matchMap.get("location")); + } + throw new ValidationException("DlpContentName.parse: formattedString not in valid format"); + } + + 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 (DlpContentName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT.matches(formattedString) || PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + DlpContentName that = ((DlpContentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/dlpContent. */ + public static class Builder { + private String project; + + protected Builder() {} + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder(DlpContentName dlpContentName) { + Preconditions.checkArgument( + Objects.equals(dlpContentName.pathTemplate, PROJECT), + "toBuilder is only supported when DlpContentName has the pattern of projects/{project}/dlpContent"); + project = dlpContentName.project; + } + + public DlpContentName build() { + return new DlpContentName(this); + } + } + + /** Builder for projects/{project}/locations/{location}/dlpContent. */ + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static class ProjectLocationBuilder { + private String project; + private String location; + + protected ProjectLocationBuilder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public ProjectLocationBuilder setProject(String project) { + this.project = project; + return this; + } + + public ProjectLocationBuilder setLocation(String location) { + this.location = location; + return this; + } + + public DlpContentName build() { + return new DlpContentName(this); + } + } +} diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpJobName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpJobName.java index 8644115b..f9b0d6c6 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpJobName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpJobName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -26,51 +26,54 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class DlpJobName implements ResourceName { - - @Deprecated - protected DlpJobName() {} - - private static final PathTemplate PROJECT_DLP_JOB_PATH_TEMPLATE = + private static final PathTemplate PROJECT_DLP_JOB = PathTemplate.createWithoutUrlEncoding("projects/{project}/dlpJobs/{dlp_job}"); - private static final PathTemplate PROJECT_LOCATION_DLP_JOB_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_DLP_JOB = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/dlpJobs/{dlp_job}"); - private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String project; + private final String dlpJob; + private final String location; - private String project; - private String dlpJob; - private String location; - - public String getProject() { - return project; - } - - public String getDlpJob() { - return dlpJob; - } - - public String getLocation() { - return location; + @Deprecated + protected DlpJobName() { + project = null; + dlpJob = null; + location = null; } private DlpJobName(Builder builder) { project = Preconditions.checkNotNull(builder.getProject()); dlpJob = Preconditions.checkNotNull(builder.getDlpJob()); - pathTemplate = PROJECT_DLP_JOB_PATH_TEMPLATE; + location = null; + pathTemplate = PROJECT_DLP_JOB; } private DlpJobName(ProjectLocationDlpJobBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); location = Preconditions.checkNotNull(builder.getLocation()); dlpJob = Preconditions.checkNotNull(builder.getDlpJob()); - pathTemplate = PROJECT_LOCATION_DLP_JOB_PATH_TEMPLATE; + pathTemplate = PROJECT_LOCATION_DLP_JOB; + } + + public String getProject() { + return project; + } + + public String getDlpJob() { + return dlpJob; + } + + public String getLocation() { + return location; } public static Builder newBuilder() { @@ -92,12 +95,12 @@ public Builder toBuilder() { } public static DlpJobName of(String project, String dlpJob) { - return newProjectDlpJobBuilder().setProject(project).setDlpJob(dlpJob).build(); + return newBuilder().setProject(project).setDlpJob(dlpJob).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static DlpJobName ofProjectDlpJobName(String project, String dlpJob) { - return newProjectDlpJobBuilder().setProject(project).setDlpJob(dlpJob).build(); + return newBuilder().setProject(project).setDlpJob(dlpJob).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") @@ -134,15 +137,15 @@ public static DlpJobName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (PROJECT_DLP_JOB_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = PROJECT_DLP_JOB_PATH_TEMPLATE.match(formattedString); + if (PROJECT_DLP_JOB.matches(formattedString)) { + Map matchMap = PROJECT_DLP_JOB.match(formattedString); return ofProjectDlpJobName(matchMap.get("project"), matchMap.get("dlp_job")); - } else if (PROJECT_LOCATION_DLP_JOB_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = PROJECT_LOCATION_DLP_JOB_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_LOCATION_DLP_JOB.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_DLP_JOB.match(formattedString); return ofProjectLocationDlpJobName( matchMap.get("project"), matchMap.get("location"), matchMap.get("dlp_job")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException("DlpJobName.parse: formattedString not in valid format"); } public static List parseList(List formattedStrings) { @@ -166,8 +169,8 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PROJECT_DLP_JOB_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_DLP_JOB_PATH_TEMPLATE.matches(formattedString); + return PROJECT_DLP_JOB.matches(formattedString) + || PROJECT_LOCATION_DLP_JOB.matches(formattedString); } @Override @@ -201,9 +204,36 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + DlpJobName that = ((DlpJobName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.dlpJob, that.dlpJob) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(dlpJob); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + /** Builder for projects/{project}/dlpJobs/{dlp_job}. */ public static class Builder { - private String project; private String dlpJob; @@ -229,9 +259,8 @@ public Builder setDlpJob(String dlpJob) { private Builder(DlpJobName dlpJobName) { Preconditions.checkArgument( - dlpJobName.pathTemplate == PROJECT_DLP_JOB_PATH_TEMPLATE, - "toBuilder is only supported when DlpJobName has the pattern of " - + "projects/{project}/dlpJobs/{dlp_job}."); + Objects.equals(dlpJobName.pathTemplate, PROJECT_DLP_JOB), + "toBuilder is only supported when DlpJobName has the pattern of projects/{project}/dlpJobs/{dlp_job}"); project = dlpJobName.project; dlpJob = dlpJobName.dlpJob; } @@ -244,12 +273,11 @@ public DlpJobName build() { /** Builder for projects/{project}/locations/{location}/dlpJobs/{dlp_job}. */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationDlpJobBuilder { - private String project; private String location; private String dlpJob; - private ProjectLocationDlpJobBuilder() {} + protected ProjectLocationDlpJobBuilder() {} public String getProject() { return project; @@ -282,32 +310,4 @@ public DlpJobName build() { return new DlpJobName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - DlpJobName that = (DlpJobName) o; - return (Objects.equals(this.project, that.project)) - && (Objects.equals(this.dlpJob, that.dlpJob)) - && (Objects.equals(this.location, that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(dlpJob); - h *= 1000003; - h ^= Objects.hashCode(location); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/FindingName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/FindingName.java index 7a26f557..8f2749d0 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/FindingName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/FindingName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class FindingName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_FINDING = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/findings/{finding}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String finding; + @Deprecated + protected FindingName() { + project = null; + location = null; + finding = null; + } + + private FindingName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + finding = Preconditions.checkNotNull(builder.getFinding()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private FindingName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - finding = Preconditions.checkNotNull(builder.getFinding()); - } - public static FindingName of(String project, String location, String finding) { return newBuilder().setProject(project).setLocation(location).setFinding(finding).build(); } @@ -82,7 +88,7 @@ public static FindingName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_FINDING.validatedMatch( formattedString, "FindingName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("finding")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (FindingName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_FINDING.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("finding", finding); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (finding != null) { + fieldMapBuilder.put("finding", finding); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,16 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location, "finding", finding); + return PROJECT_LOCATION_FINDING.instantiate( + "project", project, "location", location, "finding", finding); } - /** Builder for FindingName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + FindingName that = ((FindingName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.finding, that.finding); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(finding); + return h; + } + + /** Builder for projects/{project}/locations/{location}/findings/{finding}. */ + public static class Builder { private String project; private String location; private String finding; + protected Builder() {} + public String getProject() { return project; } @@ -169,8 +210,6 @@ public Builder setFinding(String finding) { return this; } - private Builder() {} - private Builder(FindingName findingName) { project = findingName.project; location = findingName.location; @@ -181,30 +220,4 @@ public FindingName build() { return new FindingName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof FindingName) { - FindingName that = (FindingName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.finding.equals(that.finding)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= finding.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java index 48154875..db50f57e 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -24,76 +24,85 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class InspectTemplateName implements ResourceName { - - @Deprecated - protected InspectTemplateName() {} - - private static final PathTemplate ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION_INSPECT_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/inspectTemplates/{inspect_template}"); - private static final PathTemplate PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSPECT_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/inspectTemplates/{inspect_template}"); - private static final PathTemplate ORGANIZATION_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION_LOCATION_INSPECT_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}"); - private static final PathTemplate PROJECT_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_INSPECT_TEMPLATE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/inspectTemplates/{inspect_template}"); - private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String organization; + private final String inspectTemplate; + private final String project; + private final String location; - private String organization; - private String inspectTemplate; - private String project; - private String location; - - public String getOrganization() { - return organization; - } - - public String getInspectTemplate() { - return inspectTemplate; - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; + @Deprecated + protected InspectTemplateName() { + organization = null; + inspectTemplate = null; + project = null; + location = null; } private InspectTemplateName(Builder builder) { organization = Preconditions.checkNotNull(builder.getOrganization()); inspectTemplate = Preconditions.checkNotNull(builder.getInspectTemplate()); - pathTemplate = ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE; + project = null; + location = null; + pathTemplate = ORGANIZATION_INSPECT_TEMPLATE; } private InspectTemplateName(ProjectInspectTemplateBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); inspectTemplate = Preconditions.checkNotNull(builder.getInspectTemplate()); - pathTemplate = PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE; + organization = null; + location = null; + pathTemplate = PROJECT_INSPECT_TEMPLATE; } private InspectTemplateName(OrganizationLocationInspectTemplateBuilder builder) { organization = Preconditions.checkNotNull(builder.getOrganization()); location = Preconditions.checkNotNull(builder.getLocation()); inspectTemplate = Preconditions.checkNotNull(builder.getInspectTemplate()); - pathTemplate = ORGANIZATION_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE; + project = null; + pathTemplate = ORGANIZATION_LOCATION_INSPECT_TEMPLATE; } private InspectTemplateName(ProjectLocationInspectTemplateBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); location = Preconditions.checkNotNull(builder.getLocation()); inspectTemplate = Preconditions.checkNotNull(builder.getInspectTemplate()); - pathTemplate = PROJECT_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE; + organization = null; + pathTemplate = PROJECT_LOCATION_INSPECT_TEMPLATE; + } + + public String getOrganization() { + return organization; + } + + public String getInspectTemplate() { + return inspectTemplate; + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; } public static Builder newBuilder() { @@ -126,19 +135,13 @@ public Builder toBuilder() { } public static InspectTemplateName of(String organization, String inspectTemplate) { - return newOrganizationInspectTemplateBuilder() - .setOrganization(organization) - .setInspectTemplate(inspectTemplate) - .build(); + return newBuilder().setOrganization(organization).setInspectTemplate(inspectTemplate).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static InspectTemplateName ofOrganizationInspectTemplateName( String organization, String inspectTemplate) { - return newOrganizationInspectTemplateBuilder() - .setOrganization(organization) - .setInspectTemplate(inspectTemplate) - .build(); + return newBuilder().setOrganization(organization).setInspectTemplate(inspectTemplate).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") @@ -223,34 +226,31 @@ public static InspectTemplateName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE.match(formattedString); + if (ORGANIZATION_INSPECT_TEMPLATE.matches(formattedString)) { + Map matchMap = ORGANIZATION_INSPECT_TEMPLATE.match(formattedString); return ofOrganizationInspectTemplateName( matchMap.get("organization"), matchMap.get("inspect_template")); - } else if (PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_INSPECT_TEMPLATE.matches(formattedString)) { + Map matchMap = PROJECT_INSPECT_TEMPLATE.match(formattedString); return ofProjectInspectTemplateName( matchMap.get("project"), matchMap.get("inspect_template")); - } else if (ORGANIZATION_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - ORGANIZATION_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE.match(formattedString); + } else if (ORGANIZATION_LOCATION_INSPECT_TEMPLATE.matches(formattedString)) { + Map matchMap = ORGANIZATION_LOCATION_INSPECT_TEMPLATE.match(formattedString); return ofOrganizationLocationInspectTemplateName( matchMap.get("organization"), matchMap.get("location"), matchMap.get("inspect_template")); - } else if (PROJECT_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - PROJECT_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_LOCATION_INSPECT_TEMPLATE.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_INSPECT_TEMPLATE.match(formattedString); return ofProjectLocationInspectTemplateName( matchMap.get("project"), matchMap.get("location"), matchMap.get("inspect_template")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException("InspectTemplateName.parse: formattedString not in valid format"); } public static boolean isParsableFrom(String formattedString) { - return ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString) - || ORGANIZATION_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_INSPECT_TEMPLATE_PATH_TEMPLATE.matches(formattedString); + return ORGANIZATION_INSPECT_TEMPLATE.matches(formattedString) + || PROJECT_INSPECT_TEMPLATE.matches(formattedString) + || ORGANIZATION_LOCATION_INSPECT_TEMPLATE.matches(formattedString) + || PROJECT_LOCATION_INSPECT_TEMPLATE.matches(formattedString); } @Override @@ -287,9 +287,39 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + InspectTemplateName that = ((InspectTemplateName) o); + return Objects.equals(this.organization, that.organization) + && Objects.equals(this.inspectTemplate, that.inspectTemplate) + && Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(organization); + h *= 1000003; + h ^= Objects.hashCode(inspectTemplate); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + /** Builder for organizations/{organization}/inspectTemplates/{inspect_template}. */ public static class Builder { - private String organization; private String inspectTemplate; @@ -315,9 +345,8 @@ public Builder setInspectTemplate(String inspectTemplate) { private Builder(InspectTemplateName inspectTemplateName) { Preconditions.checkArgument( - inspectTemplateName.pathTemplate == ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE, - "toBuilder is only supported when InspectTemplateName has the pattern of " - + "organizations/{organization}/inspectTemplates/{inspect_template}."); + Objects.equals(inspectTemplateName.pathTemplate, ORGANIZATION_INSPECT_TEMPLATE), + "toBuilder is only supported when InspectTemplateName has the pattern of organizations/{organization}/inspectTemplates/{inspect_template}"); organization = inspectTemplateName.organization; inspectTemplate = inspectTemplateName.inspectTemplate; } @@ -330,11 +359,10 @@ public InspectTemplateName build() { /** Builder for projects/{project}/inspectTemplates/{inspect_template}. */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectInspectTemplateBuilder { - private String project; private String inspectTemplate; - private ProjectInspectTemplateBuilder() {} + protected ProjectInspectTemplateBuilder() {} public String getProject() { return project; @@ -365,12 +393,11 @@ public InspectTemplateName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationLocationInspectTemplateBuilder { - private String organization; private String location; private String inspectTemplate; - private OrganizationLocationInspectTemplateBuilder() {} + protected OrganizationLocationInspectTemplateBuilder() {} public String getOrganization() { return organization; @@ -407,12 +434,11 @@ public InspectTemplateName build() { /** Builder for projects/{project}/locations/{location}/inspectTemplates/{inspect_template}. */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationInspectTemplateBuilder { - private String project; private String location; private String inspectTemplate; - private ProjectLocationInspectTemplateBuilder() {} + protected ProjectLocationInspectTemplateBuilder() {} public String getProject() { return project; @@ -445,35 +471,4 @@ public InspectTemplateName build() { return new InspectTemplateName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - InspectTemplateName that = (InspectTemplateName) o; - return (Objects.equals(this.organization, that.organization)) - && (Objects.equals(this.inspectTemplate, that.inspectTemplate)) - && (Objects.equals(this.project, that.project)) - && (Objects.equals(this.location, that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(organization); - h *= 1000003; - h ^= Objects.hashCode(inspectTemplate); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/JobTriggerName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/JobTriggerName.java index 40f831d0..1a69a1ab 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/JobTriggerName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/JobTriggerName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -22,53 +22,58 @@ import com.google.api.resourcenames.ResourceName; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class JobTriggerName implements ResourceName { - - @Deprecated - protected JobTriggerName() {} - - private static final PathTemplate PROJECT_JOB_TRIGGER_PATH_TEMPLATE = + private static final PathTemplate PROJECT_JOB_TRIGGER = PathTemplate.createWithoutUrlEncoding("projects/{project}/jobTriggers/{job_trigger}"); - private static final PathTemplate PROJECT_LOCATION_JOB_TRIGGER_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_JOB_TRIGGER = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/jobTriggers/{job_trigger}"); - private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String project; + private final String jobTrigger; + private final String location; - private String project; - private String jobTrigger; - private String location; - - public String getProject() { - return project; - } - - public String getJobTrigger() { - return jobTrigger; - } - - public String getLocation() { - return location; + @Deprecated + protected JobTriggerName() { + project = null; + jobTrigger = null; + location = null; } private JobTriggerName(Builder builder) { project = Preconditions.checkNotNull(builder.getProject()); jobTrigger = Preconditions.checkNotNull(builder.getJobTrigger()); - pathTemplate = PROJECT_JOB_TRIGGER_PATH_TEMPLATE; + location = null; + pathTemplate = PROJECT_JOB_TRIGGER; } private JobTriggerName(ProjectLocationJobTriggerBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); location = Preconditions.checkNotNull(builder.getLocation()); jobTrigger = Preconditions.checkNotNull(builder.getJobTrigger()); - pathTemplate = PROJECT_LOCATION_JOB_TRIGGER_PATH_TEMPLATE; + pathTemplate = PROJECT_LOCATION_JOB_TRIGGER; + } + + public String getProject() { + return project; + } + + public String getJobTrigger() { + return jobTrigger; + } + + public String getLocation() { + return location; } public static Builder newBuilder() { @@ -90,12 +95,12 @@ public Builder toBuilder() { } public static JobTriggerName of(String project, String jobTrigger) { - return newProjectJobTriggerBuilder().setProject(project).setJobTrigger(jobTrigger).build(); + return newBuilder().setProject(project).setJobTrigger(jobTrigger).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static JobTriggerName ofProjectJobTriggerName(String project, String jobTrigger) { - return newProjectJobTriggerBuilder().setProject(project).setJobTrigger(jobTrigger).build(); + return newBuilder().setProject(project).setJobTrigger(jobTrigger).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") @@ -132,21 +137,40 @@ public static JobTriggerName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (PROJECT_JOB_TRIGGER_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = PROJECT_JOB_TRIGGER_PATH_TEMPLATE.match(formattedString); + if (PROJECT_JOB_TRIGGER.matches(formattedString)) { + Map matchMap = PROJECT_JOB_TRIGGER.match(formattedString); return ofProjectJobTriggerName(matchMap.get("project"), matchMap.get("job_trigger")); - } else if (PROJECT_LOCATION_JOB_TRIGGER_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - PROJECT_LOCATION_JOB_TRIGGER_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_LOCATION_JOB_TRIGGER.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_JOB_TRIGGER.match(formattedString); return ofProjectLocationJobTriggerName( matchMap.get("project"), matchMap.get("location"), matchMap.get("job_trigger")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException("JobTriggerName.parse: formattedString not in valid format"); + } + + 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 (JobTriggerName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; } public static boolean isParsableFrom(String formattedString) { - return PROJECT_JOB_TRIGGER_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_JOB_TRIGGER_PATH_TEMPLATE.matches(formattedString); + return PROJECT_JOB_TRIGGER.matches(formattedString) + || PROJECT_LOCATION_JOB_TRIGGER.matches(formattedString); } @Override @@ -180,9 +204,36 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + JobTriggerName that = ((JobTriggerName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.jobTrigger, that.jobTrigger) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(jobTrigger); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + /** Builder for projects/{project}/jobTriggers/{job_trigger}. */ public static class Builder { - private String project; private String jobTrigger; @@ -208,9 +259,8 @@ public Builder setJobTrigger(String jobTrigger) { private Builder(JobTriggerName jobTriggerName) { Preconditions.checkArgument( - jobTriggerName.pathTemplate == PROJECT_JOB_TRIGGER_PATH_TEMPLATE, - "toBuilder is only supported when JobTriggerName has the pattern of " - + "projects/{project}/jobTriggers/{job_trigger}."); + Objects.equals(jobTriggerName.pathTemplate, PROJECT_JOB_TRIGGER), + "toBuilder is only supported when JobTriggerName has the pattern of projects/{project}/jobTriggers/{job_trigger}"); project = jobTriggerName.project; jobTrigger = jobTriggerName.jobTrigger; } @@ -223,12 +273,11 @@ public JobTriggerName build() { /** Builder for projects/{project}/locations/{location}/jobTriggers/{job_trigger}. */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationJobTriggerBuilder { - private String project; private String location; private String jobTrigger; - private ProjectLocationJobTriggerBuilder() {} + protected ProjectLocationJobTriggerBuilder() {} public String getProject() { return project; @@ -261,32 +310,4 @@ public JobTriggerName build() { return new JobTriggerName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - JobTriggerName that = (JobTriggerName) o; - return (Objects.equals(this.project, that.project)) - && (Objects.equals(this.jobTrigger, that.jobTrigger)) - && (Objects.equals(this.location, that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(jobTrigger); - h *= 1000003; - h ^= Objects.hashCode(location); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/LocationName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/LocationName.java index 09157ce4..5baccab8 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/LocationName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/LocationName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class LocationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private LocationName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - } - public static LocationName of(String project, String location) { return newBuilder().setProject(project).setLocation(location).build(); } @@ -70,7 +75,7 @@ public static LocationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION.validatedMatch( formattedString, "LocationName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location); + return PROJECT_LOCATION.instantiate("project", project, "location", location); } - /** Builder for LocationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { private String project; private String location; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setLocation(String location) { return this; } - private Builder() {} - private Builder(LocationName locationName) { project = locationName.project; location = locationName.location; @@ -157,26 +189,4 @@ public LocationName build() { return new LocationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof LocationName) { - LocationName that = (LocationName) o; - return (this.project.equals(that.project)) && (this.location.equals(that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationLocationName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationLocationName.java index ba773c3b..ee747a2c 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationLocationName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationLocationName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class OrganizationLocationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION_LOCATION = PathTemplate.createWithoutUrlEncoding("organizations/{organization}/locations/{location}"); - private volatile Map fieldValuesMap; - private final String organization; private final String location; + @Deprecated + protected OrganizationLocationName() { + organization = null; + location = null; + } + + private OrganizationLocationName(Builder builder) { + organization = Preconditions.checkNotNull(builder.getOrganization()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + public String getOrganization() { return organization; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private OrganizationLocationName(Builder builder) { - organization = Preconditions.checkNotNull(builder.getOrganization()); - location = Preconditions.checkNotNull(builder.getLocation()); - } - public static OrganizationLocationName of(String organization, String location) { return newBuilder().setOrganization(organization).setLocation(location).build(); } @@ -70,7 +75,7 @@ public static OrganizationLocationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + ORGANIZATION_LOCATION.validatedMatch( formattedString, "OrganizationLocationName.parse: formattedString not in valid format"); return of(matchMap.get("organization"), matchMap.get("location")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStr } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (OrganizationLocationName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return ORGANIZATION_LOCATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("organization", organization); - fieldMapBuilder.put("location", location); + if (organization != null) { + fieldMapBuilder.put("organization", organization); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("organization", organization, "location", location); + return ORGANIZATION_LOCATION.instantiate("organization", organization, "location", location); } - /** Builder for OrganizationLocationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + OrganizationLocationName that = ((OrganizationLocationName) o); + return Objects.equals(this.organization, that.organization) + && Objects.equals(this.location, that.location); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(organization); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for organizations/{organization}/locations/{location}. */ + public static class Builder { private String organization; private String location; + protected Builder() {} + public String getOrganization() { return organization; } @@ -146,8 +180,6 @@ public Builder setLocation(String location) { return this; } - private Builder() {} - private Builder(OrganizationLocationName organizationLocationName) { organization = organizationLocationName.organization; location = organizationLocationName.location; @@ -157,26 +189,4 @@ public OrganizationLocationName build() { return new OrganizationLocationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof OrganizationLocationName) { - OrganizationLocationName that = (OrganizationLocationName) o; - return (this.organization.equals(that.organization)) && (this.location.equals(that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= organization.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationName.java index 027fcab7..4629a923 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/OrganizationName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,18 +23,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class OrganizationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION = PathTemplate.createWithoutUrlEncoding("organizations/{organization}"); - private volatile Map fieldValuesMap; - private final String organization; + @Deprecated + protected OrganizationName() { + organization = null; + } + + private OrganizationName(Builder builder) { + organization = Preconditions.checkNotNull(builder.getOrganization()); + } + public String getOrganization() { return organization; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private OrganizationName(Builder builder) { - organization = Preconditions.checkNotNull(builder.getOrganization()); - } - public static OrganizationName of(String organization) { return newBuilder().setOrganization(organization).build(); } @@ -64,7 +68,7 @@ public static OrganizationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + ORGANIZATION.validatedMatch( formattedString, "OrganizationName.parse: formattedString not in valid format"); return of(matchMap.get("organization")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (OrganizationName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return ORGANIZATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("organization", organization); + if (organization != null) { + fieldMapBuilder.put("organization", organization); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("organization", organization); + return ORGANIZATION.instantiate("organization", organization); } - /** Builder for OrganizationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + OrganizationName that = ((OrganizationName) o); + return Objects.equals(this.organization, that.organization); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(organization); + return h; + } + + /** Builder for organizations/{organization}. */ + public static class Builder { private String organization; + protected Builder() {} + public String getOrganization() { return organization; } @@ -129,8 +157,6 @@ public Builder setOrganization(String organization) { return this; } - private Builder() {} - private Builder(OrganizationName organizationName) { organization = organizationName.organization; } @@ -139,24 +165,4 @@ public OrganizationName build() { return new OrganizationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof OrganizationName) { - OrganizationName that = (OrganizationName) o; - return (this.organization.equals(that.organization)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= organization.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectName.java index c12416e2..76086752 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/ProjectName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,18 +23,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ProjectName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT = PathTemplate.createWithoutUrlEncoding("projects/{project}"); - private volatile Map fieldValuesMap; - private final String project; + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + public String getProject() { return project; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private ProjectName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - } - public static ProjectName of(String project) { return newBuilder().setProject(project).build(); } @@ -64,7 +68,7 @@ public static ProjectName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT.validatedMatch( formattedString, "ProjectName.parse: formattedString not in valid format"); return of(matchMap.get("project")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); + if (project != null) { + fieldMapBuilder.put("project", project); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project); + return PROJECT.instantiate("project", project); } - /** Builder for ProjectName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { private String project; + protected Builder() {} + public String getProject() { return project; } @@ -129,8 +157,6 @@ public Builder setProject(String project) { return this; } - private Builder() {} - private Builder(ProjectName projectName) { project = projectName.project; } @@ -139,24 +165,4 @@ public ProjectName build() { return new ProjectName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ProjectName) { - ProjectName that = (ProjectName) o; - return (this.project.equals(that.project)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java index b0878a91..3cd87d15 100644 --- a/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java +++ b/proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -24,76 +24,85 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class StoredInfoTypeName implements ResourceName { - - @Deprecated - protected StoredInfoTypeName() {} - - private static final PathTemplate ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION_STORED_INFO_TYPE = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/storedInfoTypes/{stored_info_type}"); - private static final PathTemplate PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_STORED_INFO_TYPE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/storedInfoTypes/{stored_info_type}"); - private static final PathTemplate ORGANIZATION_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE = + private static final PathTemplate ORGANIZATION_LOCATION_STORED_INFO_TYPE = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}"); - private static final PathTemplate PROJECT_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_STORED_INFO_TYPE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}"); - private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String organization; + private final String storedInfoType; + private final String project; + private final String location; - private String organization; - private String storedInfoType; - private String project; - private String location; - - public String getOrganization() { - return organization; - } - - public String getStoredInfoType() { - return storedInfoType; - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; + @Deprecated + protected StoredInfoTypeName() { + organization = null; + storedInfoType = null; + project = null; + location = null; } private StoredInfoTypeName(Builder builder) { organization = Preconditions.checkNotNull(builder.getOrganization()); storedInfoType = Preconditions.checkNotNull(builder.getStoredInfoType()); - pathTemplate = ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE; + project = null; + location = null; + pathTemplate = ORGANIZATION_STORED_INFO_TYPE; } private StoredInfoTypeName(ProjectStoredInfoTypeBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); storedInfoType = Preconditions.checkNotNull(builder.getStoredInfoType()); - pathTemplate = PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE; + organization = null; + location = null; + pathTemplate = PROJECT_STORED_INFO_TYPE; } private StoredInfoTypeName(OrganizationLocationStoredInfoTypeBuilder builder) { organization = Preconditions.checkNotNull(builder.getOrganization()); location = Preconditions.checkNotNull(builder.getLocation()); storedInfoType = Preconditions.checkNotNull(builder.getStoredInfoType()); - pathTemplate = ORGANIZATION_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE; + project = null; + pathTemplate = ORGANIZATION_LOCATION_STORED_INFO_TYPE; } private StoredInfoTypeName(ProjectLocationStoredInfoTypeBuilder builder) { project = Preconditions.checkNotNull(builder.getProject()); location = Preconditions.checkNotNull(builder.getLocation()); storedInfoType = Preconditions.checkNotNull(builder.getStoredInfoType()); - pathTemplate = PROJECT_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE; + organization = null; + pathTemplate = PROJECT_LOCATION_STORED_INFO_TYPE; + } + + public String getOrganization() { + return organization; + } + + public String getStoredInfoType() { + return storedInfoType; + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; } public static Builder newBuilder() { @@ -126,19 +135,13 @@ public Builder toBuilder() { } public static StoredInfoTypeName of(String organization, String storedInfoType) { - return newOrganizationStoredInfoTypeBuilder() - .setOrganization(organization) - .setStoredInfoType(storedInfoType) - .build(); + return newBuilder().setOrganization(organization).setStoredInfoType(storedInfoType).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static StoredInfoTypeName ofOrganizationStoredInfoTypeName( String organization, String storedInfoType) { - return newOrganizationStoredInfoTypeBuilder() - .setOrganization(organization) - .setStoredInfoType(storedInfoType) - .build(); + return newBuilder().setOrganization(organization).setStoredInfoType(storedInfoType).build(); } @BetaApi("The static create methods are not stable yet and may be changed in the future.") @@ -223,33 +226,30 @@ public static StoredInfoTypeName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE.match(formattedString); + if (ORGANIZATION_STORED_INFO_TYPE.matches(formattedString)) { + Map matchMap = ORGANIZATION_STORED_INFO_TYPE.match(formattedString); return ofOrganizationStoredInfoTypeName( matchMap.get("organization"), matchMap.get("stored_info_type")); - } else if (PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_STORED_INFO_TYPE.matches(formattedString)) { + Map matchMap = PROJECT_STORED_INFO_TYPE.match(formattedString); return ofProjectStoredInfoTypeName(matchMap.get("project"), matchMap.get("stored_info_type")); - } else if (ORGANIZATION_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - ORGANIZATION_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE.match(formattedString); + } else if (ORGANIZATION_LOCATION_STORED_INFO_TYPE.matches(formattedString)) { + Map matchMap = ORGANIZATION_LOCATION_STORED_INFO_TYPE.match(formattedString); return ofOrganizationLocationStoredInfoTypeName( matchMap.get("organization"), matchMap.get("location"), matchMap.get("stored_info_type")); - } else if (PROJECT_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - PROJECT_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE.match(formattedString); + } else if (PROJECT_LOCATION_STORED_INFO_TYPE.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_STORED_INFO_TYPE.match(formattedString); return ofProjectLocationStoredInfoTypeName( matchMap.get("project"), matchMap.get("location"), matchMap.get("stored_info_type")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException("StoredInfoTypeName.parse: formattedString not in valid format"); } public static boolean isParsableFrom(String formattedString) { - return ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString) - || ORGANIZATION_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_STORED_INFO_TYPE_PATH_TEMPLATE.matches(formattedString); + return ORGANIZATION_STORED_INFO_TYPE.matches(formattedString) + || PROJECT_STORED_INFO_TYPE.matches(formattedString) + || ORGANIZATION_LOCATION_STORED_INFO_TYPE.matches(formattedString) + || PROJECT_LOCATION_STORED_INFO_TYPE.matches(formattedString); } @Override @@ -286,9 +286,39 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + StoredInfoTypeName that = ((StoredInfoTypeName) o); + return Objects.equals(this.organization, that.organization) + && Objects.equals(this.storedInfoType, that.storedInfoType) + && Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(organization); + h *= 1000003; + h ^= Objects.hashCode(storedInfoType); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + /** Builder for organizations/{organization}/storedInfoTypes/{stored_info_type}. */ public static class Builder { - private String organization; private String storedInfoType; @@ -314,9 +344,8 @@ public Builder setStoredInfoType(String storedInfoType) { private Builder(StoredInfoTypeName storedInfoTypeName) { Preconditions.checkArgument( - storedInfoTypeName.pathTemplate == ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE, - "toBuilder is only supported when StoredInfoTypeName has the pattern of " - + "organizations/{organization}/storedInfoTypes/{stored_info_type}."); + Objects.equals(storedInfoTypeName.pathTemplate, ORGANIZATION_STORED_INFO_TYPE), + "toBuilder is only supported when StoredInfoTypeName has the pattern of organizations/{organization}/storedInfoTypes/{stored_info_type}"); organization = storedInfoTypeName.organization; storedInfoType = storedInfoTypeName.storedInfoType; } @@ -329,11 +358,10 @@ public StoredInfoTypeName build() { /** Builder for projects/{project}/storedInfoTypes/{stored_info_type}. */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectStoredInfoTypeBuilder { - private String project; private String storedInfoType; - private ProjectStoredInfoTypeBuilder() {} + protected ProjectStoredInfoTypeBuilder() {} public String getProject() { return project; @@ -364,12 +392,11 @@ public StoredInfoTypeName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationLocationStoredInfoTypeBuilder { - private String organization; private String location; private String storedInfoType; - private OrganizationLocationStoredInfoTypeBuilder() {} + protected OrganizationLocationStoredInfoTypeBuilder() {} public String getOrganization() { return organization; @@ -406,12 +433,11 @@ public StoredInfoTypeName build() { /** Builder for projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}. */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationStoredInfoTypeBuilder { - private String project; private String location; private String storedInfoType; - private ProjectLocationStoredInfoTypeBuilder() {} + protected ProjectLocationStoredInfoTypeBuilder() {} public String getProject() { return project; @@ -444,35 +470,4 @@ public StoredInfoTypeName build() { return new StoredInfoTypeName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - StoredInfoTypeName that = (StoredInfoTypeName) o; - return (Objects.equals(this.organization, that.organization)) - && (Objects.equals(this.storedInfoType, that.storedInfoType)) - && (Objects.equals(this.project, that.project)) - && (Objects.equals(this.location, that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(organization); - h *= 1000003; - h ^= Objects.hashCode(storedInfoType); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - return h; - } } diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 0180f8c0..f68e3fd5 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-dlp - 2.2.4 + 2.2.5 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 8b21fce2..4f8a0945 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-dlp - 2.2.5 + 2.2.6 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 1daedb4a..d4401800 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 16.2.0 + 16.2.1 pom import diff --git a/synth.metadata b/synth.metadata index 350a0ed2..47976760 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-dlp.git", - "sha": "0a434339f3f0b6d083f7ad58b3fa861bfd7c5ec2" + "sha": "e625505d60f694012aa4359b2e33f51391d6c8da" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "795f0cacce3799e04fa2fe06590216eec4a5ba52", - "internalRef": "336694775" + "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", + "internalRef": "350949863" } }, { @@ -200,6 +200,7 @@ "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeleteJobTriggerRequestOrBuilder.java", "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeleteStoredInfoTypeRequest.java", "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeleteStoredInfoTypeRequestOrBuilder.java", + "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpContentName.java", "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpJob.java", "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpJobName.java", "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DlpJobOrBuilder.java", diff --git a/synth.py b/synth.py index d0b5b059..09fb95ff 100644 --- a/synth.py +++ b/synth.py @@ -30,6 +30,35 @@ destination_name='dlp', ) +# TODO: remove this for the next semver major release +# remove ResourceName base parseList and toStringList for backward-compatibility with legacy +# resource name implementation +java.remove_method( + "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java", + "public static List parseList(List formattedStrings)" +) +java.remove_method( + "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java", + "public static List toStringList(List values)" +) +java.remove_method( + "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java", + "public static List parseList(List formattedStrings)" +) +java.remove_method( + "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java", + "public static List toStringList(List values)" +) +java.remove_method( + "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java", + "public static List parseList(List formattedStrings)" +) +java.remove_method( + "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java", + "public static List toStringList(List values)" +) +java.format_code("proto-google-cloud-dlp-v2") + java.common_templates(excludes=[ '.kokoro/presubmit/samples.cfg', '.kokoro/nightly/samples.cfg', diff --git a/versions.txt b/versions.txt index 61309225..aca0245f 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -proto-google-cloud-dlp-v2:2.2.5:2.2.5 -grpc-google-cloud-dlp-v2:2.2.5:2.2.5 -google-cloud-dlp:2.2.5:2.2.5 +proto-google-cloud-dlp-v2:2.2.6:2.2.6 +grpc-google-cloud-dlp-v2:2.2.6:2.2.6 +google-cloud-dlp:2.2.6:2.2.6