diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java index 1ed88581..bf4e0adb 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java @@ -53,6 +53,14 @@ *
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: * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * ResourceName resource = ProjectName.of("[PROJECT]"); + * Policy policy = Policy.newBuilder().build(); + * Policy response = containerAnalysisClient.setIamPolicy(resource, policy); + * } + * }+ * *
Note: close() needs to be called on the ContainerAnalysisClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -172,6 +180,16 @@ public ContainerAnalysisStub getStub() { *
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * ResourceName resource = ProjectName.of("[PROJECT]"); + * Policy policy = Policy.newBuilder().build(); + * Policy response = containerAnalysisClient.setIamPolicy(resource, policy); + * } + * }+ * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -197,6 +215,16 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { *
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * String resource = ProjectName.of("[PROJECT]").toString(); + * Policy policy = Policy.newBuilder().build(); + * Policy response = containerAnalysisClient.setIamPolicy(resource, policy); + * } + * }+ * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -219,6 +247,19 @@ public final Policy setIamPolicy(String resource, Policy policy) { *
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource(ProjectName.of("[PROJECT]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .build(); + * Policy response = containerAnalysisClient.setIamPolicy(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 */ @@ -236,6 +277,19 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource(ProjectName.of("[PROJECT]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = containerAnalysisClient.setIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * ResourceName resource = ProjectName.of("[PROJECT]"); + * Policy response = containerAnalysisClient.getIamPolicy(resource); + * } + * }+ * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -271,6 +334,15 @@ public final Policy getIamPolicy(ResourceName resource) { *
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * String resource = ProjectName.of("[PROJECT]").toString(); + * Policy response = containerAnalysisClient.getIamPolicy(resource); + * } + * }+ * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -289,6 +361,19 @@ public final Policy getIamPolicy(String resource) { *
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource(ProjectName.of("[PROJECT]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * Policy response = containerAnalysisClient.getIamPolicy(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 */ @@ -306,6 +391,19 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource(ProjectName.of("[PROJECT]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = containerAnalysisClient.getIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * ResourceName resource = ProjectName.of("[PROJECT]"); + * List+ * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -344,6 +453,17 @@ public final TestIamPermissionsResponse testIamPermissions( *permissions = new ArrayList<>(); + * TestIamPermissionsResponse response = + * containerAnalysisClient.testIamPermissions(resource, permissions); + * } + * }
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * String resource = ProjectName.of("[PROJECT]").toString(); + * List+ * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -369,6 +489,19 @@ public final TestIamPermissionsResponse testIamPermissions( *permissions = new ArrayList<>(); + * TestIamPermissionsResponse response = + * containerAnalysisClient.testIamPermissions(resource, permissions); + * } + * }
The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource(ProjectName.of("[PROJECT]").toString()) + * .addAllPermissions(new ArrayList+ * * @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 */ @@ -385,6 +518,20 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * *()) + * .build(); + * TestIamPermissionsResponse response = containerAnalysisClient.testIamPermissions(request); + * } + * }
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource(ProjectName.of("[PROJECT]").toString()) + * .addAllPermissions(new ArrayList*/ public final UnaryCallable()) + * .build(); + * ApiFuture future = + * containerAnalysisClient.testIamPermissionsCallable().futureCall(request); + * // Do something. + * TestIamPermissionsResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * ProjectName parent = ProjectName.of("[PROJECT]"); + * String filter = "filter-1274492040"; + * VulnerabilityOccurrencesSummary response = + * containerAnalysisClient.getVulnerabilityOccurrencesSummary(parent, filter); + * } + * }+ * * @param parent The name of the project to get a vulnerability summary for in the form of * `projects/[PROJECT_ID]`. * @param filter The filter expression. @@ -414,6 +572,17 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( /** * Gets a summary of the number and severity of occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * String parent = ProjectName.of("[PROJECT]").toString(); + * String filter = "filter-1274492040"; + * VulnerabilityOccurrencesSummary response = + * containerAnalysisClient.getVulnerabilityOccurrencesSummary(parent, filter); + * } + * }+ * * @param parent The name of the project to get a vulnerability summary for in the form of * `projects/[PROJECT_ID]`. * @param filter The filter expression. @@ -433,6 +602,20 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( /** * Gets a summary of the number and severity of occurrences. * + *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * GetVulnerabilityOccurrencesSummaryRequest request = + * GetVulnerabilityOccurrencesSummaryRequest.newBuilder() + * .setParent(ProjectName.of("[PROJECT]").toString()) + * .setFilter("filter-1274492040") + * .build(); + * VulnerabilityOccurrencesSummary response = + * containerAnalysisClient.getVulnerabilityOccurrencesSummary(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 */ @@ -446,6 +629,20 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( * Gets a summary of the number and severity of occurrences. * *
Sample code: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * GetVulnerabilityOccurrencesSummaryRequest request = + * GetVulnerabilityOccurrencesSummaryRequest.newBuilder() + * .setParent(ProjectName.of("[PROJECT]").toString()) + * .setFilter("filter-1274492040") + * .build(); + * ApiFuture*/ public final UnaryCallable< GetVulnerabilityOccurrencesSummaryRequest, VulnerabilityOccurrencesSummary> diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java index 20d05f6c..597ebd66 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java @@ -32,6 +32,14 @@ * to that note. * *future = + * containerAnalysisClient.getVulnerabilityOccurrencesSummaryCallable().futureCall(request); + * // Do something. + * VulnerabilityOccurrencesSummary response = future.get(); + * } + * }
Sample for ContainerAnalysisClient: + * + *
{@code + * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) { + * ResourceName resource = ProjectName.of("[PROJECT]"); + * Policy policy = Policy.newBuilder().build(); + * Policy response = containerAnalysisClient.setIamPolicy(resource, policy); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.devtools.containeranalysis.v1; diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java index 8bca88c1..051df17e 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java @@ -226,19 +226,23 @@ public GrpcOperationsStub getOperationsStub() { return operationsStub; } + @Override public UnaryCallable