5353 * <p>This class provides the ability to make remote calls to the backing service through method
5454 * calls that map to API methods. Sample code to get started:
5555 *
56+ * <pre>{@code
57+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
58+ * ResourceName resource = ProjectName.of("[PROJECT]");
59+ * Policy policy = Policy.newBuilder().build();
60+ * Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
61+ * }
62+ * }</pre>
63+ *
5664 * <p>Note: close() needs to be called on the ContainerAnalysisClient object to clean up resources
5765 * such as threads. In the example above, try-with-resources is used, which automatically calls
5866 * close().
@@ -172,6 +180,16 @@ public ContainerAnalysisStub getStub() {
172180 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
173181 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
174182 *
183+ * <p>Sample code:
184+ *
185+ * <pre>{@code
186+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
187+ * ResourceName resource = ProjectName.of("[PROJECT]");
188+ * Policy policy = Policy.newBuilder().build();
189+ * Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
190+ * }
191+ * }</pre>
192+ *
175193 * @param resource REQUIRED: The resource for which the policy is being specified. See the
176194 * operation documentation for the appropriate value for this field.
177195 * @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) {
197215 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
198216 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
199217 *
218+ * <p>Sample code:
219+ *
220+ * <pre>{@code
221+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
222+ * String resource = ProjectName.of("[PROJECT]").toString();
223+ * Policy policy = Policy.newBuilder().build();
224+ * Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
225+ * }
226+ * }</pre>
227+ *
200228 * @param resource REQUIRED: The resource for which the policy is being specified. See the
201229 * operation documentation for the appropriate value for this field.
202230 * @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) {
219247 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
220248 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
221249 *
250+ * <p>Sample code:
251+ *
252+ * <pre>{@code
253+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
254+ * SetIamPolicyRequest request =
255+ * SetIamPolicyRequest.newBuilder()
256+ * .setResource(ProjectName.of("[PROJECT]").toString())
257+ * .setPolicy(Policy.newBuilder().build())
258+ * .build();
259+ * Policy response = containerAnalysisClient.setIamPolicy(request);
260+ * }
261+ * }</pre>
262+ *
222263 * @param request The request object containing all of the parameters for the API call.
223264 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
224265 */
@@ -236,6 +277,19 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
236277 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
237278 *
238279 * <p>Sample code:
280+ *
281+ * <pre>{@code
282+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
283+ * SetIamPolicyRequest request =
284+ * SetIamPolicyRequest.newBuilder()
285+ * .setResource(ProjectName.of("[PROJECT]").toString())
286+ * .setPolicy(Policy.newBuilder().build())
287+ * .build();
288+ * ApiFuture<Policy> future = containerAnalysisClient.setIamPolicyCallable().futureCall(request);
289+ * // Do something.
290+ * Policy response = future.get();
291+ * }
292+ * }</pre>
239293 */
240294 public final UnaryCallable <SetIamPolicyRequest , Policy > setIamPolicyCallable () {
241295 return stub .setIamPolicyCallable ();
@@ -250,6 +304,15 @@ public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
250304 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
251305 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
252306 *
307+ * <p>Sample code:
308+ *
309+ * <pre>{@code
310+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
311+ * ResourceName resource = ProjectName.of("[PROJECT]");
312+ * Policy response = containerAnalysisClient.getIamPolicy(resource);
313+ * }
314+ * }</pre>
315+ *
253316 * @param resource REQUIRED: The resource for which the policy is being requested. See the
254317 * operation documentation for the appropriate value for this field.
255318 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -271,6 +334,15 @@ public final Policy getIamPolicy(ResourceName resource) {
271334 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
272335 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
273336 *
337+ * <p>Sample code:
338+ *
339+ * <pre>{@code
340+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
341+ * String resource = ProjectName.of("[PROJECT]").toString();
342+ * Policy response = containerAnalysisClient.getIamPolicy(resource);
343+ * }
344+ * }</pre>
345+ *
274346 * @param resource REQUIRED: The resource for which the policy is being requested. See the
275347 * operation documentation for the appropriate value for this field.
276348 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -289,6 +361,19 @@ public final Policy getIamPolicy(String resource) {
289361 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
290362 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
291363 *
364+ * <p>Sample code:
365+ *
366+ * <pre>{@code
367+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
368+ * GetIamPolicyRequest request =
369+ * GetIamPolicyRequest.newBuilder()
370+ * .setResource(ProjectName.of("[PROJECT]").toString())
371+ * .setOptions(GetPolicyOptions.newBuilder().build())
372+ * .build();
373+ * Policy response = containerAnalysisClient.getIamPolicy(request);
374+ * }
375+ * }</pre>
376+ *
292377 * @param request The request object containing all of the parameters for the API call.
293378 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
294379 */
@@ -306,6 +391,19 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
306391 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
307392 *
308393 * <p>Sample code:
394+ *
395+ * <pre>{@code
396+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
397+ * GetIamPolicyRequest request =
398+ * GetIamPolicyRequest.newBuilder()
399+ * .setResource(ProjectName.of("[PROJECT]").toString())
400+ * .setOptions(GetPolicyOptions.newBuilder().build())
401+ * .build();
402+ * ApiFuture<Policy> future = containerAnalysisClient.getIamPolicyCallable().futureCall(request);
403+ * // Do something.
404+ * Policy response = future.get();
405+ * }
406+ * }</pre>
309407 */
310408 public final UnaryCallable <GetIamPolicyRequest , Policy > getIamPolicyCallable () {
311409 return stub .getIamPolicyCallable ();
@@ -319,6 +417,17 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
319417 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
320418 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
321419 *
420+ * <p>Sample code:
421+ *
422+ * <pre>{@code
423+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
424+ * ResourceName resource = ProjectName.of("[PROJECT]");
425+ * List<String> permissions = new ArrayList<>();
426+ * TestIamPermissionsResponse response =
427+ * containerAnalysisClient.testIamPermissions(resource, permissions);
428+ * }
429+ * }</pre>
430+ *
322431 * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
323432 * operation documentation for the appropriate value for this field.
324433 * @param permissions The set of permissions to check for the `resource`. Permissions with
@@ -344,6 +453,17 @@ public final TestIamPermissionsResponse testIamPermissions(
344453 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
345454 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
346455 *
456+ * <p>Sample code:
457+ *
458+ * <pre>{@code
459+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
460+ * String resource = ProjectName.of("[PROJECT]").toString();
461+ * List<String> permissions = new ArrayList<>();
462+ * TestIamPermissionsResponse response =
463+ * containerAnalysisClient.testIamPermissions(resource, permissions);
464+ * }
465+ * }</pre>
466+ *
347467 * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
348468 * operation documentation for the appropriate value for this field.
349469 * @param permissions The set of permissions to check for the `resource`. Permissions with
@@ -369,6 +489,19 @@ public final TestIamPermissionsResponse testIamPermissions(
369489 * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
370490 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
371491 *
492+ * <p>Sample code:
493+ *
494+ * <pre>{@code
495+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
496+ * TestIamPermissionsRequest request =
497+ * TestIamPermissionsRequest.newBuilder()
498+ * .setResource(ProjectName.of("[PROJECT]").toString())
499+ * .addAllPermissions(new ArrayList<String>())
500+ * .build();
501+ * TestIamPermissionsResponse response = containerAnalysisClient.testIamPermissions(request);
502+ * }
503+ * }</pre>
504+ *
372505 * @param request The request object containing all of the parameters for the API call.
373506 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
374507 */
@@ -385,6 +518,20 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
385518 * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
386519 *
387520 * <p>Sample code:
521+ *
522+ * <pre>{@code
523+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
524+ * TestIamPermissionsRequest request =
525+ * TestIamPermissionsRequest.newBuilder()
526+ * .setResource(ProjectName.of("[PROJECT]").toString())
527+ * .addAllPermissions(new ArrayList<String>())
528+ * .build();
529+ * ApiFuture<TestIamPermissionsResponse> future =
530+ * containerAnalysisClient.testIamPermissionsCallable().futureCall(request);
531+ * // Do something.
532+ * TestIamPermissionsResponse response = future.get();
533+ * }
534+ * }</pre>
388535 */
389536 public final UnaryCallable <TestIamPermissionsRequest , TestIamPermissionsResponse >
390537 testIamPermissionsCallable () {
@@ -395,6 +542,17 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
395542 /**
396543 * Gets a summary of the number and severity of occurrences.
397544 *
545+ * <p>Sample code:
546+ *
547+ * <pre>{@code
548+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
549+ * ProjectName parent = ProjectName.of("[PROJECT]");
550+ * String filter = "filter-1274492040";
551+ * VulnerabilityOccurrencesSummary response =
552+ * containerAnalysisClient.getVulnerabilityOccurrencesSummary(parent, filter);
553+ * }
554+ * }</pre>
555+ *
398556 * @param parent The name of the project to get a vulnerability summary for in the form of
399557 * `projects/[PROJECT_ID]`.
400558 * @param filter The filter expression.
@@ -414,6 +572,17 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary(
414572 /**
415573 * Gets a summary of the number and severity of occurrences.
416574 *
575+ * <p>Sample code:
576+ *
577+ * <pre>{@code
578+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
579+ * String parent = ProjectName.of("[PROJECT]").toString();
580+ * String filter = "filter-1274492040";
581+ * VulnerabilityOccurrencesSummary response =
582+ * containerAnalysisClient.getVulnerabilityOccurrencesSummary(parent, filter);
583+ * }
584+ * }</pre>
585+ *
417586 * @param parent The name of the project to get a vulnerability summary for in the form of
418587 * `projects/[PROJECT_ID]`.
419588 * @param filter The filter expression.
@@ -433,6 +602,20 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary(
433602 /**
434603 * Gets a summary of the number and severity of occurrences.
435604 *
605+ * <p>Sample code:
606+ *
607+ * <pre>{@code
608+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
609+ * GetVulnerabilityOccurrencesSummaryRequest request =
610+ * GetVulnerabilityOccurrencesSummaryRequest.newBuilder()
611+ * .setParent(ProjectName.of("[PROJECT]").toString())
612+ * .setFilter("filter-1274492040")
613+ * .build();
614+ * VulnerabilityOccurrencesSummary response =
615+ * containerAnalysisClient.getVulnerabilityOccurrencesSummary(request);
616+ * }
617+ * }</pre>
618+ *
436619 * @param request The request object containing all of the parameters for the API call.
437620 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
438621 */
@@ -446,6 +629,20 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary(
446629 * Gets a summary of the number and severity of occurrences.
447630 *
448631 * <p>Sample code:
632+ *
633+ * <pre>{@code
634+ * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
635+ * GetVulnerabilityOccurrencesSummaryRequest request =
636+ * GetVulnerabilityOccurrencesSummaryRequest.newBuilder()
637+ * .setParent(ProjectName.of("[PROJECT]").toString())
638+ * .setFilter("filter-1274492040")
639+ * .build();
640+ * ApiFuture<VulnerabilityOccurrencesSummary> future =
641+ * containerAnalysisClient.getVulnerabilityOccurrencesSummaryCallable().futureCall(request);
642+ * // Do something.
643+ * VulnerabilityOccurrencesSummary response = future.get();
644+ * }
645+ * }</pre>
449646 */
450647 public final UnaryCallable <
451648 GetVulnerabilityOccurrencesSummaryRequest , VulnerabilityOccurrencesSummary >
0 commit comments