diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigServiceV2Client.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigServiceV2Client.java new file mode 100644 index 000000000..d97f1d822 --- /dev/null +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigServiceV2Client.java @@ -0,0 +1,2436 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.logging.v2; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.logging.v2.stub.ConfigServiceV2Stub; +import com.google.cloud.logging.v2.stub.ConfigServiceV2StubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.logging.v2.BillingAccountName; +import com.google.logging.v2.CmekSettings; +import com.google.logging.v2.CreateExclusionRequest; +import com.google.logging.v2.CreateSinkRequest; +import com.google.logging.v2.DeleteExclusionRequest; +import com.google.logging.v2.DeleteSinkRequest; +import com.google.logging.v2.FolderName; +import com.google.logging.v2.GetBucketRequest; +import com.google.logging.v2.GetCmekSettingsRequest; +import com.google.logging.v2.GetExclusionRequest; +import com.google.logging.v2.GetSinkRequest; +import com.google.logging.v2.ListBucketsRequest; +import com.google.logging.v2.ListBucketsResponse; +import com.google.logging.v2.ListExclusionsRequest; +import com.google.logging.v2.ListExclusionsResponse; +import com.google.logging.v2.ListSinksRequest; +import com.google.logging.v2.ListSinksResponse; +import com.google.logging.v2.LogBucket; +import com.google.logging.v2.LogExclusion; +import com.google.logging.v2.LogExclusionName; +import com.google.logging.v2.LogSink; +import com.google.logging.v2.LogSinkName; +import com.google.logging.v2.OrganizationName; +import com.google.logging.v2.ProjectName; +import com.google.logging.v2.UpdateBucketRequest; +import com.google.logging.v2.UpdateCmekSettingsRequest; +import com.google.logging.v2.UpdateExclusionRequest; +import com.google.logging.v2.UpdateSinkRequest; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Service for configuring sinks used to route log entries. + * + *
This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
+ *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink response = configServiceV2Client.getSink(sinkName);
+ * }
+ *
+ *
+ *
+ * Note: close() needs to be called on the configServiceV2Client object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of ConfigServiceV2Settings to + * create(). For example: + * + *
To customize credentials: + * + *
+ *
+ * ConfigServiceV2Settings configServiceV2Settings =
+ * ConfigServiceV2Settings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * ConfigServiceV2Client configServiceV2Client =
+ * ConfigServiceV2Client.create(configServiceV2Settings);
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ *
+ * ConfigServiceV2Settings configServiceV2Settings =
+ * ConfigServiceV2Settings.newBuilder().setEndpoint(myEndpoint).build();
+ * ConfigServiceV2Client configServiceV2Client =
+ * ConfigServiceV2Client.create(configServiceV2Settings);
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class ConfigServiceV2Client implements BackgroundResource {
+ private final ConfigServiceV2Settings settings;
+ private final ConfigServiceV2Stub stub;
+
+ /** Constructs an instance of ConfigServiceV2Client with default settings. */
+ public static final ConfigServiceV2Client create() throws IOException {
+ return create(ConfigServiceV2Settings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of ConfigServiceV2Client, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final ConfigServiceV2Client create(ConfigServiceV2Settings settings)
+ throws IOException {
+ return new ConfigServiceV2Client(settings);
+ }
+
+ /**
+ * Constructs an instance of ConfigServiceV2Client, using the given stub for making calls. This is
+ * for advanced usage - prefer to use ConfigServiceV2Settings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final ConfigServiceV2Client create(ConfigServiceV2Stub stub) {
+ return new ConfigServiceV2Client(stub);
+ }
+
+ /**
+ * Constructs an instance of ConfigServiceV2Client, using the given settings. This is protected so
+ * that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected ConfigServiceV2Client(ConfigServiceV2Settings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((ConfigServiceV2StubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected ConfigServiceV2Client(ConfigServiceV2Stub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final ConfigServiceV2Settings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public ConfigServiceV2Stub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists buckets (Beta).
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * String parent = "";
+ * for (LogBucket element : configServiceV2Client.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]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + *
Note: The locations portion of the resource must be specified, but supplying the + * character `-` in place of [LOCATION_ID] will return all buckets. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBucketsPagedResponse listBuckets(String parent) { + ListBucketsRequest request = ListBucketsRequest.newBuilder().setParent(parent).build(); + return listBuckets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists buckets (Beta). + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * String parent = "";
+ * ListBucketsRequest request = ListBucketsRequest.newBuilder()
+ * .setParent(parent)
+ * .build();
+ * for (LogBucket element : configServiceV2Client.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
+ */
+ public final ListBucketsPagedResponse listBuckets(ListBucketsRequest request) {
+ return listBucketsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists buckets (Beta).
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * String parent = "";
+ * ListBucketsRequest request = ListBucketsRequest.newBuilder()
+ * .setParent(parent)
+ * .build();
+ * ApiFuture<ListBucketsPagedResponse> future = configServiceV2Client.listBucketsPagedCallable().futureCall(request);
+ * // Do something
+ * for (LogBucket element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * String parent = "";
+ * ListBucketsRequest request = ListBucketsRequest.newBuilder()
+ * .setParent(parent)
+ * .build();
+ * while (true) {
+ * ListBucketsResponse response = configServiceV2Client.listBucketsCallable().call(request);
+ * for (LogBucket element : response.getBucketsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogBucketName name = LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]");
+ * GetBucketRequest request = GetBucketRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * LogBucket response = configServiceV2Client.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
+ */
+ public final LogBucket getBucket(GetBucketRequest request) {
+ return getBucketCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a bucket (Beta).
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogBucketName name = LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]");
+ * GetBucketRequest request = GetBucketRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<LogBucket> future = configServiceV2Client.getBucketCallable().futureCall(request);
+ * // Do something
+ * LogBucket response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableIf the retention period is decreased and the bucket is locked, FAILED_PRECONDITION will be + * returned. + * + *
If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION will be + * returned. + * + *
A buckets region may not be modified after it is created. This method is in Beta. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogBucketName name = LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]");
+ * LogBucket bucket = LogBucket.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateBucketRequest request = UpdateBucketRequest.newBuilder()
+ * .setName(name.toString())
+ * .setBucket(bucket)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * LogBucket response = configServiceV2Client.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
+ */
+ public final LogBucket updateBucket(UpdateBucketRequest request) {
+ return updateBucketCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates a bucket. This method replaces the following fields in the existing bucket with values
+ * from the new bucket: `retention_period`
+ *
+ * If the retention period is decreased and the bucket is locked, FAILED_PRECONDITION will be + * returned. + * + *
If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION will be + * returned. + * + *
A buckets region may not be modified after it is created. This method is in Beta. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogBucketName name = LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]");
+ * LogBucket bucket = LogBucket.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateBucketRequest request = UpdateBucketRequest.newBuilder()
+ * .setName(name.toString())
+ * .setBucket(bucket)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * ApiFuture<LogBucket> future = configServiceV2Client.updateBucketCallable().futureCall(request);
+ * // Do something
+ * LogBucket response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (LogSink element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSinksPagedResponse listSinks(ProjectName parent) { + ListSinksRequest request = + ListSinksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listSinks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists sinks. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+ * for (LogSink element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSinksPagedResponse listSinks(OrganizationName parent) { + ListSinksRequest request = + ListSinksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listSinks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists sinks. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * FolderName parent = FolderName.of("[FOLDER]");
+ * for (LogSink element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSinksPagedResponse listSinks(FolderName parent) { + ListSinksRequest request = + ListSinksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listSinks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists sinks. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ * for (LogSink element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSinksPagedResponse listSinks(BillingAccountName parent) { + ListSinksRequest request = + ListSinksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listSinks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists sinks. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (LogSink element : configServiceV2Client.listSinks(parent.toString()).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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSinksPagedResponse listSinks(String parent) { + ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent).build(); + return listSinks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists sinks. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListSinksRequest request = ListSinksRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (LogSink element : configServiceV2Client.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
+ */
+ public final ListSinksPagedResponse listSinks(ListSinksRequest request) {
+ return listSinksPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists sinks.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListSinksRequest request = ListSinksRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListSinksPagedResponse> future = configServiceV2Client.listSinksPagedCallable().futureCall(request);
+ * // Do something
+ * for (LogSink element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListSinksRequest request = ListSinksRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListSinksResponse response = configServiceV2Client.listSinksCallable().call(request);
+ * for (LogSink element : response.getSinksList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink response = configServiceV2Client.getSink(sinkName);
+ * }
+ *
+ *
+ * @param sinkName Required. The resource name of the sink:
+ * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink getSink(LogSinkName sinkName) { + GetSinkRequest request = + GetSinkRequest.newBuilder() + .setSinkName(sinkName == null ? null : sinkName.toString()) + .build(); + return getSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a sink. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink response = configServiceV2Client.getSink(sinkName.toString());
+ * }
+ *
+ *
+ * @param sinkName Required. The resource name of the sink:
+ * "projects/[PROJECT_ID]/sinks/[SINK_ID]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink getSink(String sinkName) { + GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(sinkName).build(); + return getSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a sink. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * GetSinkRequest request = GetSinkRequest.newBuilder()
+ * .setSinkName(sinkName.toString())
+ * .build();
+ * LogSink response = configServiceV2Client.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
+ */
+ public final LogSink getSink(GetSinkRequest request) {
+ return getSinkCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a sink.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * GetSinkRequest request = GetSinkRequest.newBuilder()
+ * .setSinkName(sinkName.toString())
+ * .build();
+ * ApiFuture<LogSink> future = configServiceV2Client.getSinkCallable().futureCall(request);
+ * // Do something
+ * LogSink response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * LogSink response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not + * already in use. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink createSink(ProjectName parent, LogSink sink) { + CreateSinkRequest request = + CreateSinkRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setSink(sink) + .build(); + return createSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a sink that exports specified log entries to a destination. The export of + * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not + * permitted to write to the destination. A sink can export log entries only from the resource + * owning the sink. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * LogSink response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not + * already in use. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink createSink(OrganizationName parent, LogSink sink) { + CreateSinkRequest request = + CreateSinkRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setSink(sink) + .build(); + return createSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a sink that exports specified log entries to a destination. The export of + * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not + * permitted to write to the destination. A sink can export log entries only from the resource + * owning the sink. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * FolderName parent = FolderName.of("[FOLDER]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * LogSink response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not + * already in use. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink createSink(FolderName parent, LogSink sink) { + CreateSinkRequest request = + CreateSinkRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setSink(sink) + .build(); + return createSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a sink that exports specified log entries to a destination. The export of + * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not + * permitted to write to the destination. A sink can export log entries only from the resource + * owning the sink. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * LogSink response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not + * already in use. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink createSink(BillingAccountName parent, LogSink sink) { + CreateSinkRequest request = + CreateSinkRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setSink(sink) + .build(); + return createSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a sink that exports specified log entries to a destination. The export of + * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not + * permitted to write to the destination. A sink can export log entries only from the resource + * owning the sink. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * LogSink response = configServiceV2Client.createSink(parent.toString(), 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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not + * already in use. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink createSink(String parent, LogSink sink) { + CreateSinkRequest request = + CreateSinkRequest.newBuilder().setParent(parent).setSink(sink).build(); + return createSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a sink that exports specified log entries to a destination. The export of + * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not + * permitted to write to the destination. A sink can export log entries only from the resource + * owning the sink. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * CreateSinkRequest request = CreateSinkRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setSink(sink)
+ * .build();
+ * LogSink response = configServiceV2Client.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
+ */
+ public final LogSink createSink(CreateSinkRequest request) {
+ return createSinkCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a sink that exports specified log entries to a destination. The export of
+ * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not
+ * permitted to write to the destination. A sink can export log entries only from the resource
+ * owning the sink.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * CreateSinkRequest request = CreateSinkRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setSink(sink)
+ * .build();
+ * ApiFuture<LogSink> future = configServiceV2Client.createSinkCallable().futureCall(request);
+ * // Do something
+ * LogSink response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableThe updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * LogSink response = configServiceV2Client.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]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @param sink Required. The updated sink, whose name is the same identifier that appears as part + * of `sink_name`. + * @param updateMask Optional. Field mask that specifies the fields in `sink` that need an update. + * A sink field will be overwritten if, and only if, it is in the update mask. `name` and + * output only fields cannot be updated. + *
An empty updateMask is temporarily treated as using the following mask for backwards + * compatibility purposes: destination,filter,includeChildren At some point in the future, + * behavior will be removed and specifying an empty updateMask will be an error. + *
For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + *
Example: `updateMask=filter`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink updateSink(LogSinkName sinkName, LogSink sink, FieldMask updateMask) { + UpdateSinkRequest request = + UpdateSinkRequest.newBuilder() + .setSinkName(sinkName == null ? null : sinkName.toString()) + .setSink(sink) + .setUpdateMask(updateMask) + .build(); + return updateSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a sink. This method replaces the following fields in the existing sink with values from + * the new sink: `destination`, and `filter`. + * + *
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * LogSink response = configServiceV2Client.updateSink(sinkName.toString(), 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]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @param sink Required. The updated sink, whose name is the same identifier that appears as part + * of `sink_name`. + * @param updateMask Optional. Field mask that specifies the fields in `sink` that need an update. + * A sink field will be overwritten if, and only if, it is in the update mask. `name` and + * output only fields cannot be updated. + *
An empty updateMask is temporarily treated as using the following mask for backwards + * compatibility purposes: destination,filter,includeChildren At some point in the future, + * behavior will be removed and specifying an empty updateMask will be an error. + *
For a detailed `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask + *
Example: `updateMask=filter`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateMask) { + UpdateSinkRequest request = + UpdateSinkRequest.newBuilder() + .setSinkName(sinkName) + .setSink(sink) + .setUpdateMask(updateMask) + .build(); + return updateSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a sink. This method replaces the following fields in the existing sink with values from + * the new sink: `destination`, and `filter`. + * + *
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * LogSink response = configServiceV2Client.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]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @param sink Required. The updated sink, whose name is the same identifier that appears as part + * of `sink_name`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink updateSink(LogSinkName sinkName, LogSink sink) { + UpdateSinkRequest request = + UpdateSinkRequest.newBuilder() + .setSinkName(sinkName == null ? null : sinkName.toString()) + .setSink(sink) + .build(); + return updateSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a sink. This method replaces the following fields in the existing sink with values from + * the new sink: `destination`, and `filter`. + * + *
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * LogSink response = configServiceV2Client.updateSink(sinkName.toString(), 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]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @param sink Required. The updated sink, whose name is the same identifier that appears as part + * of `sink_name`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogSink updateSink(String sinkName, LogSink sink) { + UpdateSinkRequest request = + UpdateSinkRequest.newBuilder().setSinkName(sinkName).setSink(sink).build(); + return updateSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a sink. This method replaces the following fields in the existing sink with values from + * the new sink: `destination`, and `filter`. + * + *
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
+ * .setSinkName(sinkName.toString())
+ * .setSink(sink)
+ * .build();
+ * LogSink response = configServiceV2Client.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
+ */
+ public final LogSink updateSink(UpdateSinkRequest request) {
+ return updateSinkCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates a sink. This method replaces the following fields in the existing sink with values from
+ * the new sink: `destination`, and `filter`.
+ *
+ * The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink sink = LogSink.newBuilder().build();
+ * UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
+ * .setSinkName(sinkName.toString())
+ * .setSink(sink)
+ * .build();
+ * ApiFuture<LogSink> future = configServiceV2Client.updateSinkCallable().futureCall(request);
+ * // Do something
+ * LogSink response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * configServiceV2Client.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]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteSink(LogSinkName sinkName) { + DeleteSinkRequest request = + DeleteSinkRequest.newBuilder() + .setSinkName(sinkName == null ? null : sinkName.toString()) + .build(); + deleteSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also + * deleted. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * configServiceV2Client.deleteSink(sinkName.toString());
+ * }
+ *
+ *
+ * @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]" + * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + * "folders/[FOLDER_ID]/sinks/[SINK_ID]" + *
Example: `"projects/my-project-id/sinks/my-sink-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteSink(String sinkName) { + DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(sinkName).build(); + deleteSink(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also + * deleted. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
+ * .setSinkName(sinkName.toString())
+ * .build();
+ * configServiceV2Client.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
+ */
+ public final void deleteSink(DeleteSinkRequest request) {
+ deleteSinkCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also
+ * deleted.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
+ * .setSinkName(sinkName.toString())
+ * .build();
+ * ApiFuture<Void> future = configServiceV2Client.deleteSinkCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (LogExclusion element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExclusionsPagedResponse listExclusions(ProjectName parent) { + ListExclusionsRequest request = + ListExclusionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listExclusions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+ * for (LogExclusion element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExclusionsPagedResponse listExclusions(OrganizationName parent) { + ListExclusionsRequest request = + ListExclusionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listExclusions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * FolderName parent = FolderName.of("[FOLDER]");
+ * for (LogExclusion element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExclusionsPagedResponse listExclusions(FolderName parent) { + ListExclusionsRequest request = + ListExclusionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listExclusions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ * for (LogExclusion element : configServiceV2Client.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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExclusionsPagedResponse listExclusions(BillingAccountName parent) { + ListExclusionsRequest request = + ListExclusionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listExclusions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (LogExclusion element : configServiceV2Client.listExclusions(parent.toString()).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]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExclusionsPagedResponse listExclusions(String parent) { + ListExclusionsRequest request = ListExclusionsRequest.newBuilder().setParent(parent).build(); + return listExclusions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (LogExclusion element : configServiceV2Client.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
+ */
+ public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest request) {
+ return listExclusionsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists all the exclusions in a parent resource.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListExclusionsPagedResponse> future = configServiceV2Client.listExclusionsPagedCallable().futureCall(request);
+ * // Do something
+ * for (LogExclusion element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListExclusionsResponse response = configServiceV2Client.listExclusionsCallable().call(request);
+ * for (LogExclusion element : response.getExclusionsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * LogExclusion response = configServiceV2Client.getExclusion(name);
+ * }
+ *
+ *
+ * @param name Required. The resource name of an existing exclusion:
+ * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion getExclusion(LogExclusionName name) { + GetExclusionRequest request = + GetExclusionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the description of an exclusion. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * LogExclusion response = configServiceV2Client.getExclusion(name.toString());
+ * }
+ *
+ *
+ * @param name Required. The resource name of an existing exclusion:
+ * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion getExclusion(String name) { + GetExclusionRequest request = GetExclusionRequest.newBuilder().setName(name).build(); + return getExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the description of an exclusion. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * GetExclusionRequest request = GetExclusionRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * LogExclusion response = configServiceV2Client.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
+ */
+ public final LogExclusion getExclusion(GetExclusionRequest request) {
+ return getExclusionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the description of an exclusion.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * GetExclusionRequest request = GetExclusionRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<LogExclusion> future = configServiceV2Client.getExclusionCallable().futureCall(request);
+ * // Do something
+ * LogExclusion response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * LogExclusion response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that + * is not already used in the parent resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion createExclusion(ProjectName parent, LogExclusion exclusion) { + CreateExclusionRequest request = + CreateExclusionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setExclusion(exclusion) + .build(); + return createExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * LogExclusion response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that + * is not already used in the parent resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion createExclusion(OrganizationName parent, LogExclusion exclusion) { + CreateExclusionRequest request = + CreateExclusionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setExclusion(exclusion) + .build(); + return createExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * FolderName parent = FolderName.of("[FOLDER]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * LogExclusion response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that + * is not already used in the parent resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion createExclusion(FolderName parent, LogExclusion exclusion) { + CreateExclusionRequest request = + CreateExclusionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setExclusion(exclusion) + .build(); + return createExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * LogExclusion response = configServiceV2Client.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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that + * is not already used in the parent resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion createExclusion(BillingAccountName parent, LogExclusion exclusion) { + CreateExclusionRequest request = + CreateExclusionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setExclusion(exclusion) + .build(); + return createExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * LogExclusion response = configServiceV2Client.createExclusion(parent.toString(), 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]" + *
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that + * is not already used in the parent resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion createExclusion(String parent, LogExclusion exclusion) { + CreateExclusionRequest request = + CreateExclusionRequest.newBuilder().setParent(parent).setExclusion(exclusion).build(); + return createExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setExclusion(exclusion)
+ * .build();
+ * LogExclusion response = configServiceV2Client.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
+ */
+ public final LogExclusion createExclusion(CreateExclusionRequest request) {
+ return createExclusionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * 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: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setExclusion(exclusion)
+ * .build();
+ * ApiFuture<LogExclusion> future = configServiceV2Client.createExclusionCallable().futureCall(request);
+ * // Do something
+ * LogExclusion response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * LogExclusion response = configServiceV2Client.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]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @param exclusion Required. New values for the existing exclusion. Only the fields specified in + * `update_mask` are relevant. + * @param updateMask Required. A non-empty list of fields to change in the existing exclusion. New + * values for the fields are taken from the corresponding fields in the + * [LogExclusion][google.logging.v2.LogExclusion] included in this request. Fields not + * mentioned in `update_mask` are not changed and are ignored in the request. + *
For example, to change the filter and description of an exclusion, specify an + * `update_mask` of `"filter,description"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion updateExclusion( + LogExclusionName name, LogExclusion exclusion, FieldMask updateMask) { + UpdateExclusionRequest request = + UpdateExclusionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setExclusion(exclusion) + .setUpdateMask(updateMask) + .build(); + return updateExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes one or more properties of an existing exclusion. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * LogExclusion response = configServiceV2Client.updateExclusion(name.toString(), 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]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @param exclusion Required. New values for the existing exclusion. Only the fields specified in + * `update_mask` are relevant. + * @param updateMask Required. A non-empty list of fields to change in the existing exclusion. New + * values for the fields are taken from the corresponding fields in the + * [LogExclusion][google.logging.v2.LogExclusion] included in this request. Fields not + * mentioned in `update_mask` are not changed and are ignored in the request. + *
For example, to change the filter and description of an exclusion, specify an + * `update_mask` of `"filter,description"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion updateExclusion( + String name, LogExclusion exclusion, FieldMask updateMask) { + UpdateExclusionRequest request = + UpdateExclusionRequest.newBuilder() + .setName(name) + .setExclusion(exclusion) + .setUpdateMask(updateMask) + .build(); + return updateExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes one or more properties of an existing exclusion. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
+ * .setName(name.toString())
+ * .setExclusion(exclusion)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * LogExclusion response = configServiceV2Client.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
+ */
+ public final LogExclusion updateExclusion(UpdateExclusionRequest request) {
+ return updateExclusionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Changes one or more properties of an existing exclusion.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * LogExclusion exclusion = LogExclusion.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
+ * .setName(name.toString())
+ * .setExclusion(exclusion)
+ * .setUpdateMask(updateMask)
+ * .build();
+ * ApiFuture<LogExclusion> future = configServiceV2Client.updateExclusionCallable().futureCall(request);
+ * // Do something
+ * LogExclusion response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * configServiceV2Client.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]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteExclusion(LogExclusionName name) { + DeleteExclusionRequest request = + DeleteExclusionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an exclusion. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * configServiceV2Client.deleteExclusion(name.toString());
+ * }
+ *
+ *
+ * @param name Required. The resource name of an existing exclusion to delete:
+ * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteExclusion(String name) { + DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(name).build(); + deleteExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an exclusion. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * configServiceV2Client.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
+ */
+ public final void deleteExclusion(DeleteExclusionRequest request) {
+ deleteExclusionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes an exclusion.
+ *
+ * Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
+ * DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = configServiceV2Client.deleteExclusionCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ public final UnaryCallableNote: CMEK for the Logs Router can currently only be configured for GCP organizations. Once + * configured, it applies to all projects and folders in the GCP organization. + * + *
See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more + * information. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * CmekSettingsName name = CmekSettingsName.ofProjectName("[PROJECT]");
+ * GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * CmekSettings response = configServiceV2Client.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
+ */
+ public final CmekSettings getCmekSettings(GetCmekSettingsRequest request) {
+ return getCmekSettingsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the Logs Router CMEK settings for the given resource.
+ *
+ * Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once + * configured, it applies to all projects and folders in the GCP organization. + * + *
See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more + * information. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * CmekSettingsName name = CmekSettingsName.ofProjectName("[PROJECT]");
+ * GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<CmekSettings> future = configServiceV2Client.getCmekSettingsCallable().futureCall(request);
+ * // Do something
+ * CmekSettings response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableNote: CMEK for the Logs Router can currently only be configured for GCP organizations. Once + * configured, it applies to all projects and folders in the GCP organization. + * + *
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) + * `kms_key_name` is invalid, or 2) the associated service account does not have the required + * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key + * is disabled. + * + *
See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more + * information. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * String name = "";
+ * CmekSettings cmekSettings = CmekSettings.newBuilder().build();
+ * UpdateCmekSettingsRequest request = UpdateCmekSettingsRequest.newBuilder()
+ * .setName(name)
+ * .setCmekSettings(cmekSettings)
+ * .build();
+ * CmekSettings response = configServiceV2Client.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
+ */
+ public final CmekSettings updateCmekSettings(UpdateCmekSettingsRequest request) {
+ return updateCmekSettingsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the Logs Router CMEK settings for the given resource.
+ *
+ * Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once + * configured, it applies to all projects and folders in the GCP organization. + * + *
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) + * `kms_key_name` is invalid, or 2) the associated service account does not have the required + * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key + * is disabled. + * + *
See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more + * information. + * + *
Sample code: + * + *
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * String name = "";
+ * CmekSettings cmekSettings = CmekSettings.newBuilder().build();
+ * UpdateCmekSettingsRequest request = UpdateCmekSettingsRequest.newBuilder()
+ * .setName(name)
+ * .setCmekSettings(cmekSettings)
+ * .build();
+ * ApiFuture<CmekSettings> future = configServiceV2Client.updateCmekSettingsCallable().futureCall(request);
+ * // Do something
+ * CmekSettings response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableThe default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of getSink to 30 seconds: + * + *
+ *
+ * ConfigServiceV2Settings.Builder configServiceV2SettingsBuilder =
+ * ConfigServiceV2Settings.newBuilder();
+ * configServiceV2SettingsBuilder
+ * .getSinkSettings()
+ * .setRetrySettings(
+ * configServiceV2SettingsBuilder.getSinkSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * ConfigServiceV2Settings configServiceV2Settings = configServiceV2SettingsBuilder.build();
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class ConfigServiceV2Settings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the loggingServiceV2Client object to clean up resources
+ * such as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ * The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ * See the individual methods for example code.
+ *
+ * Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ * This class can be customized by passing in a custom instance of LoggingServiceV2Settings to
+ * create(). For example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * "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]"
+ * `[LOG_ID]` must be URL-encoded. For example, `"projects/my-project-id/logs/syslog"`,
+ * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. For more
+ * information about log names, see [LogEntry][google.logging.v2.LogEntry].
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLog(LogName logName) {
+ DeleteLogRequest request =
+ DeleteLogRequest.newBuilder()
+ .setLogName(logName == null ? null : logName.toString())
+ .build();
+ deleteLog(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
+ * 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:
+ *
+ * "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]"
+ * `[LOG_ID]` must be URL-encoded. For example, `"projects/my-project-id/logs/syslog"`,
+ * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. For more
+ * information about log names, see [LogEntry][google.logging.v2.LogEntry].
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLog(String logName) {
+ DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(logName).build();
+ deleteLog(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
+ * 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:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * "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]"
+ * `[LOG_ID]` must be URL-encoded. For example:
+ * "projects/my-project-id/logs/syslog"
+ * "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
+ * The permission `logging.logEntries.create` is needed on each project, organization,
+ * billing account, or folder that is receiving new log entries, whether the resource is
+ * specified in `logName` or in an individual log entry.
+ * @param resource Optional. A default monitored resource object that is assigned to all log
+ * entries in `entries` that do not specify a value for `resource`. Example:
+ * { "type": "gce_instance", "labels": { "zone": "us-central1-a", "instance_id":
+ * "00000000000000000000" }}
+ * See [LogEntry][google.logging.v2.LogEntry].
+ * @param labels Optional. Default labels that are added to the `labels` field of all log entries
+ * in `entries`. If a log entry already has a label with the same key as a label in this
+ * parameter, then the log entry's label is not changed. See
+ * [LogEntry][google.logging.v2.LogEntry].
+ * @param entries Required. The log entries to send to Logging. The order of log entries in this
+ * list does not matter. Values supplied in this method's `log_name`, `resource`, and `labels`
+ * fields are copied into those log entries in this list that do not include values for their
+ * corresponding fields. For more information, see the [LogEntry][google.logging.v2.LogEntry]
+ * type.
+ * If the `timestamp` or `insert_id` fields are missing in log entries, then this method
+ * supplies the current time or a unique identifier, respectively. The supplied values are
+ * chosen so that, among the log entries that did not supply their own values, the entries
+ * earlier in the list will sort before the entries later in the list. See the `entries.list`
+ * method.
+ * Log entries with timestamps that are more than the [logs retention
+ * period](/logging/quota-policy) in the past or more than 24 hours in the future will not be
+ * available when calling `entries.list`. However, those log entries can still be [exported
+ * with LogSinks](/logging/docs/api/tasks/exporting-logs).
+ * To improve throughput and to avoid exceeding the [quota limit](/logging/quota-policy)
+ * for calls to `entries.write`, you should try to include several log entries in this list,
+ * rather than calling this method for each individual log entry.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final WriteLogEntriesResponse writeLogEntries(
+ LogName logName,
+ MonitoredResource resource,
+ Map Sample code:
+ *
+ * "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]"
+ * `[LOG_ID]` must be URL-encoded. For example:
+ * "projects/my-project-id/logs/syslog"
+ * "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
+ * The permission `logging.logEntries.create` is needed on each project, organization,
+ * billing account, or folder that is receiving new log entries, whether the resource is
+ * specified in `logName` or in an individual log entry.
+ * @param resource Optional. A default monitored resource object that is assigned to all log
+ * entries in `entries` that do not specify a value for `resource`. Example:
+ * { "type": "gce_instance", "labels": { "zone": "us-central1-a", "instance_id":
+ * "00000000000000000000" }}
+ * See [LogEntry][google.logging.v2.LogEntry].
+ * @param labels Optional. Default labels that are added to the `labels` field of all log entries
+ * in `entries`. If a log entry already has a label with the same key as a label in this
+ * parameter, then the log entry's label is not changed. See
+ * [LogEntry][google.logging.v2.LogEntry].
+ * @param entries Required. The log entries to send to Logging. The order of log entries in this
+ * list does not matter. Values supplied in this method's `log_name`, `resource`, and `labels`
+ * fields are copied into those log entries in this list that do not include values for their
+ * corresponding fields. For more information, see the [LogEntry][google.logging.v2.LogEntry]
+ * type.
+ * If the `timestamp` or `insert_id` fields are missing in log entries, then this method
+ * supplies the current time or a unique identifier, respectively. The supplied values are
+ * chosen so that, among the log entries that did not supply their own values, the entries
+ * earlier in the list will sort before the entries later in the list. See the `entries.list`
+ * method.
+ * Log entries with timestamps that are more than the [logs retention
+ * period](/logging/quota-policy) in the past or more than 24 hours in the future will not be
+ * available when calling `entries.list`. However, those log entries can still be [exported
+ * with LogSinks](/logging/docs/api/tasks/exporting-logs).
+ * To improve throughput and to avoid exceeding the [quota limit](/logging/quota-policy)
+ * for calls to `entries.write`, you should try to include several log entries in this list,
+ * rather than calling this method for each individual log entry.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final WriteLogEntriesResponse writeLogEntries(
+ String logName,
+ MonitoredResource resource,
+ Map Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
+ * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
+ * Projects listed in the `project_ids` field are added to this list.
+ * @param filter Optional. A filter that chooses which log entries to return. See [Advanced Logs
+ * Queries](/logging/docs/view/advanced-queries). Only log entries that match the filter are
+ * returned. An empty filter matches all log entries in the resources listed in
+ * `resource_names`. Referencing a parent resource that is not listed in `resource_names` will
+ * cause the filter to return no results. The maximum length of the filter is 20000
+ * characters.
+ * @param orderBy Optional. How the results should be sorted. Presently, the only permitted values
+ * are `"timestamp asc"` (default) and `"timestamp desc"`. The first option returns entries in
+ * order of increasing values of `LogEntry.timestamp` (oldest first), and the second option
+ * returns entries in order of decreasing timestamps (newest first). Entries with equal
+ * timestamps are returned in order of their `insert_id` values.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogEntriesPagedResponse listLogEntries(
+ List Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
+ * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogsPagedResponse listLogs(ProjectName parent) {
+ ListLogsRequest request =
+ ListLogsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listLogs(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have
+ * entries are listed.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
+ * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogsPagedResponse listLogs(OrganizationName parent) {
+ ListLogsRequest request =
+ ListLogsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listLogs(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have
+ * entries are listed.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
+ * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogsPagedResponse listLogs(FolderName parent) {
+ ListLogsRequest request =
+ ListLogsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listLogs(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have
+ * entries are listed.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
+ * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogsPagedResponse listLogs(BillingAccountName parent) {
+ ListLogsRequest request =
+ ListLogsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listLogs(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have
+ * entries are listed.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
+ * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogsPagedResponse listLogs(String parent) {
+ ListLogsRequest request = ListLogsRequest.newBuilder().setParent(parent).build();
+ return listLogs(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have
+ * entries are listed.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of deleteLog to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the metricsServiceV2Client object to clean up resources
+ * such as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ * The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ * See the individual methods for example code.
+ *
+ * Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ * This class can be customized by passing in a custom instance of MetricsServiceV2Settings to
+ * create(). For example:
+ *
+ * To customize credentials:
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogMetricsPagedResponse listLogMetrics(ProjectName parent) {
+ ListLogMetricsRequest request =
+ ListLogMetricsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listLogMetrics(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists logs-based metrics.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogMetricsPagedResponse listLogMetrics(String parent) {
+ ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder().setParent(parent).build();
+ return listLogMetrics(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists logs-based metrics.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric getLogMetric(LogMetricName metricName) {
+ GetLogMetricRequest request =
+ GetLogMetricRequest.newBuilder()
+ .setMetricName(metricName == null ? null : metricName.toString())
+ .build();
+ return getLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a logs-based metric.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric getLogMetric(String metricName) {
+ GetLogMetricRequest request =
+ GetLogMetricRequest.newBuilder().setMetricName(metricName).build();
+ return getLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a logs-based metric.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]"
+ * The new metric must be provided in the request.
+ * @param metric Required. The new logs-based metric, which must not have an identifier that
+ * already exists.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric createLogMetric(ProjectName parent, LogMetric metric) {
+ CreateLogMetricRequest request =
+ CreateLogMetricRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setMetric(metric)
+ .build();
+ return createLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a logs-based metric.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]"
+ * The new metric must be provided in the request.
+ * @param metric Required. The new logs-based metric, which must not have an identifier that
+ * already exists.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric createLogMetric(String parent, LogMetric metric) {
+ CreateLogMetricRequest request =
+ CreateLogMetricRequest.newBuilder().setParent(parent).setMetric(metric).build();
+ return createLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a logs-based metric.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
+ * The updated metric must be provided in the request and it's `name` field must be the
+ * same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is
+ * created.
+ * @param metric Required. The updated metric.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric updateLogMetric(LogMetricName metricName, LogMetric metric) {
+ UpdateLogMetricRequest request =
+ UpdateLogMetricRequest.newBuilder()
+ .setMetricName(metricName == null ? null : metricName.toString())
+ .setMetric(metric)
+ .build();
+ return updateLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates or updates a logs-based metric.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
+ * The updated metric must be provided in the request and it's `name` field must be the
+ * same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is
+ * created.
+ * @param metric Required. The updated metric.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
+ UpdateLogMetricRequest request =
+ UpdateLogMetricRequest.newBuilder().setMetricName(metricName).setMetric(metric).build();
+ return updateLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates or updates a logs-based metric.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLogMetric(LogMetricName metricName) {
+ DeleteLogMetricRequest request =
+ DeleteLogMetricRequest.newBuilder()
+ .setMetricName(metricName == null ? null : metricName.toString())
+ .build();
+ deleteLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a logs-based metric.
+ *
+ * Sample code:
+ *
+ * "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLogMetric(String metricName) {
+ DeleteLogMetricRequest request =
+ DeleteLogMetricRequest.newBuilder().setMetricName(metricName).build();
+ deleteLogMetric(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a logs-based metric.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of getLogMetric to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
*
- * ============ ConfigClient ============
+ * ===================== ConfigServiceV2Client =====================
*
* Service Description: Service for configuring sinks used to route log entries.
*
- * Sample for ConfigClient:
+ * Sample for ConfigServiceV2Client:
*
* Service Description: Service for ingesting and querying logs.
*
- * Sample for LoggingClient:
+ * Sample for LoggingServiceV2Client:
*
* Service Description: Service for configuring logs-based metrics.
*
- * Sample for MetricsClient:
+ * Sample for MetricsServiceV2Client:
*
*
+ *
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * loggingServiceV2Client.deleteLog(logName);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * LoggingServiceV2Settings loggingServiceV2Settings =
+ * LoggingServiceV2Settings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * LoggingServiceV2Client loggingServiceV2Client =
+ * LoggingServiceV2Client.create(loggingServiceV2Settings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class LoggingServiceV2Client implements BackgroundResource {
+ private final LoggingServiceV2Settings settings;
+ private final LoggingServiceV2Stub stub;
+
+ /** Constructs an instance of LoggingServiceV2Client with default settings. */
+ public static final LoggingServiceV2Client create() throws IOException {
+ return create(LoggingServiceV2Settings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of LoggingServiceV2Client, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final LoggingServiceV2Client create(LoggingServiceV2Settings settings)
+ throws IOException {
+ return new LoggingServiceV2Client(settings);
+ }
+
+ /**
+ * Constructs an instance of LoggingServiceV2Client, using the given stub for making calls. This
+ * is for advanced usage - prefer to use LoggingServiceV2Settings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final LoggingServiceV2Client create(LoggingServiceV2Stub stub) {
+ return new LoggingServiceV2Client(stub);
+ }
+
+ /**
+ * Constructs an instance of LoggingServiceV2Client, using the given settings. This is protected
+ * so that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected LoggingServiceV2Client(LoggingServiceV2Settings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((LoggingServiceV2StubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected LoggingServiceV2Client(LoggingServiceV2Stub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final LoggingServiceV2Settings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public LoggingServiceV2Stub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
+ * 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.
+ *
+ *
+ * LoggingServiceV2Settings loggingServiceV2Settings =
+ * LoggingServiceV2Settings.newBuilder().setEndpoint(myEndpoint).build();
+ * LoggingServiceV2Client loggingServiceV2Client =
+ * LoggingServiceV2Client.create(loggingServiceV2Settings);
+ *
+ *
+ *
+ * @param logName Required. The resource name of the log to delete:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * loggingServiceV2Client.deleteLog(logName);
+ * }
+ *
+ *
+ * @param logName Required. The resource name of the log to delete:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * loggingServiceV2Client.deleteLog(logName.toString());
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLog(DeleteLogRequest request) {
+ deleteLogCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
+ * 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.
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * DeleteLogRequest request = DeleteLogRequest.newBuilder()
+ * .setLogName(logName.toString())
+ * .build();
+ * loggingServiceV2Client.deleteLog(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * DeleteLogRequest request = DeleteLogRequest.newBuilder()
+ * .setLogName(logName.toString())
+ * .build();
+ * ApiFuture<Void> future = loggingServiceV2Client.deleteLogCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ * @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`:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * MonitoredResource resource = MonitoredResource.newBuilder().build();
+ * Map<String, String> labels = new HashMap<>();
+ * List<LogEntry> entries = new ArrayList<>();
+ * WriteLogEntriesResponse response = loggingServiceV2Client.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`:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * MonitoredResource resource = MonitoredResource.newBuilder().build();
+ * Map<String, String> labels = new HashMap<>();
+ * List<LogEntry> entries = new ArrayList<>();
+ * WriteLogEntriesResponse response = loggingServiceV2Client.writeLogEntries(logName.toString(), resource, labels, entries);
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest request) {
+ return writeLogEntriesCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Writes log entries to Logging. This API method is the only way to send log entries to Logging.
+ * This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging
+ * 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)
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * List<LogEntry> entries = new ArrayList<>();
+ * WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder()
+ * .addAllEntries(entries)
+ * .build();
+ * WriteLogEntriesResponse response = loggingServiceV2Client.writeLogEntries(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * List<LogEntry> entries = new ArrayList<>();
+ * WriteLogEntriesRequest request = WriteLogEntriesRequest.newBuilder()
+ * .addAllEntries(entries)
+ * .build();
+ * ApiFuture<WriteLogEntriesResponse> future = loggingServiceV2Client.writeLogEntriesCallable().futureCall(request);
+ * // Do something
+ * WriteLogEntriesResponse response = future.get();
+ * }
+ *
+ *
+ * @param resourceNames Required. Names of one or more parent resources from which to retrieve log
+ * entries:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * List<String> formattedResourceNames = new ArrayList<>();
+ * String filter = "";
+ * String orderBy = "";
+ * for (LogEntry element : loggingServiceV2Client.listLogEntries(formattedResourceNames, filter, orderBy).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest request) {
+ return listLogEntriesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists log entries. Use this method to retrieve log entries that originated from a
+ * project/folder/organization/billing account. For ways to export log entries, see [Exporting
+ * Logs](/logging/docs/export).
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * List<ProjectName> resourceNames = new ArrayList<>();
+ * ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
+ * .addAllResourceNames(ProjectName.toStringList(resourceNames))
+ * .build();
+ * for (LogEntry element : loggingServiceV2Client.listLogEntries(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * List<ProjectName> resourceNames = new ArrayList<>();
+ * ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
+ * .addAllResourceNames(ProjectName.toStringList(resourceNames))
+ * .build();
+ * ApiFuture<ListLogEntriesPagedResponse> future = loggingServiceV2Client.listLogEntriesPagedCallable().futureCall(request);
+ * // Do something
+ * for (LogEntry element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * List<ProjectName> resourceNames = new ArrayList<>();
+ * ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
+ * .addAllResourceNames(ProjectName.toStringList(resourceNames))
+ * .build();
+ * while (true) {
+ * ListLogEntriesResponse response = loggingServiceV2Client.listLogEntriesCallable().call(request);
+ * for (LogEntry element : response.getEntriesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors(
+ ListMonitoredResourceDescriptorsRequest request) {
+ return listMonitoredResourceDescriptorsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the descriptors for monitored resource types used by Logging.
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder().build();
+ * for (MonitoredResourceDescriptor element : loggingServiceV2Client.listMonitoredResourceDescriptors(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable<
+ ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse>
+ listMonitoredResourceDescriptorsPagedCallable() {
+ return stub.listMonitoredResourceDescriptorsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the descriptors for monitored resource types used by Logging.
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder().build();
+ * ApiFuture<ListMonitoredResourceDescriptorsPagedResponse> future = loggingServiceV2Client.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
+ * // Do something
+ * for (MonitoredResourceDescriptor element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable<
+ ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse>
+ listMonitoredResourceDescriptorsCallable() {
+ return stub.listMonitoredResourceDescriptorsCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have
+ * entries are listed.
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder().build();
+ * while (true) {
+ * ListMonitoredResourceDescriptorsResponse response = loggingServiceV2Client.listMonitoredResourceDescriptorsCallable().call(request);
+ * for (MonitoredResourceDescriptor element : response.getResourceDescriptorsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The resource name that owns the logs:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (String element : loggingServiceV2Client.listLogs(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The resource name that owns the logs:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+ * for (String element : loggingServiceV2Client.listLogs(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The resource name that owns the logs:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * FolderName parent = FolderName.of("[FOLDER]");
+ * for (String element : loggingServiceV2Client.listLogs(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The resource name that owns the logs:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ * for (String element : loggingServiceV2Client.listLogs(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The resource name that owns the logs:
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (String element : loggingServiceV2Client.listLogs(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogsPagedResponse listLogs(ListLogsRequest request) {
+ return listLogsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have
+ * entries are listed.
+ *
+ *
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListLogsRequest request = ListLogsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (String element : loggingServiceV2Client.listLogs(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListLogsRequest request = ListLogsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListLogsPagedResponse> future = loggingServiceV2Client.listLogsPagedCallable().futureCall(request);
+ * // Do something
+ * for (String element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListLogsRequest request = ListLogsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListLogsResponse response = loggingServiceV2Client.listLogsCallable().call(request);
+ * for (String element : response.getLogNamesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class LoggingServiceV2Settings extends ClientSettings
+ * LoggingServiceV2Settings.Builder loggingServiceV2SettingsBuilder =
+ * LoggingServiceV2Settings.newBuilder();
+ * loggingServiceV2SettingsBuilder
+ * .deleteLogSettings()
+ * .setRetrySettings(
+ * loggingServiceV2SettingsBuilder.deleteLogSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * LoggingServiceV2Settings loggingServiceV2Settings = loggingServiceV2SettingsBuilder.build();
+ *
+ *
+ *
+ *
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric response = metricsServiceV2Client.getLogMetric(metricName);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ * MetricsServiceV2Settings metricsServiceV2Settings =
+ * MetricsServiceV2Settings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * MetricsServiceV2Client metricsServiceV2Client =
+ * MetricsServiceV2Client.create(metricsServiceV2Settings);
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class MetricsServiceV2Client implements BackgroundResource {
+ private final MetricsServiceV2Settings settings;
+ private final MetricsServiceV2Stub stub;
+
+ /** Constructs an instance of MetricsServiceV2Client with default settings. */
+ public static final MetricsServiceV2Client create() throws IOException {
+ return create(MetricsServiceV2Settings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of MetricsServiceV2Client, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final MetricsServiceV2Client create(MetricsServiceV2Settings settings)
+ throws IOException {
+ return new MetricsServiceV2Client(settings);
+ }
+
+ /**
+ * Constructs an instance of MetricsServiceV2Client, using the given stub for making calls. This
+ * is for advanced usage - prefer to use MetricsServiceV2Settings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final MetricsServiceV2Client create(MetricsServiceV2Stub stub) {
+ return new MetricsServiceV2Client(stub);
+ }
+
+ /**
+ * Constructs an instance of MetricsServiceV2Client, using the given settings. This is protected
+ * so that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected MetricsServiceV2Client(MetricsServiceV2Settings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((MetricsServiceV2StubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected MetricsServiceV2Client(MetricsServiceV2Stub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final MetricsServiceV2Settings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public MetricsServiceV2Stub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists logs-based metrics.
+ *
+ *
+ * MetricsServiceV2Settings metricsServiceV2Settings =
+ * MetricsServiceV2Settings.newBuilder().setEndpoint(myEndpoint).build();
+ * MetricsServiceV2Client metricsServiceV2Client =
+ * MetricsServiceV2Client.create(metricsServiceV2Settings);
+ *
+ *
+ *
+ * @param parent Required. The name of the project containing the metrics:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (LogMetric element : metricsServiceV2Client.listLogMetrics(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The name of the project containing the metrics:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (LogMetric element : metricsServiceV2Client.listLogMetrics(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest request) {
+ return listLogMetricsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists logs-based metrics.
+ *
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (LogMetric element : metricsServiceV2Client.listLogMetrics(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListLogMetricsPagedResponse> future = metricsServiceV2Client.listLogMetricsPagedCallable().futureCall(request);
+ * // Do something
+ * for (LogMetric element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListLogMetricsResponse response = metricsServiceV2Client.listLogMetricsCallable().call(request);
+ * for (LogMetric element : response.getMetricsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ *
+ * @param metricName Required. The resource name of the desired metric:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric response = metricsServiceV2Client.getLogMetric(metricName);
+ * }
+ *
+ *
+ * @param metricName Required. The resource name of the desired metric:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric response = metricsServiceV2Client.getLogMetric(metricName.toString());
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric getLogMetric(GetLogMetricRequest request) {
+ return getLogMetricCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a logs-based metric.
+ *
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * GetLogMetricRequest request = GetLogMetricRequest.newBuilder()
+ * .setMetricName(metricName.toString())
+ * .build();
+ * LogMetric response = metricsServiceV2Client.getLogMetric(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * GetLogMetricRequest request = GetLogMetricRequest.newBuilder()
+ * .setMetricName(metricName.toString())
+ * .build();
+ * ApiFuture<LogMetric> future = metricsServiceV2Client.getLogMetricCallable().futureCall(request);
+ * // Do something
+ * LogMetric response = future.get();
+ * }
+ *
+ *
+ * @param parent Required. The resource name of the project in which to create the metric:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * LogMetric response = metricsServiceV2Client.createLogMetric(parent, metric);
+ * }
+ *
+ *
+ * @param parent Required. The resource name of the project in which to create the metric:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * LogMetric response = metricsServiceV2Client.createLogMetric(parent.toString(), metric);
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric createLogMetric(CreateLogMetricRequest request) {
+ return createLogMetricCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a logs-based metric.
+ *
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setMetric(metric)
+ * .build();
+ * LogMetric response = metricsServiceV2Client.createLogMetric(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setMetric(metric)
+ * .build();
+ * ApiFuture<LogMetric> future = metricsServiceV2Client.createLogMetricCallable().futureCall(request);
+ * // Do something
+ * LogMetric response = future.get();
+ * }
+ *
+ *
+ * @param metricName Required. The resource name of the metric to update:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * LogMetric response = metricsServiceV2Client.updateLogMetric(metricName, metric);
+ * }
+ *
+ *
+ * @param metricName Required. The resource name of the metric to update:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * LogMetric response = metricsServiceV2Client.updateLogMetric(metricName.toString(), metric);
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogMetric updateLogMetric(UpdateLogMetricRequest request) {
+ return updateLogMetricCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates or updates a logs-based metric.
+ *
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder()
+ * .setMetricName(metricName.toString())
+ * .setMetric(metric)
+ * .build();
+ * LogMetric response = metricsServiceV2Client.updateLogMetric(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric metric = LogMetric.newBuilder().build();
+ * UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder()
+ * .setMetricName(metricName.toString())
+ * .setMetric(metric)
+ * .build();
+ * ApiFuture<LogMetric> future = metricsServiceV2Client.updateLogMetricCallable().futureCall(request);
+ * // Do something
+ * LogMetric response = future.get();
+ * }
+ *
+ *
+ * @param metricName Required. The resource name of the metric to delete:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * metricsServiceV2Client.deleteLogMetric(metricName);
+ * }
+ *
+ *
+ * @param metricName Required. The resource name of the metric to delete:
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * metricsServiceV2Client.deleteLogMetric(metricName.toString());
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLogMetric(DeleteLogMetricRequest request) {
+ deleteLogMetricCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a logs-based metric.
+ *
+ *
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder()
+ * .setMetricName(metricName.toString())
+ * .build();
+ * metricsServiceV2Client.deleteLogMetric(request);
+ * }
+ *
+ */
+ public final UnaryCallable
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder()
+ * .setMetricName(metricName.toString())
+ * .build();
+ * ApiFuture<Void> future = metricsServiceV2Client.deleteLogMetricCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class MetricsServiceV2Settings extends ClientSettings
+ * MetricsServiceV2Settings.Builder metricsServiceV2SettingsBuilder =
+ * MetricsServiceV2Settings.newBuilder();
+ * metricsServiceV2SettingsBuilder
+ * .getLogMetricSettings()
+ * .setRetrySettings(
+ * metricsServiceV2SettingsBuilder.getLogMetricSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * MetricsServiceV2Settings metricsServiceV2Settings = metricsServiceV2SettingsBuilder.build();
+ *
+ *
*
*
- * ============= LoggingClient =============
+ * ====================== LoggingServiceV2Client ======================
*
*
- * try (ConfigClient configClient = ConfigClient.create()) {
- * SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
- * LogSink response = configClient.getSink(sinkName);
+ * try (ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.create()) {
+ * LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
+ * LogSink response = configServiceV2Client.getSink(sinkName);
* }
*
*
*
*
- * ============= MetricsClient =============
+ * ====================== MetricsServiceV2Client ======================
*
*
- * try (LoggingClient loggingClient = LoggingClient.create()) {
- * LogName logName = ProjectLogName.of("[PROJECT]", "[LOG]");
- * loggingClient.deleteLog(logName);
+ * try (LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.create()) {
+ * LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
+ * loggingServiceV2Client.deleteLog(logName);
* }
*
*
*
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java
index 703a3521a..5e4273fd2 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java
@@ -15,8 +15,9 @@
*/
package com.google.cloud.logging.v2.stub;
-import static com.google.cloud.logging.v2.ConfigClient.ListExclusionsPagedResponse;
-import static com.google.cloud.logging.v2.ConfigClient.ListSinksPagedResponse;
+import static com.google.cloud.logging.v2.ConfigServiceV2Client.ListBucketsPagedResponse;
+import static com.google.cloud.logging.v2.ConfigServiceV2Client.ListExclusionsPagedResponse;
+import static com.google.cloud.logging.v2.ConfigServiceV2Client.ListSinksPagedResponse;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
@@ -26,15 +27,20 @@
import com.google.logging.v2.CreateSinkRequest;
import com.google.logging.v2.DeleteExclusionRequest;
import com.google.logging.v2.DeleteSinkRequest;
+import com.google.logging.v2.GetBucketRequest;
import com.google.logging.v2.GetCmekSettingsRequest;
import com.google.logging.v2.GetExclusionRequest;
import com.google.logging.v2.GetSinkRequest;
+import com.google.logging.v2.ListBucketsRequest;
+import com.google.logging.v2.ListBucketsResponse;
import com.google.logging.v2.ListExclusionsRequest;
import com.google.logging.v2.ListExclusionsResponse;
import com.google.logging.v2.ListSinksRequest;
import com.google.logging.v2.ListSinksResponse;
+import com.google.logging.v2.LogBucket;
import com.google.logging.v2.LogExclusion;
import com.google.logging.v2.LogSink;
+import com.google.logging.v2.UpdateBucketRequest;
import com.google.logging.v2.UpdateCmekSettingsRequest;
import com.google.logging.v2.UpdateExclusionRequest;
import com.google.logging.v2.UpdateSinkRequest;
@@ -51,6 +57,22 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class ConfigServiceV2Stub implements BackgroundResource {
+ public UnaryCallable
- * try (MetricsClient metricsClient = MetricsClient.create()) {
- * MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]");
- * LogMetric response = metricsClient.getLogMetric(metricName);
+ * try (MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.create()) {
+ * LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
+ * LogMetric response = metricsServiceV2Client.getLogMetric(metricName);
* }
*
*
*
*/
@@ -111,6 +117,10 @@ public class ConfigServiceV2StubSettings extends StubSettings
- * ConfigServiceV2StubSettings.Builder configSettingsBuilder =
+ * ConfigServiceV2StubSettings.Builder configServiceV2SettingsBuilder =
* ConfigServiceV2StubSettings.newBuilder();
- * configSettingsBuilder
+ * configServiceV2SettingsBuilder
* .getSinkSettings()
* .setRetrySettings(
- * configSettingsBuilder.getSinkSettings().getRetrySettings().toBuilder()
+ * configServiceV2SettingsBuilder.getSinkSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
- * ConfigServiceV2StubSettings configSettings = configSettingsBuilder.build();
+ * ConfigServiceV2StubSettings configServiceV2Settings = configServiceV2SettingsBuilder.build();
*
*