diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java index 8fdf7ea95..886f3acaa 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java @@ -85,6 +85,18 @@ *

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 (ConfigClient configClient = ConfigClient.create()) {
+ *   GetBucketRequest request =
+ *       GetBucketRequest.newBuilder()
+ *           .setName(
+ *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+ *                   .toString())
+ *           .build();
+ *   LogBucket response = configClient.getBucket(request);
+ * }
+ * }
+ * *

Note: close() needs to be called on the ConfigClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -185,6 +197,18 @@ public ConfigServiceV2Stub getStub() { /** * Lists buckets. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   BillingAccountLocationName parent =
+   *       BillingAccountLocationName.of("[BILLING_ACCOUNT]", "[LOCATION]");
+   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose buckets are to be listed: *

"projects/[PROJECT_ID]/locations/[LOCATION_ID]" * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" @@ -206,6 +230,17 @@ public final ListBucketsPagedResponse listBuckets(BillingAccountLocationName par /** * Lists buckets. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
+   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose buckets are to be listed: *

"projects/[PROJECT_ID]/locations/[LOCATION_ID]" * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" @@ -227,6 +262,17 @@ public final ListBucketsPagedResponse listBuckets(FolderLocationName parent) { /** * Lists buckets. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose buckets are to be listed: *

"projects/[PROJECT_ID]/locations/[LOCATION_ID]" * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" @@ -248,6 +294,17 @@ public final ListBucketsPagedResponse listBuckets(LocationName parent) { /** * Lists buckets. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
+   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose buckets are to be listed: *

"projects/[PROJECT_ID]/locations/[LOCATION_ID]" * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" @@ -269,6 +326,19 @@ public final ListBucketsPagedResponse listBuckets(OrganizationLocationName paren /** * Lists buckets. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String parent =
+   *       LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *           .toString();
+   *   for (LogBucket element : configClient.listBuckets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose buckets are to be listed: *

"projects/[PROJECT_ID]/locations/[LOCATION_ID]" * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" @@ -287,6 +357,24 @@ public final ListBucketsPagedResponse listBuckets(String parent) { /** * Lists buckets. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListBucketsRequest request =
+   *       ListBucketsRequest.newBuilder()
+   *           .setParent(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (LogBucket element : configClient.listBuckets(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 */ @@ -299,6 +387,24 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) { * Lists buckets. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListBucketsRequest request =
+   *       ListBucketsRequest.newBuilder()
+   *           .setParent(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future = configClient.listBucketsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (LogBucket element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listBucketsPagedCallable() { @@ -310,6 +416,23 @@ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) { * Lists buckets. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   while (true) {
+   *     ListBucketsResponse response = configClient.listBucketsCallable().call(request);
+   *     for (LogBucket element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listBucketsCallable() { return stub.listBucketsCallable(); @@ -319,6 +442,20 @@ public final UnaryCallable listBucketsC /** * Gets a bucket. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetBucketRequest request =
+   *       GetBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .build();
+   *   LogBucket response = configClient.getBucket(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 */ @@ -331,6 +468,20 @@ public final LogBucket getBucket(GetBucketRequest request) { * Gets a bucket. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetBucketRequest request =
+   *       GetBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = configClient.getBucketCallable().futureCall(request);
+   *   // Do something.
+   *   LogBucket response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getBucketCallable() { return stub.getBucketCallable(); @@ -341,6 +492,22 @@ public final UnaryCallable getBucketCallable() { * Creates a bucket that can be used to store log entries. Once a bucket has been created, the * region cannot be changed. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateBucketRequest request =
+   *       CreateBucketRequest.newBuilder()
+   *           .setParent(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .setBucketId("bucketId-1603305307")
+   *           .setBucket(LogBucket.newBuilder().build())
+   *           .build();
+   *   LogBucket response = configClient.createBucket(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 */ @@ -354,6 +521,22 @@ public final LogBucket createBucket(CreateBucketRequest request) { * region cannot be changed. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateBucketRequest request =
+   *       CreateBucketRequest.newBuilder()
+   *           .setParent(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .setBucketId("bucketId-1603305307")
+   *           .setBucket(LogBucket.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = configClient.createBucketCallable().futureCall(request);
+   *   // Do something.
+   *   LogBucket response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createBucketCallable() { return stub.createBucketCallable(); @@ -372,6 +555,22 @@ public final UnaryCallable createBucketCallable( * *

A buckets region may not be modified after it is created. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateBucketRequest request =
+   *       UpdateBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .setBucket(LogBucket.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   LogBucket response = configClient.updateBucket(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 */ @@ -393,6 +592,22 @@ public final LogBucket updateBucket(UpdateBucketRequest request) { *

A buckets region may not be modified after it is created. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateBucketRequest request =
+   *       UpdateBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .setBucket(LogBucket.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = configClient.updateBucketCallable().futureCall(request);
+   *   // Do something.
+   *   LogBucket response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateBucketCallable() { return stub.updateBucketCallable(); @@ -403,6 +618,20 @@ public final UnaryCallable updateBucketCallable( * Deletes a bucket. Moves the bucket to the DELETE_REQUESTED state. After 7 days, the bucket will * be purged and all logs in the bucket will be permanently deleted. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteBucketRequest request =
+   *       DeleteBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .build();
+   *   configClient.deleteBucket(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 */ @@ -416,6 +645,20 @@ public final void deleteBucket(DeleteBucketRequest request) { * be purged and all logs in the bucket will be permanently deleted. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteBucketRequest request =
+   *       DeleteBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = configClient.deleteBucketCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteBucketCallable() { return stub.deleteBucketCallable(); @@ -426,6 +669,20 @@ public final UnaryCallable deleteBucketCallable() { * Undeletes a bucket. A bucket that has been deleted may be undeleted within the grace period of * 7 days. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UndeleteBucketRequest request =
+   *       UndeleteBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .build();
+   *   configClient.undeleteBucket(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 */ @@ -439,6 +696,20 @@ public final void undeleteBucket(UndeleteBucketRequest request) { * 7 days. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UndeleteBucketRequest request =
+   *       UndeleteBucketRequest.newBuilder()
+   *           .setName(
+   *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = configClient.undeleteBucketCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable undeleteBucketCallable() { return stub.undeleteBucketCallable(); @@ -448,6 +719,17 @@ public final UnaryCallable undeleteBucketCallable( /** * Lists views on a bucket. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String parent = "parent-995424086";
+   *   for (LogView element : configClient.listViews(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The bucket whose views are to be listed: *

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -461,6 +743,22 @@ public final ListViewsPagedResponse listViews(String parent) { /** * Lists views on a bucket. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListViewsRequest request =
+   *       ListViewsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (LogView element : configClient.listViews(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 */ @@ -473,6 +771,22 @@ public final ListViewsPagedResponse listViews(ListViewsRequest request) { * Lists views on a bucket. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListViewsRequest request =
+   *       ListViewsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future = configClient.listViewsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (LogView element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listViewsPagedCallable() { return stub.listViewsPagedCallable(); @@ -483,6 +797,23 @@ public final UnaryCallable listViewsPa * Lists views on a bucket. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   while (true) {
+   *     ListViewsResponse response = configClient.listViewsCallable().call(request);
+   *     for (LogView element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listViewsCallable() { return stub.listViewsCallable(); @@ -492,6 +823,21 @@ public final UnaryCallable listViewsCallabl /** * Gets a view. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetViewRequest request =
+   *       GetViewRequest.newBuilder()
+   *           .setName(
+   *               LogViewName.ofProjectLocationBucketViewName(
+   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                   .toString())
+   *           .build();
+   *   LogView response = configClient.getView(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 */ @@ -504,6 +850,21 @@ public final LogView getView(GetViewRequest request) { * Gets a view. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetViewRequest request =
+   *       GetViewRequest.newBuilder()
+   *           .setName(
+   *               LogViewName.ofProjectLocationBucketViewName(
+   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = configClient.getViewCallable().futureCall(request);
+   *   // Do something.
+   *   LogView response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getViewCallable() { return stub.getViewCallable(); @@ -513,6 +874,20 @@ public final UnaryCallable getViewCallable() { /** * Creates a view over logs in a bucket. A bucket may contain a maximum of 50 views. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateViewRequest request =
+   *       CreateViewRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setViewId("viewId-816632160")
+   *           .setView(LogView.newBuilder().build())
+   *           .build();
+   *   LogView response = configClient.createView(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 */ @@ -525,6 +900,20 @@ public final LogView createView(CreateViewRequest request) { * Creates a view over logs in a bucket. A bucket may contain a maximum of 50 views. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateViewRequest request =
+   *       CreateViewRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setViewId("viewId-816632160")
+   *           .setView(LogView.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = configClient.createViewCallable().futureCall(request);
+   *   // Do something.
+   *   LogView response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createViewCallable() { return stub.createViewCallable(); @@ -535,6 +924,20 @@ public final UnaryCallable createViewCallable() { * Updates a view. This method replaces the following fields in the existing view with values from * the new view: `filter`. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateViewRequest request =
+   *       UpdateViewRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setView(LogView.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   LogView response = configClient.updateView(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 */ @@ -548,6 +951,20 @@ public final LogView updateView(UpdateViewRequest request) { * the new view: `filter`. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateViewRequest request =
+   *       UpdateViewRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setView(LogView.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = configClient.updateViewCallable().futureCall(request);
+   *   // Do something.
+   *   LogView response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateViewCallable() { return stub.updateViewCallable(); @@ -557,6 +974,21 @@ public final UnaryCallable updateViewCallable() { /** * Deletes a view from a bucket. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteViewRequest request =
+   *       DeleteViewRequest.newBuilder()
+   *           .setName(
+   *               LogViewName.ofProjectLocationBucketViewName(
+   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                   .toString())
+   *           .build();
+   *   configClient.deleteView(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 */ @@ -569,6 +1001,21 @@ public final void deleteView(DeleteViewRequest request) { * Deletes a view from a bucket. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteViewRequest request =
+   *       DeleteViewRequest.newBuilder()
+   *           .setName(
+   *               LogViewName.ofProjectLocationBucketViewName(
+   *                       "[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = configClient.deleteViewCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteViewCallable() { return stub.deleteViewCallable(); @@ -578,6 +1025,17 @@ public final UnaryCallable deleteViewCallable() { /** * Lists sinks. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose sinks are to be listed: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -593,6 +1051,17 @@ public final ListSinksPagedResponse listSinks(BillingAccountName parent) { /** * Lists sinks. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   FolderName parent = FolderName.of("[FOLDER]");
+   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose sinks are to be listed: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -608,6 +1077,17 @@ public final ListSinksPagedResponse listSinks(FolderName parent) { /** * Lists sinks. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose sinks are to be listed: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -623,6 +1103,17 @@ public final ListSinksPagedResponse listSinks(OrganizationName parent) { /** * Lists sinks. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose sinks are to be listed: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -638,6 +1129,17 @@ public final ListSinksPagedResponse listSinks(ProjectName parent) { /** * Lists sinks. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String parent = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *   for (LogSink element : configClient.listSinks(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose sinks are to be listed: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -652,6 +1154,22 @@ public final ListSinksPagedResponse listSinks(String parent) { /** * Lists sinks. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListSinksRequest request =
+   *       ListSinksRequest.newBuilder()
+   *           .setParent(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (LogSink element : configClient.listSinks(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 */ @@ -664,6 +1182,22 @@ public final ListSinksPagedResponse listSinks(ListSinksRequest request) { * Lists sinks. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListSinksRequest request =
+   *       ListSinksRequest.newBuilder()
+   *           .setParent(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future = configClient.listSinksPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (LogSink element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listSinksPagedCallable() { return stub.listSinksPagedCallable(); @@ -674,6 +1208,23 @@ public final UnaryCallable listSinksPa * Lists sinks. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   while (true) {
+   *     ListSinksResponse response = configClient.listSinksCallable().call(request);
+   *     for (LogSink element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listSinksCallable() { return stub.listSinksCallable(); @@ -683,6 +1234,15 @@ public final UnaryCallable listSinksCallabl /** * Gets a sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *   LogSink response = configClient.getSink(sinkName);
+   * }
+   * }
+ * * @param sinkName Required. The resource name of the sink: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" @@ -703,6 +1263,15 @@ public final LogSink getSink(LogSinkName sinkName) { /** * Gets a sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *   LogSink response = configClient.getSink(sinkName);
+   * }
+   * }
+ * * @param sinkName Required. The resource name of the sink: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" @@ -720,6 +1289,18 @@ public final LogSink getSink(String sinkName) { /** * Gets a sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetSinkRequest request =
+   *       GetSinkRequest.newBuilder()
+   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .build();
+   *   LogSink response = configClient.getSink(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 */ @@ -732,6 +1313,18 @@ public final LogSink getSink(GetSinkRequest request) { * Gets a sink. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetSinkRequest request =
+   *       GetSinkRequest.newBuilder()
+   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .build();
+   *   ApiFuture future = configClient.getSinkCallable().futureCall(request);
+   *   // Do something.
+   *   LogSink response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getSinkCallable() { return stub.getSinkCallable(); @@ -744,6 +1337,16 @@ public final UnaryCallable getSinkCallable() { * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   LogSink response = configClient.createSink(parent, sink);
+   * }
+   * }
+ * * @param parent Required. The resource in which to create the sink: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -768,6 +1371,16 @@ public final LogSink createSink(BillingAccountName parent, LogSink sink) { * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   FolderName parent = FolderName.of("[FOLDER]");
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   LogSink response = configClient.createSink(parent, sink);
+   * }
+   * }
+ * * @param parent Required. The resource in which to create the sink: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -792,6 +1405,16 @@ public final LogSink createSink(FolderName parent, LogSink sink) { * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   LogSink response = configClient.createSink(parent, sink);
+   * }
+   * }
+ * * @param parent Required. The resource in which to create the sink: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -816,6 +1439,16 @@ public final LogSink createSink(OrganizationName parent, LogSink sink) { * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   LogSink response = configClient.createSink(parent, sink);
+   * }
+   * }
+ * * @param parent Required. The resource in which to create the sink: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -840,6 +1473,16 @@ public final LogSink createSink(ProjectName parent, LogSink sink) { * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String parent = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   LogSink response = configClient.createSink(parent, sink);
+   * }
+   * }
+ * * @param parent Required. The resource in which to create the sink: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -861,6 +1504,20 @@ public final LogSink createSink(String parent, LogSink sink) { * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateSinkRequest request =
+   *       CreateSinkRequest.newBuilder()
+   *           .setParent(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .setSink(LogSink.newBuilder().build())
+   *           .setUniqueWriterIdentity(true)
+   *           .build();
+   *   LogSink response = configClient.createSink(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 */ @@ -876,6 +1533,20 @@ public final LogSink createSink(CreateSinkRequest request) { * owning the sink. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateSinkRequest request =
+   *       CreateSinkRequest.newBuilder()
+   *           .setParent(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .setSink(LogSink.newBuilder().build())
+   *           .setUniqueWriterIdentity(true)
+   *           .build();
+   *   ApiFuture future = configClient.createSinkCallable().futureCall(request);
+   *   // Do something.
+   *   LogSink response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createSinkCallable() { return stub.createSinkCallable(); @@ -889,6 +1560,16 @@ public final UnaryCallable createSinkCallable() { *

The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` * field. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   LogSink response = configClient.updateSink(sinkName, sink);
+   * }
+   * }
+ * * @param sinkName Required. The full resource name of the sink to update, including the parent * resource and the sink identifier: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" @@ -917,6 +1598,16 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink) { *

The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` * field. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   LogSink response = configClient.updateSink(sinkName, sink);
+   * }
+   * }
+ * * @param sinkName Required. The full resource name of the sink to update, including the parent * resource and the sink identifier: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" @@ -942,6 +1633,17 @@ public final LogSink updateSink(String sinkName, LogSink sink) { *

The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` * field. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   LogSink response = configClient.updateSink(sinkName, sink, updateMask);
+   * }
+   * }
+ * * @param sinkName Required. The full resource name of the sink to update, including the parent * resource and the sink identifier: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" @@ -980,6 +1682,17 @@ public final LogSink updateSink(LogSinkName sinkName, LogSink sink, FieldMask up *

The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` * field. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *   LogSink sink = LogSink.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   LogSink response = configClient.updateSink(sinkName, sink, updateMask);
+   * }
+   * }
+ * * @param sinkName Required. The full resource name of the sink to update, including the parent * resource and the sink identifier: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" @@ -1018,6 +1731,21 @@ public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateM *

The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` * field. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateSinkRequest request =
+   *       UpdateSinkRequest.newBuilder()
+   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .setSink(LogSink.newBuilder().build())
+   *           .setUniqueWriterIdentity(true)
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   LogSink response = configClient.updateSink(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 */ @@ -1034,6 +1762,21 @@ public final LogSink updateSink(UpdateSinkRequest request) { * field. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateSinkRequest request =
+   *       UpdateSinkRequest.newBuilder()
+   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .setSink(LogSink.newBuilder().build())
+   *           .setUniqueWriterIdentity(true)
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = configClient.updateSinkCallable().futureCall(request);
+   *   // Do something.
+   *   LogSink response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateSinkCallable() { return stub.updateSinkCallable(); @@ -1044,6 +1787,15 @@ public final UnaryCallable updateSinkCallable() { * Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also * deleted. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+   *   configClient.deleteSink(sinkName);
+   * }
+   * }
+ * * @param sinkName Required. The full resource name of the sink to delete, including the parent * resource and the sink identifier: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" @@ -1066,6 +1818,15 @@ public final void deleteSink(LogSinkName sinkName) { * Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also * deleted. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
+   *   configClient.deleteSink(sinkName);
+   * }
+   * }
+ * * @param sinkName Required. The full resource name of the sink to delete, including the parent * resource and the sink identifier: *

"projects/[PROJECT_ID]/sinks/[SINK_ID]" @@ -1085,6 +1846,18 @@ public final void deleteSink(String sinkName) { * Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also * deleted. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteSinkRequest request =
+   *       DeleteSinkRequest.newBuilder()
+   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .build();
+   *   configClient.deleteSink(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 */ @@ -1098,6 +1871,18 @@ public final void deleteSink(DeleteSinkRequest request) { * deleted. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteSinkRequest request =
+   *       DeleteSinkRequest.newBuilder()
+   *           .setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString())
+   *           .build();
+   *   ApiFuture future = configClient.deleteSinkCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteSinkCallable() { return stub.deleteSinkCallable(); @@ -1107,6 +1892,17 @@ public final UnaryCallable deleteSinkCallable() { /** * Lists all the exclusions in a parent resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose exclusions are to be listed. *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1124,6 +1920,17 @@ public final ListExclusionsPagedResponse listExclusions(BillingAccountName paren /** * Lists all the exclusions in a parent resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   FolderName parent = FolderName.of("[FOLDER]");
+   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose exclusions are to be listed. *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1141,6 +1948,17 @@ public final ListExclusionsPagedResponse listExclusions(FolderName parent) { /** * Lists all the exclusions in a parent resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose exclusions are to be listed. *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1158,6 +1976,17 @@ public final ListExclusionsPagedResponse listExclusions(OrganizationName parent) /** * Lists all the exclusions in a parent resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose exclusions are to be listed. *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1175,6 +2004,18 @@ public final ListExclusionsPagedResponse listExclusions(ProjectName parent) { /** * Lists all the exclusions in a parent resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String parent =
+   *       LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource whose exclusions are to be listed. *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1189,6 +2030,23 @@ public final ListExclusionsPagedResponse listExclusions(String parent) { /** * Lists all the exclusions in a parent resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListExclusionsRequest request =
+   *       ListExclusionsRequest.newBuilder()
+   *           .setParent(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (LogExclusion element : configClient.listExclusions(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 */ @@ -1201,6 +2059,24 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re * Lists all the exclusions in a parent resource. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ListExclusionsRequest request =
+   *       ListExclusionsRequest.newBuilder()
+   *           .setParent(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       configClient.listExclusionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (LogExclusion element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listExclusionsPagedCallable() { @@ -1212,6 +2088,23 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re * Lists all the exclusions in a parent resource. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   while (true) {
+   *     ListExclusionsResponse response = configClient.listExclusionsCallable().call(request);
+   *     for (LogExclusion element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listExclusionsCallable() { @@ -1222,6 +2115,15 @@ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest re /** * Gets the description of an exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+   *   LogExclusion response = configClient.getExclusion(name);
+   * }
+   * }
+ * * @param name Required. The resource name of an existing exclusion: *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" @@ -1240,6 +2142,15 @@ public final LogExclusion getExclusion(LogExclusionName name) { /** * Gets the description of an exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *   LogExclusion response = configClient.getExclusion(name);
+   * }
+   * }
+ * * @param name Required. The resource name of an existing exclusion: *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" @@ -1257,6 +2168,19 @@ public final LogExclusion getExclusion(String name) { /** * Gets the description of an exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetExclusionRequest request =
+   *       GetExclusionRequest.newBuilder()
+   *           .setName(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .build();
+   *   LogExclusion response = configClient.getExclusion(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 */ @@ -1269,6 +2193,19 @@ public final LogExclusion getExclusion(GetExclusionRequest request) { * Gets the description of an exclusion. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetExclusionRequest request =
+   *       GetExclusionRequest.newBuilder()
+   *           .setName(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .build();
+   *   ApiFuture future = configClient.getExclusionCallable().futureCall(request);
+   *   // Do something.
+   *   LogExclusion response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getExclusionCallable() { return stub.getExclusionCallable(); @@ -1279,6 +2216,16 @@ public final UnaryCallable getExclusionCallab * Creates a new exclusion in a specified parent resource. Only log entries belonging to that * resource can be excluded. You can have up to 10 exclusions in a resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * }
+   * }
+ * * @param parent Required. The parent resource in which to create the exclusion: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1301,6 +2248,16 @@ public final LogExclusion createExclusion(BillingAccountName parent, LogExclusio * Creates a new exclusion in a specified parent resource. Only log entries belonging to that * resource can be excluded. You can have up to 10 exclusions in a resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   FolderName parent = FolderName.of("[FOLDER]");
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * }
+   * }
+ * * @param parent Required. The parent resource in which to create the exclusion: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1323,6 +2280,16 @@ public final LogExclusion createExclusion(FolderName parent, LogExclusion exclus * Creates a new exclusion in a specified parent resource. Only log entries belonging to that * resource can be excluded. You can have up to 10 exclusions in a resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * }
+   * }
+ * * @param parent Required. The parent resource in which to create the exclusion: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1345,6 +2312,16 @@ public final LogExclusion createExclusion(OrganizationName parent, LogExclusion * Creates a new exclusion in a specified parent resource. Only log entries belonging to that * resource can be excluded. You can have up to 10 exclusions in a resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * }
+   * }
+ * * @param parent Required. The parent resource in which to create the exclusion: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1367,6 +2344,17 @@ public final LogExclusion createExclusion(ProjectName parent, LogExclusion exclu * Creates a new exclusion in a specified parent resource. Only log entries belonging to that * resource can be excluded. You can have up to 10 exclusions in a resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String parent =
+   *       LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * }
+   * }
+ * * @param parent Required. The parent resource in which to create the exclusion: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -1386,6 +2374,20 @@ public final LogExclusion createExclusion(String parent, LogExclusion exclusion) * Creates a new exclusion in a specified parent resource. Only log entries belonging to that * resource can be excluded. You can have up to 10 exclusions in a resource. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateExclusionRequest request =
+   *       CreateExclusionRequest.newBuilder()
+   *           .setParent(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .setExclusion(LogExclusion.newBuilder().build())
+   *           .build();
+   *   LogExclusion response = configClient.createExclusion(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 */ @@ -1399,6 +2401,20 @@ public final LogExclusion createExclusion(CreateExclusionRequest request) { * resource can be excluded. You can have up to 10 exclusions in a resource. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   CreateExclusionRequest request =
+   *       CreateExclusionRequest.newBuilder()
+   *           .setParent(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .setExclusion(LogExclusion.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = configClient.createExclusionCallable().futureCall(request);
+   *   // Do something.
+   *   LogExclusion response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createExclusionCallable() { return stub.createExclusionCallable(); @@ -1408,6 +2424,17 @@ public final UnaryCallable createExclusion /** * Changes one or more properties of an existing exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
+   * }
+   * }
+ * * @param name Required. The resource name of the exclusion to update: *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" @@ -1439,6 +2466,17 @@ public final LogExclusion updateExclusion( /** * Changes one or more properties of an existing exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
+   * }
+   * }
+ * * @param name Required. The resource name of the exclusion to update: *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" @@ -1470,6 +2508,21 @@ public final LogExclusion updateExclusion( /** * Changes one or more properties of an existing exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateExclusionRequest request =
+   *       UpdateExclusionRequest.newBuilder()
+   *           .setName(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .setExclusion(LogExclusion.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   LogExclusion response = configClient.updateExclusion(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 */ @@ -1482,6 +2535,21 @@ public final LogExclusion updateExclusion(UpdateExclusionRequest request) { * Changes one or more properties of an existing exclusion. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateExclusionRequest request =
+   *       UpdateExclusionRequest.newBuilder()
+   *           .setName(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .setExclusion(LogExclusion.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = configClient.updateExclusionCallable().futureCall(request);
+   *   // Do something.
+   *   LogExclusion response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateExclusionCallable() { return stub.updateExclusionCallable(); @@ -1491,6 +2559,15 @@ public final UnaryCallable updateExclusion /** * Deletes an exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+   *   configClient.deleteExclusion(name);
+   * }
+   * }
+ * * @param name Required. The resource name of an existing exclusion to delete: *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" @@ -1509,6 +2586,15 @@ public final void deleteExclusion(LogExclusionName name) { /** * Deletes an exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
+   *   configClient.deleteExclusion(name);
+   * }
+   * }
+ * * @param name Required. The resource name of an existing exclusion to delete: *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" @@ -1526,6 +2612,19 @@ public final void deleteExclusion(String name) { /** * Deletes an exclusion. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteExclusionRequest request =
+   *       DeleteExclusionRequest.newBuilder()
+   *           .setName(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .build();
+   *   configClient.deleteExclusion(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 */ @@ -1538,6 +2637,19 @@ public final void deleteExclusion(DeleteExclusionRequest request) { * Deletes an exclusion. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   DeleteExclusionRequest request =
+   *       DeleteExclusionRequest.newBuilder()
+   *           .setName(
+   *               LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString())
+   *           .build();
+   *   ApiFuture future = configClient.deleteExclusionCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteExclusionCallable() { return stub.deleteExclusionCallable(); @@ -1553,6 +2665,18 @@ public final UnaryCallable deleteExclusionCallabl *

See [Enabling CMEK for Logs * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetCmekSettingsRequest request =
+   *       GetCmekSettingsRequest.newBuilder()
+   *           .setName(CmekSettingsName.ofProjectName("[PROJECT]").toString())
+   *           .build();
+   *   CmekSettings response = configClient.getCmekSettings(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 */ @@ -1571,6 +2695,18 @@ public final CmekSettings getCmekSettings(GetCmekSettingsRequest request) { * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   GetCmekSettingsRequest request =
+   *       GetCmekSettingsRequest.newBuilder()
+   *           .setName(CmekSettingsName.ofProjectName("[PROJECT]").toString())
+   *           .build();
+   *   ApiFuture future = configClient.getCmekSettingsCallable().futureCall(request);
+   *   // Do something.
+   *   CmekSettings response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getCmekSettingsCallable() { return stub.getCmekSettingsCallable(); @@ -1591,6 +2727,20 @@ public final UnaryCallable getCmekSettings *

See [Enabling CMEK for Logs * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information. * + *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateCmekSettingsRequest request =
+   *       UpdateCmekSettingsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setCmekSettings(CmekSettings.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   CmekSettings response = configClient.updateCmekSettings(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 */ @@ -1614,6 +2764,21 @@ public final CmekSettings updateCmekSettings(UpdateCmekSettingsRequest request) * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information. * *

Sample code: + * + *

{@code
+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   UpdateCmekSettingsRequest request =
+   *       UpdateCmekSettingsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setCmekSettings(CmekSettings.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       configClient.updateCmekSettingsCallable().futureCall(request);
+   *   // Do something.
+   *   CmekSettings response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateCmekSettingsCallable() { return stub.updateCmekSettingsCallable(); diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java index 7c49c6a94..9d5b31374 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java @@ -63,6 +63,13 @@ *

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 (LoggingClient loggingClient = LoggingClient.create()) {
+ *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ *   loggingClient.deleteLog(logName);
+ * }
+ * }
+ * *

Note: close() needs to be called on the LoggingClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -165,6 +172,15 @@ public LoggingServiceV2Stub getStub() { * written shortly before the delete operation might not be deleted. Entries received after the * delete operation with a timestamp before the operation will be deleted. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+   *   loggingClient.deleteLog(logName);
+   * }
+   * }
+ * * @param logName Required. The resource name of the log to delete: *

"projects/[PROJECT_ID]/logs/[LOG_ID]" "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" "folders/[FOLDER_ID]/logs/[LOG_ID]" @@ -187,6 +203,15 @@ public final void deleteLog(LogName logName) { * written shortly before the delete operation might not be deleted. Entries received after the * delete operation with a timestamp before the operation will be deleted. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
+   *   loggingClient.deleteLog(logName);
+   * }
+   * }
+ * * @param logName Required. The resource name of the log to delete: *

"projects/[PROJECT_ID]/logs/[LOG_ID]" "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" "folders/[FOLDER_ID]/logs/[LOG_ID]" @@ -206,6 +231,18 @@ public final void deleteLog(String logName) { * written shortly before the delete operation might not be deleted. Entries received after the * delete operation with a timestamp before the operation will be deleted. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   DeleteLogRequest request =
+   *       DeleteLogRequest.newBuilder()
+   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *           .build();
+   *   loggingClient.deleteLog(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 */ @@ -220,6 +257,18 @@ public final void deleteLog(DeleteLogRequest request) { * delete operation with a timestamp before the operation will be deleted. * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   DeleteLogRequest request =
+   *       DeleteLogRequest.newBuilder()
+   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *           .build();
+   *   ApiFuture future = loggingClient.deleteLogCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteLogCallable() { return stub.deleteLogCallable(); @@ -232,6 +281,19 @@ public final UnaryCallable deleteLogCallable() { * libraries configured to use Logging. A single request may contain log entries for a maximum of * 1000 different resources (projects, organizations, billing accounts or folders) * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+   *   MonitoredResource resource = MonitoredResource.newBuilder().build();
+   *   Map labels = new HashMap<>();
+   *   List entries = new ArrayList<>();
+   *   WriteLogEntriesResponse response =
+   *       loggingClient.writeLogEntries(logName, resource, labels, entries);
+   * }
+   * }
+ * * @param logName Optional. A default log resource name that is assigned to all log entries in * `entries` that do not specify a value for `log_name`: *

"projects/[PROJECT_ID]/logs/[LOG_ID]" "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" @@ -294,6 +356,19 @@ public final WriteLogEntriesResponse writeLogEntries( * libraries configured to use Logging. A single request may contain log entries for a maximum of * 1000 different resources (projects, organizations, billing accounts or folders) * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   String logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
+   *   MonitoredResource resource = MonitoredResource.newBuilder().build();
+   *   Map labels = new HashMap<>();
+   *   List entries = new ArrayList<>();
+   *   WriteLogEntriesResponse response =
+   *       loggingClient.writeLogEntries(logName, resource, labels, entries);
+   * }
+   * }
+ * * @param logName Optional. A default log resource name that is assigned to all log entries in * `entries` that do not specify a value for `log_name`: *

"projects/[PROJECT_ID]/logs/[LOG_ID]" "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" @@ -356,6 +431,23 @@ public final WriteLogEntriesResponse writeLogEntries( * libraries configured to use Logging. A single request may contain log entries for a maximum of * 1000 different resources (projects, organizations, billing accounts or folders) * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   WriteLogEntriesRequest request =
+   *       WriteLogEntriesRequest.newBuilder()
+   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *           .setResource(MonitoredResource.newBuilder().build())
+   *           .putAllLabels(new HashMap())
+   *           .addAllEntries(new ArrayList())
+   *           .setPartialSuccess(true)
+   *           .setDryRun(true)
+   *           .build();
+   *   WriteLogEntriesResponse response = loggingClient.writeLogEntries(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 */ @@ -371,6 +463,24 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ * 1000 different resources (projects, organizations, billing accounts or folders) * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   WriteLogEntriesRequest request =
+   *       WriteLogEntriesRequest.newBuilder()
+   *           .setLogName(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *           .setResource(MonitoredResource.newBuilder().build())
+   *           .putAllLabels(new HashMap())
+   *           .addAllEntries(new ArrayList())
+   *           .setPartialSuccess(true)
+   *           .setDryRun(true)
+   *           .build();
+   *   ApiFuture future =
+   *       loggingClient.writeLogEntriesCallable().futureCall(request);
+   *   // Do something.
+   *   WriteLogEntriesResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable writeLogEntriesCallable() { @@ -383,6 +493,20 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ * project/folder/organization/billing account. For ways to export log entries, see [Exporting * Logs](https://cloud.google.com/logging/docs/export). * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   List resourceNames = new ArrayList<>();
+   *   String filter = "filter-1274492040";
+   *   String orderBy = "orderBy-1207110587";
+   *   for (LogEntry element :
+   *       loggingClient.listLogEntries(resourceNames, filter, orderBy).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param resourceNames Required. Names of one or more parent resources from which to retrieve log * entries: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" @@ -423,6 +547,24 @@ public final ListLogEntriesPagedResponse listLogEntries( * project/folder/organization/billing account. For ways to export log entries, see [Exporting * Logs](https://cloud.google.com/logging/docs/export). * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   ListLogEntriesRequest request =
+   *       ListLogEntriesRequest.newBuilder()
+   *           .addAllResourceNames(new ArrayList())
+   *           .setFilter("filter-1274492040")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (LogEntry element : loggingClient.listLogEntries(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 */ @@ -437,6 +579,24 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re * Logs](https://cloud.google.com/logging/docs/export). * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   ListLogEntriesRequest request =
+   *       ListLogEntriesRequest.newBuilder()
+   *           .addAllResourceNames(new ArrayList())
+   *           .setFilter("filter-1274492040")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = loggingClient.listLogEntriesPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (LogEntry element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listLogEntriesPagedCallable() { @@ -450,6 +610,23 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re * Logs](https://cloud.google.com/logging/docs/export). * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   while (true) {
+   *     ListLogEntriesResponse response = loggingClient.listLogEntriesCallable().call(request);
+   *     for (LogEntry element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listLogEntriesCallable() { @@ -460,6 +637,22 @@ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest re /** * Lists the descriptors for monitored resource types used by Logging. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   ListMonitoredResourceDescriptorsRequest request =
+   *       ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (MonitoredResourceDescriptor element :
+   *       loggingClient.listMonitoredResourceDescriptors(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 */ @@ -473,6 +666,22 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource * Lists the descriptors for monitored resource types used by Logging. * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   ListMonitoredResourceDescriptorsRequest request =
+   *       ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       loggingClient.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (MonitoredResourceDescriptor element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable< ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse> @@ -485,6 +694,24 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource * Lists the descriptors for monitored resource types used by Logging. * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   while (true) {
+   *     ListMonitoredResourceDescriptorsResponse response =
+   *         loggingClient.listMonitoredResourceDescriptorsCallable().call(request);
+   *     for (MonitoredResourceDescriptor element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable< ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> @@ -497,6 +724,17 @@ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResource * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have * entries are listed. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name that owns the logs: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -513,6 +751,17 @@ public final ListLogsPagedResponse listLogs(BillingAccountName parent) { * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have * entries are listed. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   FolderName parent = FolderName.of("[FOLDER]");
+   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name that owns the logs: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -529,6 +778,17 @@ public final ListLogsPagedResponse listLogs(FolderName parent) { * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have * entries are listed. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name that owns the logs: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -545,6 +805,17 @@ public final ListLogsPagedResponse listLogs(OrganizationName parent) { * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have * entries are listed. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name that owns the logs: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -561,6 +832,17 @@ public final ListLogsPagedResponse listLogs(ProjectName parent) { * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have * entries are listed. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   String parent = LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString();
+   *   for (String element : loggingClient.listLogs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name that owns the logs: *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" @@ -576,6 +858,23 @@ public final ListLogsPagedResponse listLogs(String parent) { * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have * entries are listed. * + *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   ListLogsRequest request =
+   *       ListLogsRequest.newBuilder()
+   *           .setParent(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .addAllResourceNames(new ArrayList())
+   *           .build();
+   *   for (String element : loggingClient.listLogs(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 */ @@ -589,6 +888,23 @@ public final ListLogsPagedResponse listLogs(ListLogsRequest request) { * entries are listed. * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   ListLogsRequest request =
+   *       ListLogsRequest.newBuilder()
+   *           .setParent(LogName.ofProjectLogName("[PROJECT]", "[LOG]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .addAllResourceNames(new ArrayList())
+   *           .build();
+   *   ApiFuture future = loggingClient.listLogsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (String element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listLogsPagedCallable() { return stub.listLogsPagedCallable(); @@ -600,6 +916,23 @@ public final UnaryCallable listLogsPaged * entries are listed. * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   while (true) {
+   *     ListLogsResponse response = loggingClient.listLogsCallable().call(request);
+   *     for (String element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listLogsCallable() { return stub.listLogsCallable(); @@ -611,6 +944,23 @@ public final UnaryCallable listLogsCallable() * continue reading logs. * *

Sample code: + * + *

{@code
+   * try (LoggingClient loggingClient = LoggingClient.create()) {
+   *   BidiStream bidiStream =
+   *       loggingClient.tailLogEntriesCallable().call();
+   *   TailLogEntriesRequest request =
+   *       TailLogEntriesRequest.newBuilder()
+   *           .addAllResourceNames(new ArrayList())
+   *           .setFilter("filter-1274492040")
+   *           .setBufferWindow(Duration.newBuilder().build())
+   *           .build();
+   *   bidiStream.send(request);
+   *   for (TailLogEntriesResponse response : bidiStream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
*/ public final BidiStreamingCallable tailLogEntriesCallable() { diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java index 14ccc5d1a..61747b266 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java @@ -51,6 +51,13 @@ *

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 (MetricsClient metricsClient = MetricsClient.create()) {
+ *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ *   LogMetric response = metricsClient.getLogMetric(metricName);
+ * }
+ * }
+ * *

Note: close() needs to be called on the MetricsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -151,6 +158,17 @@ public MetricsServiceV2Stub getStub() { /** * Lists logs-based metrics. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The name of the project containing the metrics: *

"projects/[PROJECT_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -167,6 +185,17 @@ public final ListLogMetricsPagedResponse listLogMetrics(ProjectName parent) { /** * Lists logs-based metrics. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The name of the project containing the metrics: *

"projects/[PROJECT_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -180,6 +209,22 @@ public final ListLogMetricsPagedResponse listLogMetrics(String parent) { /** * Lists logs-based metrics. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   ListLogMetricsRequest request =
+   *       ListLogMetricsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (LogMetric element : metricsClient.listLogMetrics(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 */ @@ -192,6 +237,22 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re * Lists logs-based metrics. * *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   ListLogMetricsRequest request =
+   *       ListLogMetricsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future = metricsClient.listLogMetricsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (LogMetric element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listLogMetricsPagedCallable() { @@ -203,6 +264,23 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re * Lists logs-based metrics. * *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   while (true) {
+   *     ListLogMetricsResponse response = metricsClient.listLogMetricsCallable().call(request);
+   *     for (LogMetric element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listLogMetricsCallable() { @@ -213,6 +291,15 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re /** * Gets a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+   *   LogMetric response = metricsClient.getLogMetric(metricName);
+   * }
+   * }
+ * * @param metricName Required. The resource name of the desired metric: *

"projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -229,6 +316,15 @@ public final LogMetric getLogMetric(LogMetricName metricName) { /** * Gets a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *   LogMetric response = metricsClient.getLogMetric(metricName);
+   * }
+   * }
+ * * @param metricName Required. The resource name of the desired metric: *

"projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -243,6 +339,18 @@ public final LogMetric getLogMetric(String metricName) { /** * Gets a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   GetLogMetricRequest request =
+   *       GetLogMetricRequest.newBuilder()
+   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .build();
+   *   LogMetric response = metricsClient.getLogMetric(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 */ @@ -255,6 +363,18 @@ public final LogMetric getLogMetric(GetLogMetricRequest request) { * Gets a logs-based metric. * *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   GetLogMetricRequest request =
+   *       GetLogMetricRequest.newBuilder()
+   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .build();
+   *   ApiFuture future = metricsClient.getLogMetricCallable().futureCall(request);
+   *   // Do something.
+   *   LogMetric response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getLogMetricCallable() { return stub.getLogMetricCallable(); @@ -264,6 +384,16 @@ public final UnaryCallable getLogMetricCallable( /** * Creates a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   LogMetric metric = LogMetric.newBuilder().build();
+   *   LogMetric response = metricsClient.createLogMetric(parent, metric);
+   * }
+   * }
+ * * @param parent Required. The resource name of the project in which to create the metric: *

"projects/[PROJECT_ID]" *

The new metric must be provided in the request. @@ -284,6 +414,16 @@ public final LogMetric createLogMetric(ProjectName parent, LogMetric metric) { /** * Creates a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   String parent = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *   LogMetric metric = LogMetric.newBuilder().build();
+   *   LogMetric response = metricsClient.createLogMetric(parent, metric);
+   * }
+   * }
+ * * @param parent Required. The resource name of the project in which to create the metric: *

"projects/[PROJECT_ID]" *

The new metric must be provided in the request. @@ -301,6 +441,19 @@ public final LogMetric createLogMetric(String parent, LogMetric metric) { /** * Creates a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   CreateLogMetricRequest request =
+   *       CreateLogMetricRequest.newBuilder()
+   *           .setParent(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .setMetric(LogMetric.newBuilder().build())
+   *           .build();
+   *   LogMetric response = metricsClient.createLogMetric(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 */ @@ -313,6 +466,19 @@ public final LogMetric createLogMetric(CreateLogMetricRequest request) { * Creates a logs-based metric. * *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   CreateLogMetricRequest request =
+   *       CreateLogMetricRequest.newBuilder()
+   *           .setParent(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .setMetric(LogMetric.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = metricsClient.createLogMetricCallable().futureCall(request);
+   *   // Do something.
+   *   LogMetric response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createLogMetricCallable() { return stub.createLogMetricCallable(); @@ -322,6 +488,16 @@ public final UnaryCallable createLogMetricCal /** * Creates or updates a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+   *   LogMetric metric = LogMetric.newBuilder().build();
+   *   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
+   * }
+   * }
+ * * @param metricName Required. The resource name of the metric to update: *

"projects/[PROJECT_ID]/metrics/[METRIC_ID]" *

The updated metric must be provided in the request and it's `name` field must be the @@ -343,6 +519,16 @@ public final LogMetric updateLogMetric(LogMetricName metricName, LogMetric metri /** * Creates or updates a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *   LogMetric metric = LogMetric.newBuilder().build();
+   *   LogMetric response = metricsClient.updateLogMetric(metricName, metric);
+   * }
+   * }
+ * * @param metricName Required. The resource name of the metric to update: *

"projects/[PROJECT_ID]/metrics/[METRIC_ID]" *

The updated metric must be provided in the request and it's `name` field must be the @@ -361,6 +547,19 @@ public final LogMetric updateLogMetric(String metricName, LogMetric metric) { /** * Creates or updates a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   UpdateLogMetricRequest request =
+   *       UpdateLogMetricRequest.newBuilder()
+   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .setMetric(LogMetric.newBuilder().build())
+   *           .build();
+   *   LogMetric response = metricsClient.updateLogMetric(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 */ @@ -373,6 +572,19 @@ public final LogMetric updateLogMetric(UpdateLogMetricRequest request) { * Creates or updates a logs-based metric. * *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   UpdateLogMetricRequest request =
+   *       UpdateLogMetricRequest.newBuilder()
+   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .setMetric(LogMetric.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = metricsClient.updateLogMetricCallable().futureCall(request);
+   *   // Do something.
+   *   LogMetric response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateLogMetricCallable() { return stub.updateLogMetricCallable(); @@ -382,6 +594,15 @@ public final UnaryCallable updateLogMetricCal /** * Deletes a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+   *   metricsClient.deleteLogMetric(metricName);
+   * }
+   * }
+ * * @param metricName Required. The resource name of the metric to delete: *

"projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -398,6 +619,15 @@ public final void deleteLogMetric(LogMetricName metricName) { /** * Deletes a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *   metricsClient.deleteLogMetric(metricName);
+   * }
+   * }
+ * * @param metricName Required. The resource name of the metric to delete: *

"projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -412,6 +642,18 @@ public final void deleteLogMetric(String metricName) { /** * Deletes a logs-based metric. * + *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   DeleteLogMetricRequest request =
+   *       DeleteLogMetricRequest.newBuilder()
+   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .build();
+   *   metricsClient.deleteLogMetric(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 */ @@ -424,6 +666,18 @@ public final void deleteLogMetric(DeleteLogMetricRequest request) { * Deletes a logs-based metric. * *

Sample code: + * + *

{@code
+   * try (MetricsClient metricsClient = MetricsClient.create()) {
+   *   DeleteLogMetricRequest request =
+   *       DeleteLogMetricRequest.newBuilder()
+   *           .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString())
+   *           .build();
+   *   ApiFuture future = metricsClient.deleteLogMetricCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteLogMetricCallable() { return stub.deleteLogMetricCallable(); diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/package-info.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/package-info.java index e9e35d345..33fd7ef3d 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/package-info.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/package-info.java @@ -23,17 +23,43 @@ * *

Sample for LoggingClient: * + *

{@code
+ * try (LoggingClient loggingClient = LoggingClient.create()) {
+ *   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ *   loggingClient.deleteLog(logName);
+ * }
+ * }
+ * *

======================= ConfigClient ======================= * *

Service Description: Service for configuring sinks used to route log entries. * *

Sample for ConfigClient: * + *

{@code
+ * try (ConfigClient configClient = ConfigClient.create()) {
+ *   GetBucketRequest request =
+ *       GetBucketRequest.newBuilder()
+ *           .setName(
+ *               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
+ *                   .toString())
+ *           .build();
+ *   LogBucket response = configClient.getBucket(request);
+ * }
+ * }
+ * *

======================= MetricsClient ======================= * *

Service Description: Service for configuring logs-based metrics. * *

Sample for MetricsClient: + * + *

{@code
+ * try (MetricsClient metricsClient = MetricsClient.create()) {
+ *   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ *   LogMetric response = metricsClient.getLogMetric(metricName);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.logging.v2; diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java index 98460201a..770bba339 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java @@ -103,18 +103,18 @@ *

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

{@code
- * ConfigServiceV2StubSettings.Builder configServiceV2SettingsBuilder =
+ * ConfigServiceV2StubSettings.Builder configSettingsBuilder =
  *     ConfigServiceV2StubSettings.newBuilder();
- * configServiceV2SettingsBuilder
+ * configSettingsBuilder
  *     .getBucketSettings()
  *     .setRetrySettings(
- *         configServiceV2SettingsBuilder
+ *         configSettingsBuilder
  *             .getBucketSettings()
  *             .getRetrySettings()
  *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * ConfigServiceV2StubSettings configServiceV2Settings = configServiceV2SettingsBuilder.build();
+ * ConfigServiceV2StubSettings configSettings = configSettingsBuilder.build();
  * }
*/ @Generated("by gapic-generator-java") diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java index d76fe0adb..5d4b58ba3 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java @@ -93,18 +93,18 @@ *

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

{@code
- * LoggingServiceV2StubSettings.Builder loggingServiceV2SettingsBuilder =
+ * LoggingServiceV2StubSettings.Builder loggingSettingsBuilder =
  *     LoggingServiceV2StubSettings.newBuilder();
- * loggingServiceV2SettingsBuilder
+ * loggingSettingsBuilder
  *     .deleteLogSettings()
  *     .setRetrySettings(
- *         loggingServiceV2SettingsBuilder
+ *         loggingSettingsBuilder
  *             .deleteLogSettings()
  *             .getRetrySettings()
  *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * LoggingServiceV2StubSettings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
+ * LoggingServiceV2StubSettings loggingSettings = loggingSettingsBuilder.build();
  * }
*/ @Generated("by gapic-generator-java") diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java index c3b691f2c..b8f5293be 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java @@ -75,18 +75,18 @@ *

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

{@code
- * MetricsServiceV2StubSettings.Builder metricsServiceV2SettingsBuilder =
+ * MetricsServiceV2StubSettings.Builder metricsSettingsBuilder =
  *     MetricsServiceV2StubSettings.newBuilder();
- * metricsServiceV2SettingsBuilder
+ * metricsSettingsBuilder
  *     .getLogMetricSettings()
  *     .setRetrySettings(
- *         metricsServiceV2SettingsBuilder
+ *         metricsSettingsBuilder
  *             .getLogMetricSettings()
  *             .getRetrySettings()
  *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * MetricsServiceV2StubSettings metricsServiceV2Settings = metricsServiceV2SettingsBuilder.build();
+ * MetricsServiceV2StubSettings metricsSettings = metricsSettingsBuilder.build();
  * }
*/ @Generated("by gapic-generator-java") diff --git a/synth.metadata b/synth.metadata index 532c30b06..1d32aab40 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {