From 18a19771d42b71e28d7f5e8e65d078169ba775b8 Mon Sep 17 00:00:00 2001 From: Suraj Dhamecha <48670070+suraj-qlogic@users.noreply.github.com> Date: Wed, 23 Sep 2020 21:56:49 +0530 Subject: [PATCH] chore: remove duplicate monitor client classes (#271) --- .../v3/AlertPolicyServiceClient.java | 823 --------- .../v3/AlertPolicyServiceSettings.java | 231 --- .../monitoring/v3/GroupServiceClient.java | 987 ---------- .../monitoring/v3/GroupServiceSettings.java | 244 --- .../monitoring/v3/MetricServiceClient.java | 1492 --------------- .../monitoring/v3/MetricServiceSettings.java | 292 --- .../v3/NotificationChannelServiceClient.java | 1611 ----------------- .../NotificationChannelServiceSettings.java | 345 ---- .../v3/UptimeCheckServiceClient.java | 928 ---------- .../v3/UptimeCheckServiceSettings.java | 258 --- .../cloud/monitoring/v3/package-info.java | 121 -- .../v3/stub/AlertPolicyServiceStub.java | 71 - .../stub/AlertPolicyServiceStubSettings.java | 455 ----- .../monitoring/v3/stub/GroupServiceStub.java | 82 - .../v3/stub/GroupServiceStubSettings.java | 531 ------ ...GrpcAlertPolicyServiceCallableFactory.java | 115 -- .../v3/stub/GrpcAlertPolicyServiceStub.java | 308 ---- .../stub/GrpcGroupServiceCallableFactory.java | 115 -- .../v3/stub/GrpcGroupServiceStub.java | 327 ---- .../GrpcMetricServiceCallableFactory.java | 115 -- .../v3/stub/GrpcMetricServiceStub.java | 464 ----- ...ficationChannelServiceCallableFactory.java | 115 -- .../GrpcNotificationChannelServiceStub.java | 586 ------ ...GrpcUptimeCheckServiceCallableFactory.java | 115 -- .../v3/stub/GrpcUptimeCheckServiceStub.java | 367 ---- .../monitoring/v3/stub/MetricServiceStub.java | 110 -- .../v3/stub/MetricServiceStubSettings.java | 724 -------- .../stub/NotificationChannelServiceStub.java | 125 -- ...otificationChannelServiceStubSettings.java | 761 -------- .../v3/stub/UptimeCheckServiceStub.java | 88 - .../stub/UptimeCheckServiceStubSettings.java | 580 ------ .../v3/AlertPolicyServiceClientTest.java | 317 ---- .../monitoring/v3/GroupServiceClientTest.java | 391 ---- .../v3/MetricServiceClientTest.java | 507 ------ .../monitoring/v3/MetricServiceSmokeTest.java | 66 - .../monitoring/v3/MockAlertPolicyService.java | 57 - .../v3/MockAlertPolicyServiceImpl.java | 142 -- .../cloud/monitoring/v3/MockGroupService.java | 57 - .../monitoring/v3/MockGroupServiceImpl.java | 154 -- .../monitoring/v3/MockMetricService.java | 57 - .../monitoring/v3/MockMetricServiceImpl.java | 195 -- .../v3/MockNotificationChannelService.java | 57 - .../MockNotificationChannelServiceImpl.java | 232 --- .../monitoring/v3/MockUptimeCheckService.java | 57 - .../v3/MockUptimeCheckServiceImpl.java | 160 -- .../NotificationChannelServiceClientTest.java | 604 ------ .../v3/UptimeCheckServiceClientTest.java | 336 ---- 47 files changed, 16875 deletions(-) delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/GroupServiceSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/MetricServiceClient.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/MetricServiceSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClient.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/package-info.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStubSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStubSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceCallableFactory.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceCallableFactory.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceCallableFactory.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceCallableFactory.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceCallableFactory.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStubSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStubSettings.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStub.java delete mode 100644 src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStubSettings.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClientTest.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/GroupServiceClientTest.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MetricServiceClientTest.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MetricServiceSmokeTest.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyService.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyServiceImpl.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockGroupService.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockGroupServiceImpl.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockMetricService.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockMetricServiceImpl.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelService.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelServiceImpl.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckService.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckServiceImpl.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClientTest.java delete mode 100644 src/test/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClientTest.java diff --git a/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java b/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java deleted file mode 100644 index 6a48c01f..00000000 --- a/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java +++ /dev/null @@ -1,823 +0,0 @@ -/* - * Copyright 2019 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.monitoring.v3; - -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.monitoring.v3.stub.AlertPolicyServiceStub; -import com.google.cloud.monitoring.v3.stub.AlertPolicyServiceStubSettings; -import com.google.common.util.concurrent.MoreExecutors; -import com.google.monitoring.v3.AlertPolicy; -import com.google.monitoring.v3.AlertPolicyName; -import com.google.monitoring.v3.CreateAlertPolicyRequest; -import com.google.monitoring.v3.DeleteAlertPolicyRequest; -import com.google.monitoring.v3.GetAlertPolicyRequest; -import com.google.monitoring.v3.ListAlertPoliciesRequest; -import com.google.monitoring.v3.ListAlertPoliciesResponse; -import com.google.monitoring.v3.ProjectName; -import com.google.monitoring.v3.UpdateAlertPolicyRequest; -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: The AlertPolicyService API is used to manage (list, create, delete, edit) - * alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions - * under which some aspect of your system is considered to be "unhealthy" and the ways to notify - * people or services about this state. In addition to using this API, alert policies can also be - * managed through [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), which can be - * reached by clicking the "Monitoring" tab in [Cloud Console](https://console.cloud.google.com/). - * - *
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 (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
- * }
- *
- *
- *
- * Note: close() needs to be called on the alertPolicyServiceClient 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 AlertPolicyServiceSettings to - * create(). For example: - * - *
To customize credentials: - * - *
- *
- * AlertPolicyServiceSettings alertPolicyServiceSettings =
- * AlertPolicyServiceSettings.newBuilder()
- * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- * .build();
- * AlertPolicyServiceClient alertPolicyServiceClient =
- * AlertPolicyServiceClient.create(alertPolicyServiceSettings);
- *
- *
- *
- * To customize the endpoint:
- *
- *
- *
- * AlertPolicyServiceSettings alertPolicyServiceSettings =
- * AlertPolicyServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * AlertPolicyServiceClient alertPolicyServiceClient =
- * AlertPolicyServiceClient.create(alertPolicyServiceSettings);
- *
- *
- */
-@Generated("by gapic-generator")
-public class AlertPolicyServiceClient implements BackgroundResource {
- private final AlertPolicyServiceSettings settings;
- private final AlertPolicyServiceStub stub;
-
- /** Constructs an instance of AlertPolicyServiceClient with default settings. */
- public static final AlertPolicyServiceClient create() throws IOException {
- return create(AlertPolicyServiceSettings.newBuilder().build());
- }
-
- /**
- * Constructs an instance of AlertPolicyServiceClient, 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 AlertPolicyServiceClient create(AlertPolicyServiceSettings settings)
- throws IOException {
- return new AlertPolicyServiceClient(settings);
- }
-
- /**
- * Constructs an instance of AlertPolicyServiceClient, using the given stub for making calls. This
- * is for advanced usage - prefer to use AlertPolicyServiceSettings}.
- */
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public static final AlertPolicyServiceClient create(AlertPolicyServiceStub stub) {
- return new AlertPolicyServiceClient(stub);
- }
-
- /**
- * Constructs an instance of AlertPolicyServiceClient, 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 AlertPolicyServiceClient(AlertPolicyServiceSettings settings) throws IOException {
- this.settings = settings;
- this.stub = ((AlertPolicyServiceStubSettings) settings.getStubSettings()).createStub();
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- protected AlertPolicyServiceClient(AlertPolicyServiceStub stub) {
- this.settings = null;
- this.stub = stub;
- }
-
- public final AlertPolicyServiceSettings getSettings() {
- return settings;
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public AlertPolicyServiceStub getStub() {
- return stub;
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing alerting policies for the project.
- *
- * Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (AlertPolicy element : alertPolicyServiceClient.listAlertPolicies(name).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The project whose alert policies are to be listed. The format is
- * projects/[PROJECT_ID] - *
Note that this field names the parent container in which the alerting policies to be - * listed are stored. To retrieve a single alerting policy by name, use the - * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, - * instead. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListAlertPoliciesPagedResponse listAlertPolicies(ProjectName name) { - ListAlertPoliciesRequest request = - ListAlertPoliciesRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .build(); - return listAlertPolicies(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Lists the existing alerting policies for the project. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (AlertPolicy element : alertPolicyServiceClient.listAlertPolicies(name.toString()).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The project whose alert policies are to be listed. The format is
- * projects/[PROJECT_ID] - *
Note that this field names the parent container in which the alerting policies to be - * listed are stored. To retrieve a single alerting policy by name, use the - * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, - * instead. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListAlertPoliciesPagedResponse listAlertPolicies(String name) { - ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder().setName(name).build(); - return listAlertPolicies(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Lists the existing alerting policies for the project. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * for (AlertPolicy element : alertPolicyServiceClient.listAlertPolicies(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 ListAlertPoliciesPagedResponse listAlertPolicies(ListAlertPoliciesRequest request) {
- return listAlertPoliciesPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing alerting policies for the project.
- *
- * Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<ListAlertPoliciesPagedResponse> future = alertPolicyServiceClient.listAlertPoliciesPagedCallable().futureCall(request);
- * // Do something
- * for (AlertPolicy element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallableSample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * while (true) {
- * ListAlertPoliciesResponse response = alertPolicyServiceClient.listAlertPoliciesCallable().call(request);
- * for (AlertPolicy element : response.getAlertPoliciesList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- */
- public final UnaryCallableSample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
- * }
- *
- *
- * @param name The alerting policy to retrieve. The format is
- * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AlertPolicy getAlertPolicy(AlertPolicyName name) { - - GetAlertPolicyRequest request = - GetAlertPolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return getAlertPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets a single alerting policy. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name.toString());
- * }
- *
- *
- * @param name The alerting policy to retrieve. The format is
- * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AlertPolicy getAlertPolicy(String name) { - - GetAlertPolicyRequest request = GetAlertPolicyRequest.newBuilder().setName(name).build(); - return getAlertPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets a single alerting policy. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * GetAlertPolicyRequest request = GetAlertPolicyRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(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 AlertPolicy getAlertPolicy(GetAlertPolicyRequest request) {
- return getAlertPolicyCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single alerting policy.
- *
- * Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * GetAlertPolicyRequest request = GetAlertPolicyRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<AlertPolicy> future = alertPolicyServiceClient.getAlertPolicyCallable().futureCall(request);
- * // Do something
- * AlertPolicy response = future.get();
- * }
- *
- */
- public final UnaryCallableSample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
- * AlertPolicy response = alertPolicyServiceClient.createAlertPolicy(name, alertPolicy);
- * }
- *
- *
- * @param name The project in which to create the alerting policy. The format is
- * `projects/[PROJECT_ID]`.
- * Note that this field names the parent container in which the alerting policy will be - * written, not the name of the created policy. The alerting policy that is returned will have - * a name that contains a normalized representation of this name as a prefix but adds a suffix - * of the form `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - * @param alertPolicy The requested alerting policy. You should omit the `name` field in this - * policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] - * value. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AlertPolicy createAlertPolicy(ProjectName name, AlertPolicy alertPolicy) { - - CreateAlertPolicyRequest request = - CreateAlertPolicyRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setAlertPolicy(alertPolicy) - .build(); - return createAlertPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a new alerting policy. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
- * AlertPolicy response = alertPolicyServiceClient.createAlertPolicy(name.toString(), alertPolicy);
- * }
- *
- *
- * @param name The project in which to create the alerting policy. The format is
- * `projects/[PROJECT_ID]`.
- * Note that this field names the parent container in which the alerting policy will be - * written, not the name of the created policy. The alerting policy that is returned will have - * a name that contains a normalized representation of this name as a prefix but adds a suffix - * of the form `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - * @param alertPolicy The requested alerting policy. You should omit the `name` field in this - * policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] - * value. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AlertPolicy createAlertPolicy(String name, AlertPolicy alertPolicy) { - - CreateAlertPolicyRequest request = - CreateAlertPolicyRequest.newBuilder().setName(name).setAlertPolicy(alertPolicy).build(); - return createAlertPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a new alerting policy. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
- * CreateAlertPolicyRequest request = CreateAlertPolicyRequest.newBuilder()
- * .setName(name.toString())
- * .setAlertPolicy(alertPolicy)
- * .build();
- * AlertPolicy response = alertPolicyServiceClient.createAlertPolicy(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 AlertPolicy createAlertPolicy(CreateAlertPolicyRequest request) {
- return createAlertPolicyCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new alerting policy.
- *
- * Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
- * CreateAlertPolicyRequest request = CreateAlertPolicyRequest.newBuilder()
- * .setName(name.toString())
- * .setAlertPolicy(alertPolicy)
- * .build();
- * ApiFuture<AlertPolicy> future = alertPolicyServiceClient.createAlertPolicyCallable().futureCall(request);
- * // Do something
- * AlertPolicy response = future.get();
- * }
- *
- */
- public final UnaryCallableSample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * alertPolicyServiceClient.deleteAlertPolicy(name);
- * }
- *
- *
- * @param name The alerting policy to delete. The format is:
- * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - *
For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteAlertPolicy(AlertPolicyName name) { - - DeleteAlertPolicyRequest request = - DeleteAlertPolicyRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .build(); - deleteAlertPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes an alerting policy. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * alertPolicyServiceClient.deleteAlertPolicy(name.toString());
- * }
- *
- *
- * @param name The alerting policy to delete. The format is:
- * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - *
For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteAlertPolicy(String name) { - - DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder().setName(name).build(); - deleteAlertPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes an alerting policy. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * alertPolicyServiceClient.deleteAlertPolicy(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 deleteAlertPolicy(DeleteAlertPolicyRequest request) {
- deleteAlertPolicyCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes an alerting policy.
- *
- * Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Void> future = alertPolicyServiceClient.deleteAlertPolicyCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
- */
- public final UnaryCallableSample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * FieldMask updateMask = FieldMask.newBuilder().build();
- * AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
- * AlertPolicy response = alertPolicyServiceClient.updateAlertPolicy(updateMask, alertPolicy);
- * }
- *
- *
- * @param updateMask Optional. A list of alerting policy field names. If this field is not empty,
- * each listed field in the existing alerting policy is set to the value of the corresponding
- * field in the supplied policy (`alert_policy`), or to the field's default value if the field
- * is not in the supplied alerting policy. Fields not listed retain their previous value.
- * Examples of valid field masks include `display_name`, `documentation`, - * `documentation.content`, `documentation.mime_type`, `user_labels`, `user_label.nameofkey`, - * `enabled`, `conditions`, `combiner`, etc. - *
If this field is empty, then the supplied alerting policy replaces the existing policy. - * It is the same as deleting the existing policy and adding the supplied policy, except for - * the following: - *
+ The new policy will have the same `[ALERT_POLICY_ID]` as the former policy. This gives - * you continuity with the former policy in your notifications and incidents. + Conditions in - * the new policy will keep their former `[CONDITION_ID]` if the supplied condition includes - * the `name` field with that `[CONDITION_ID]`. If the supplied condition omits the `name` - * field, then a new `[CONDITION_ID]` is created. - * @param alertPolicy Required. The updated alerting policy or the updated values for the fields - * listed in `update_mask`. If `update_mask` is not empty, any fields in this policy that are - * not in `update_mask` are ignored. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AlertPolicy updateAlertPolicy(FieldMask updateMask, AlertPolicy alertPolicy) { - - UpdateAlertPolicyRequest request = - UpdateAlertPolicyRequest.newBuilder() - .setUpdateMask(updateMask) - .setAlertPolicy(alertPolicy) - .build(); - return updateAlertPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Updates an alerting policy. You can either replace the entire policy with a new one or replace - * only certain fields in the current alerting policy by specifying the fields to be updated via - * `updateMask`. Returns the updated alerting policy. - * - *
Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
- * UpdateAlertPolicyRequest request = UpdateAlertPolicyRequest.newBuilder()
- * .setAlertPolicy(alertPolicy)
- * .build();
- * AlertPolicy response = alertPolicyServiceClient.updateAlertPolicy(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 AlertPolicy updateAlertPolicy(UpdateAlertPolicyRequest request) {
- return updateAlertPolicyCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates an alerting policy. You can either replace the entire policy with a new one or replace
- * only certain fields in the current alerting policy by specifying the fields to be updated via
- * `updateMask`. Returns the updated alerting policy.
- *
- * Sample code: - * - *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
- * UpdateAlertPolicyRequest request = UpdateAlertPolicyRequest.newBuilder()
- * .setAlertPolicy(alertPolicy)
- * .build();
- * ApiFuture<AlertPolicy> future = alertPolicyServiceClient.updateAlertPolicyCallable().futureCall(request);
- * // Do something
- * AlertPolicy 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 getAlertPolicy to 30 seconds: - * - *
- *
- * AlertPolicyServiceSettings.Builder alertPolicyServiceSettingsBuilder =
- * AlertPolicyServiceSettings.newBuilder();
- * alertPolicyServiceSettingsBuilder.getAlertPolicySettings().getRetrySettings().toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30));
- * AlertPolicyServiceSettings alertPolicyServiceSettings = alertPolicyServiceSettingsBuilder.build();
- *
- *
- */
-@Generated("by gapic-generator")
-public class AlertPolicyServiceSettings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
- */
- public Builder applyToAllUnaryMethods(
- ApiFunction A group is a named filter that is used to identify a collection of monitored resources. Groups
- * are typically used to mirror the physical and/or logical topology of the environment. Because
- * group membership is computed dynamically, monitored resources that are started in the future are
- * automatically placed in matching groups. By using a group to name monitored resources in, for
- * example, an alert policy, the target of that alert policy is updated automatically as monitored
- * resources are added and removed from the infrastructure.
- *
- * 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 groupServiceClient 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 GroupServiceSettings to
- * create(). For example:
- *
- * To customize credentials:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * 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 getGroup 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 metricServiceClient 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 MetricServiceSettings to
- * create(). For example:
- *
- * To customize credentials:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
- * metric.labels.instance_name = "my-instance-name"
- * @param interval The time interval for which results should be returned. Only time series that
- * contain data points in the specified interval are included in the response.
- * @param view Specifies which information is returned about the time series.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTimeSeriesPagedResponse listTimeSeries(
- ProjectName name,
- String filter,
- TimeInterval interval,
- ListTimeSeriesRequest.TimeSeriesView view) {
- ListTimeSeriesRequest request =
- ListTimeSeriesRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .setFilter(filter)
- .setInterval(interval)
- .setView(view)
- .build();
- return listTimeSeries(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists time series that match a filter. This method does not require a Stackdriver account.
- *
- * Sample code:
- *
- * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
- * metric.labels.instance_name = "my-instance-name"
- * @param interval The time interval for which results should be returned. Only time series that
- * contain data points in the specified interval are included in the response.
- * @param view Specifies which information is returned about the time series.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTimeSeriesPagedResponse listTimeSeries(
- String name,
- String filter,
- TimeInterval interval,
- ListTimeSeriesRequest.TimeSeriesView view) {
- ListTimeSeriesRequest request =
- ListTimeSeriesRequest.newBuilder()
- .setName(name)
- .setFilter(filter)
- .setInterval(interval)
- .setView(view)
- .build();
- return listTimeSeries(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists time series that match a filter. This method does not require a Stackdriver account.
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * The maximum number of `TimeSeries` objects per `Create` request is 200.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void createTimeSeries(ProjectName name, List Sample code:
- *
- * The maximum number of `TimeSeries` objects per `Create` request is 200.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void createTimeSeries(String name, List 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 getMonitoredResourceDescriptor 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 notificationChannelServiceClient 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
- * NotificationChannelServiceSettings to create(). For example:
- *
- * To customize credentials:
- *
- * Sample code:
- *
- * projects/[PROJECT_ID]
- * Note that this names the parent container in which to look for the descriptors; to
- * retrieve a single descriptor by name, use the
- * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]
- * operation, instead.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors(
- ProjectName name) {
- ListNotificationChannelDescriptorsRequest request =
- ListNotificationChannelDescriptorsRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return listNotificationChannelDescriptors(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the descriptors for supported channel types. The use of descriptors makes it possible for
- * new channel types to be dynamically added.
- *
- * Sample code:
- *
- * projects/[PROJECT_ID]
- * Note that this names the parent container in which to look for the descriptors; to
- * retrieve a single descriptor by name, use the
- * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]
- * operation, instead.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors(
- String name) {
- ListNotificationChannelDescriptorsRequest request =
- ListNotificationChannelDescriptorsRequest.newBuilder().setName(name).build();
- return listNotificationChannelDescriptors(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the descriptors for supported channel types. The use of descriptors makes it possible for
- * new channel types to be dynamically added.
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * projects/[PROJECT_ID]
- * Note that this names the container into which the channel will be written. This does not
- * name the newly created channel. The resulting channel's name will have a normalized version
- * of this field as a prefix, but will add `/notificationChannels/[CHANNEL_ID]` to identify
- * the channel.
- * @param notificationChannel The definition of the `NotificationChannel` to create.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannel createNotificationChannel(
- ProjectName name, NotificationChannel notificationChannel) {
-
- CreateNotificationChannelRequest request =
- CreateNotificationChannelRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .setNotificationChannel(notificationChannel)
- .build();
- return createNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new notification channel, representing a single notification endpoint such as an
- * email address, SMS number, or PagerDuty service.
- *
- * Sample code:
- *
- * projects/[PROJECT_ID]
- * Note that this names the container into which the channel will be written. This does not
- * name the newly created channel. The resulting channel's name will have a normalized version
- * of this field as a prefix, but will add `/notificationChannels/[CHANNEL_ID]` to identify
- * the channel.
- * @param notificationChannel The definition of the `NotificationChannel` to create.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannel createNotificationChannel(
- String name, NotificationChannel notificationChannel) {
-
- CreateNotificationChannelRequest request =
- CreateNotificationChannelRequest.newBuilder()
- .setName(name)
- .setNotificationChannel(notificationChannel)
- .build();
- return createNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new notification channel, representing a single notification endpoint such as an
- * email address, SMS number, or PagerDuty service.
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * There is no guarantee that the verification codes returned by this method will be of a
- * similar structure or form as the ones that are delivered to the channel via
- * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both
- * the codes delivered via SendNotificationChannelVerificationCode() and returned from
- * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes
- * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter
- * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return
- * a much longer, websafe base 64 encoded string that has a longer expiration time.
- *
- * Sample code:
- *
- * There is no guarantee that the verification codes returned by this method will be of a
- * similar structure or form as the ones that are delivered to the channel via
- * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both
- * the codes delivered via SendNotificationChannelVerificationCode() and returned from
- * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes
- * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter
- * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return
- * a much longer, websafe base 64 encoded string that has a longer expiration time.
- *
- * Sample code:
- *
- * There is no guarantee that the verification codes returned by this method will be of a
- * similar structure or form as the ones that are delivered to the channel via
- * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both
- * the codes delivered via SendNotificationChannelVerificationCode() and returned from
- * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes
- * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter
- * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return
- * a much longer, websafe base 64 encoded string that has a longer expiration time.
- *
- * Sample code:
- *
- * There is no guarantee that the verification codes returned by this method will be of a
- * similar structure or form as the ones that are delivered to the channel via
- * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both
- * the codes delivered via SendNotificationChannelVerificationCode() and returned from
- * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes
- * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter
- * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return
- * a much longer, websafe base 64 encoded string that has a longer expiration time.
- *
- * Sample code:
- *
- * Sample code:
- *
- * 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 getNotificationChannelDescriptor 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 uptimeCheckServiceClient 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 UptimeCheckServiceSettings to
- * create(). For example:
- *
- * To customize credentials:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * The following fields can be updated: `display_name`, `http_check`, `tcp_check`,
- * `timeout`, `content_matchers`, and `selected_regions`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final UptimeCheckConfig updateUptimeCheckConfig(UptimeCheckConfig uptimeCheckConfig) {
-
- UpdateUptimeCheckConfigRequest request =
- UpdateUptimeCheckConfigRequest.newBuilder().setUptimeCheckConfig(uptimeCheckConfig).build();
- return updateUptimeCheckConfig(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates an Uptime check configuration. You can either replace the entire configuration with a
- * new one or replace only certain fields in the current configuration by specifying the fields to
- * be updated via `updateMask`. Returns the updated configuration.
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * 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 getUptimeCheckConfig 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.
- *
- * ======================== AlertPolicyServiceClient ========================
- *
- * Service Description: The AlertPolicyService API is used to manage (list, create, delete, edit)
- * alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions
- * under which some aspect of your system is considered to be "unhealthy" and the ways to notify
- * people or services about this state. In addition to using this API, alert policies can also be
- * managed through [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), which can be
- * reached by clicking the "Monitoring" tab in [Cloud Console](https://console.cloud.google.com/).
- *
- * Sample for AlertPolicyServiceClient:
- *
- * Service Description: The Group API lets you inspect and manage your
- * [groups](#google.monitoring.v3.Group).
- *
- * A group is a named filter that is used to identify a collection of monitored resources. Groups
- * are typically used to mirror the physical and/or logical topology of the environment. Because
- * group membership is computed dynamically, monitored resources that are started in the future are
- * automatically placed in matching groups. By using a group to name monitored resources in, for
- * example, an alert policy, the target of that alert policy is updated automatically as monitored
- * resources are added and removed from the infrastructure.
- *
- * Sample for GroupServiceClient:
- *
- * Service Description: Manages metric descriptors, monitored resource descriptors, and time
- * series data.
- *
- * Sample for MetricServiceClient:
- *
- * Service Description: The Notification Channel API provides access to configuration that
- * controls how messages related to incidents are sent.
- *
- * Sample for NotificationChannelServiceClient:
- *
- * Service Description: The UptimeCheckService API is used to manage (list, create, delete, edit)
- * Uptime check configurations in the Stackdriver Monitoring product. An Uptime check is a piece of
- * configuration that determines which resources and services to monitor for availability. These
- * configurations can also be configured interactively by navigating to the [Cloud Console]
- * (http://console.cloud.google.com), selecting the appropriate project, clicking on "Monitoring" on
- * the left-hand side to navigate to Stackdriver, and then clicking on "Uptime".
- *
- * Sample for UptimeCheckServiceClient:
- *
- * This class is for advanced usage and reflects the underlying API directly.
- */
-@Generated("by gapic-generator")
-@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
-public abstract class AlertPolicyServiceStub implements BackgroundResource {
-
- public UnaryCallable 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 getAlertPolicy to 30 seconds:
- *
- *
- *
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * Group response = groupServiceClient.getGroup(name);
- * }
- *
- *
- *
- *
- *
- *
- *
- * To customize the endpoint:
- *
- *
- * GroupServiceSettings groupServiceSettings =
- * GroupServiceSettings.newBuilder()
- * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- * .build();
- * GroupServiceClient groupServiceClient =
- * GroupServiceClient.create(groupServiceSettings);
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class GroupServiceClient implements BackgroundResource {
- private final GroupServiceSettings settings;
- private final GroupServiceStub stub;
-
- /** Constructs an instance of GroupServiceClient with default settings. */
- public static final GroupServiceClient create() throws IOException {
- return create(GroupServiceSettings.newBuilder().build());
- }
-
- /**
- * Constructs an instance of GroupServiceClient, 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 GroupServiceClient create(GroupServiceSettings settings) throws IOException {
- return new GroupServiceClient(settings);
- }
-
- /**
- * Constructs an instance of GroupServiceClient, using the given stub for making calls. This is
- * for advanced usage - prefer to use GroupServiceSettings}.
- */
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public static final GroupServiceClient create(GroupServiceStub stub) {
- return new GroupServiceClient(stub);
- }
-
- /**
- * Constructs an instance of GroupServiceClient, 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 GroupServiceClient(GroupServiceSettings settings) throws IOException {
- this.settings = settings;
- this.stub = ((GroupServiceStubSettings) settings.getStubSettings()).createStub();
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- protected GroupServiceClient(GroupServiceStub stub) {
- this.settings = null;
- this.stub = stub;
- }
-
- public final GroupServiceSettings getSettings() {
- return settings;
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public GroupServiceStub getStub() {
- return stub;
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing groups.
- *
- *
- * GroupServiceSettings groupServiceSettings =
- * GroupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * GroupServiceClient groupServiceClient =
- * GroupServiceClient.create(groupServiceSettings);
- *
- *
- *
- * @param name The project whose groups are to be listed. The format is
- * `"projects/{project_id_or_number}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListGroupsPagedResponse listGroups(ProjectName name) {
- ListGroupsRequest request =
- ListGroupsRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- return listGroups(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing groups.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (Group element : groupServiceClient.listGroups(name).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The project whose groups are to be listed. The format is
- * `"projects/{project_id_or_number}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListGroupsPagedResponse listGroups(String name) {
- ListGroupsRequest request = ListGroupsRequest.newBuilder().setName(name).build();
- return listGroups(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing groups.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (Group element : groupServiceClient.listGroups(name.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 ListGroupsPagedResponse listGroups(ListGroupsRequest request) {
- return listGroupsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing groups.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListGroupsRequest request = ListGroupsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * for (Group element : groupServiceClient.listGroups(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListGroupsRequest request = ListGroupsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<ListGroupsPagedResponse> future = groupServiceClient.listGroupsPagedCallable().futureCall(request);
- * // Do something
- * for (Group element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListGroupsRequest request = ListGroupsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * while (true) {
- * ListGroupsResponse response = groupServiceClient.listGroupsCallable().call(request);
- * for (Group element : response.getGroupList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- * @param name The group to retrieve. The format is
- * `"projects/{project_id_or_number}/groups/{group_id}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Group getGroup(GroupName name) {
-
- GetGroupRequest request =
- GetGroupRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- return getGroup(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * Group response = groupServiceClient.getGroup(name);
- * }
- *
- *
- * @param name The group to retrieve. The format is
- * `"projects/{project_id_or_number}/groups/{group_id}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Group getGroup(String name) {
-
- GetGroupRequest request = GetGroupRequest.newBuilder().setName(name).build();
- return getGroup(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * Group response = groupServiceClient.getGroup(name.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 Group getGroup(GetGroupRequest request) {
- return getGroupCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * GetGroupRequest request = GetGroupRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * Group response = groupServiceClient.getGroup(request);
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * GetGroupRequest request = GetGroupRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Group> future = groupServiceClient.getGroupCallable().futureCall(request);
- * // Do something
- * Group response = future.get();
- * }
- *
- *
- * @param name The project in which to create the group. The format is
- * `"projects/{project_id_or_number}"`.
- * @param group A group definition. It is an error to define the `name` field because the system
- * assigns the name.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Group createGroup(ProjectName name, Group group) {
-
- CreateGroupRequest request =
- CreateGroupRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .setGroup(group)
- .build();
- return createGroup(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * Group group = Group.newBuilder().build();
- * Group response = groupServiceClient.createGroup(name, group);
- * }
- *
- *
- * @param name The project in which to create the group. The format is
- * `"projects/{project_id_or_number}"`.
- * @param group A group definition. It is an error to define the `name` field because the system
- * assigns the name.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Group createGroup(String name, Group group) {
-
- CreateGroupRequest request =
- CreateGroupRequest.newBuilder().setName(name).setGroup(group).build();
- return createGroup(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * Group group = Group.newBuilder().build();
- * Group response = groupServiceClient.createGroup(name.toString(), group);
- * }
- *
- *
- * @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 Group createGroup(CreateGroupRequest request) {
- return createGroupCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * Group group = Group.newBuilder().build();
- * CreateGroupRequest request = CreateGroupRequest.newBuilder()
- * .setName(name.toString())
- * .setGroup(group)
- * .build();
- * Group response = groupServiceClient.createGroup(request);
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * Group group = Group.newBuilder().build();
- * CreateGroupRequest request = CreateGroupRequest.newBuilder()
- * .setName(name.toString())
- * .setGroup(group)
- * .build();
- * ApiFuture<Group> future = groupServiceClient.createGroupCallable().futureCall(request);
- * // Do something
- * Group response = future.get();
- * }
- *
- *
- * @param group The new definition of the group. All fields of the existing group, excepting
- * `name`, are replaced with the corresponding fields of this group.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Group updateGroup(Group group) {
-
- UpdateGroupRequest request = UpdateGroupRequest.newBuilder().setGroup(group).build();
- return updateGroup(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates an existing group. You can change any group attributes except `name`.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * Group group = Group.newBuilder().build();
- * Group response = groupServiceClient.updateGroup(group);
- * }
- *
- *
- * @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 Group updateGroup(UpdateGroupRequest request) {
- return updateGroupCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates an existing group. You can change any group attributes except `name`.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * Group group = Group.newBuilder().build();
- * UpdateGroupRequest request = UpdateGroupRequest.newBuilder()
- * .setGroup(group)
- * .build();
- * Group response = groupServiceClient.updateGroup(request);
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * Group group = Group.newBuilder().build();
- * UpdateGroupRequest request = UpdateGroupRequest.newBuilder()
- * .setGroup(group)
- * .build();
- * ApiFuture<Group> future = groupServiceClient.updateGroupCallable().futureCall(request);
- * // Do something
- * Group response = future.get();
- * }
- *
- *
- * @param name The group to delete. The format is
- * `"projects/{project_id_or_number}/groups/{group_id}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteGroup(GroupName name) {
-
- DeleteGroupRequest request =
- DeleteGroupRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- deleteGroup(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes an existing group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * groupServiceClient.deleteGroup(name);
- * }
- *
- *
- * @param name The group to delete. The format is
- * `"projects/{project_id_or_number}/groups/{group_id}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteGroup(String name) {
-
- DeleteGroupRequest request = DeleteGroupRequest.newBuilder().setName(name).build();
- deleteGroup(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes an existing group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * groupServiceClient.deleteGroup(name.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 deleteGroup(DeleteGroupRequest request) {
- deleteGroupCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes an existing group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * DeleteGroupRequest request = DeleteGroupRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * groupServiceClient.deleteGroup(request);
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * DeleteGroupRequest request = DeleteGroupRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Void> future = groupServiceClient.deleteGroupCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
- *
- * @param name The group whose members are listed. The format is
- * `"projects/{project_id_or_number}/groups/{group_id}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListGroupMembersPagedResponse listGroupMembers(GroupName name) {
- ListGroupMembersRequest request =
- ListGroupMembersRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- return listGroupMembers(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the monitored resources that are members of a group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * for (MonitoredResource element : groupServiceClient.listGroupMembers(name).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The group whose members are listed. The format is
- * `"projects/{project_id_or_number}/groups/{group_id}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListGroupMembersPagedResponse listGroupMembers(String name) {
- ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder().setName(name).build();
- return listGroupMembers(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the monitored resources that are members of a group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * for (MonitoredResource element : groupServiceClient.listGroupMembers(name.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 ListGroupMembersPagedResponse listGroupMembers(ListGroupMembersRequest request) {
- return listGroupMembersPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the monitored resources that are members of a group.
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * for (MonitoredResource element : groupServiceClient.listGroupMembers(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<ListGroupMembersPagedResponse> future = groupServiceClient.listGroupMembersPagedCallable().futureCall(request);
- * // Do something
- * for (MonitoredResource element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * while (true) {
- * ListGroupMembersResponse response = groupServiceClient.listGroupMembersCallable().call(request);
- * for (MonitoredResource element : response.getMembersList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class GroupServiceSettings extends ClientSettings
- * GroupServiceSettings.Builder groupServiceSettingsBuilder =
- * GroupServiceSettings.newBuilder();
- * groupServiceSettingsBuilder.getGroupSettings().getRetrySettings().toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30));
- * GroupServiceSettings groupServiceSettings = groupServiceSettingsBuilder.build();
- *
- *
- *
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
- * MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name);
- * }
- *
- *
- *
- *
- *
- *
- *
- * To customize the endpoint:
- *
- *
- * MetricServiceSettings metricServiceSettings =
- * MetricServiceSettings.newBuilder()
- * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- * .build();
- * MetricServiceClient metricServiceClient =
- * MetricServiceClient.create(metricServiceSettings);
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class MetricServiceClient implements BackgroundResource {
- private final MetricServiceSettings settings;
- private final MetricServiceStub stub;
-
- /** Constructs an instance of MetricServiceClient with default settings. */
- public static final MetricServiceClient create() throws IOException {
- return create(MetricServiceSettings.newBuilder().build());
- }
-
- /**
- * Constructs an instance of MetricServiceClient, 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 MetricServiceClient create(MetricServiceSettings settings)
- throws IOException {
- return new MetricServiceClient(settings);
- }
-
- /**
- * Constructs an instance of MetricServiceClient, using the given stub for making calls. This is
- * for advanced usage - prefer to use MetricServiceSettings}.
- */
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public static final MetricServiceClient create(MetricServiceStub stub) {
- return new MetricServiceClient(stub);
- }
-
- /**
- * Constructs an instance of MetricServiceClient, 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 MetricServiceClient(MetricServiceSettings settings) throws IOException {
- this.settings = settings;
- this.stub = ((MetricServiceStubSettings) settings.getStubSettings()).createStub();
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- protected MetricServiceClient(MetricServiceStub stub) {
- this.settings = null;
- this.stub = stub;
- }
-
- public final MetricServiceSettings getSettings() {
- return settings;
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public MetricServiceStub getStub() {
- return stub;
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists monitored resource descriptors that match a filter. This method does not require a
- * Stackdriver account.
- *
- *
- * MetricServiceSettings metricServiceSettings =
- * MetricServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * MetricServiceClient metricServiceClient =
- * MetricServiceClient.create(metricServiceSettings);
- *
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors(
- ProjectName name) {
- ListMonitoredResourceDescriptorsRequest request =
- ListMonitoredResourceDescriptorsRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return listMonitoredResourceDescriptors(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists monitored resource descriptors that match a filter. This method does not require a
- * Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (MonitoredResourceDescriptor element : metricServiceClient.listMonitoredResourceDescriptors(name).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors(
- String name) {
- ListMonitoredResourceDescriptorsRequest request =
- ListMonitoredResourceDescriptorsRequest.newBuilder().setName(name).build();
- return listMonitoredResourceDescriptors(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists monitored resource descriptors that match a filter. This method does not require a
- * Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (MonitoredResourceDescriptor element : metricServiceClient.listMonitoredResourceDescriptors(name.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 ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors(
- ListMonitoredResourceDescriptorsRequest request) {
- return listMonitoredResourceDescriptorsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists monitored resource descriptors that match a filter. This method does not require a
- * Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * for (MonitoredResourceDescriptor element : metricServiceClient.listMonitoredResourceDescriptors(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable<
- ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse>
- listMonitoredResourceDescriptorsPagedCallable() {
- return stub.listMonitoredResourceDescriptorsPagedCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists monitored resource descriptors that match a filter. This method does not require a
- * Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<ListMonitoredResourceDescriptorsPagedResponse> future = metricServiceClient.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
- /**
- * Gets a single monitored resource descriptor. This method does not require a Stackdriver
- * account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * while (true) {
- * ListMonitoredResourceDescriptorsResponse response = metricServiceClient.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 name The monitored resource descriptor to get. The format is
- * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The
- * `{resource_type}` is a predefined type, such as `cloudsql_database`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final MonitoredResourceDescriptor getMonitoredResourceDescriptor(
- MonitoredResourceDescriptorName name) {
-
- GetMonitoredResourceDescriptorRequest request =
- GetMonitoredResourceDescriptorRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return getMonitoredResourceDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single monitored resource descriptor. This method does not require a Stackdriver
- * account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
- * MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name);
- * }
- *
- *
- * @param name The monitored resource descriptor to get. The format is
- * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The
- * `{resource_type}` is a predefined type, such as `cloudsql_database`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final MonitoredResourceDescriptor getMonitoredResourceDescriptor(String name) {
-
- GetMonitoredResourceDescriptorRequest request =
- GetMonitoredResourceDescriptorRequest.newBuilder().setName(name).build();
- return getMonitoredResourceDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single monitored resource descriptor. This method does not require a Stackdriver
- * account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
- * MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name.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 MonitoredResourceDescriptor getMonitoredResourceDescriptor(
- GetMonitoredResourceDescriptorRequest request) {
- return getMonitoredResourceDescriptorCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single monitored resource descriptor. This method does not require a Stackdriver
- * account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
- * GetMonitoredResourceDescriptorRequest request = GetMonitoredResourceDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(request);
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
- * GetMonitoredResourceDescriptorRequest request = GetMonitoredResourceDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<MonitoredResourceDescriptor> future = metricServiceClient.getMonitoredResourceDescriptorCallable().futureCall(request);
- * // Do something
- * MonitoredResourceDescriptor response = future.get();
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListMetricDescriptorsPagedResponse listMetricDescriptors(ProjectName name) {
- ListMetricDescriptorsRequest request =
- ListMetricDescriptorsRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return listMetricDescriptors(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists metric descriptors that match a filter. This method does not require a Stackdriver
- * account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (MetricDescriptor element : metricServiceClient.listMetricDescriptors(name).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListMetricDescriptorsPagedResponse listMetricDescriptors(String name) {
- ListMetricDescriptorsRequest request =
- ListMetricDescriptorsRequest.newBuilder().setName(name).build();
- return listMetricDescriptors(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists metric descriptors that match a filter. This method does not require a Stackdriver
- * account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (MetricDescriptor element : metricServiceClient.listMetricDescriptors(name.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 ListMetricDescriptorsPagedResponse listMetricDescriptors(
- ListMetricDescriptorsRequest request) {
- return listMetricDescriptorsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists metric descriptors that match a filter. This method does not require a Stackdriver
- * account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * for (MetricDescriptor element : metricServiceClient.listMetricDescriptors(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<ListMetricDescriptorsPagedResponse> future = metricServiceClient.listMetricDescriptorsPagedCallable().futureCall(request);
- * // Do something
- * for (MetricDescriptor element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * while (true) {
- * ListMetricDescriptorsResponse response = metricServiceClient.listMetricDescriptorsCallable().call(request);
- * for (MetricDescriptor element : response.getMetricDescriptorsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- * @param name The metric descriptor on which to execute the request. The format is
- * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example value of
- * `{metric_id}` is `"compute.googleapis.com/instance/disk/read_bytes_count"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final MetricDescriptor getMetricDescriptor(MetricDescriptorName name) {
-
- GetMetricDescriptorRequest request =
- GetMetricDescriptorRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return getMetricDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single metric descriptor. This method does not require a Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * MetricDescriptor response = metricServiceClient.getMetricDescriptor(name);
- * }
- *
- *
- * @param name The metric descriptor on which to execute the request. The format is
- * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example value of
- * `{metric_id}` is `"compute.googleapis.com/instance/disk/read_bytes_count"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final MetricDescriptor getMetricDescriptor(String name) {
-
- GetMetricDescriptorRequest request =
- GetMetricDescriptorRequest.newBuilder().setName(name).build();
- return getMetricDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single metric descriptor. This method does not require a Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * MetricDescriptor response = metricServiceClient.getMetricDescriptor(name.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 MetricDescriptor getMetricDescriptor(GetMetricDescriptorRequest request) {
- return getMetricDescriptorCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single metric descriptor. This method does not require a Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * GetMetricDescriptorRequest request = GetMetricDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * MetricDescriptor response = metricServiceClient.getMetricDescriptor(request);
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * GetMetricDescriptorRequest request = GetMetricDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<MetricDescriptor> future = metricServiceClient.getMetricDescriptorCallable().futureCall(request);
- * // Do something
- * MetricDescriptor response = future.get();
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @param metricDescriptor The new [custom metric](/monitoring/custom-metrics) descriptor.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final MetricDescriptor createMetricDescriptor(
- ProjectName name, MetricDescriptor metricDescriptor) {
-
- CreateMetricDescriptorRequest request =
- CreateMetricDescriptorRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .setMetricDescriptor(metricDescriptor)
- .build();
- return createMetricDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new metric descriptor. User-created metric descriptors define [custom
- * metrics](/monitoring/custom-metrics).
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
- * MetricDescriptor response = metricServiceClient.createMetricDescriptor(name, metricDescriptor);
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @param metricDescriptor The new [custom metric](/monitoring/custom-metrics) descriptor.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final MetricDescriptor createMetricDescriptor(
- String name, MetricDescriptor metricDescriptor) {
-
- CreateMetricDescriptorRequest request =
- CreateMetricDescriptorRequest.newBuilder()
- .setName(name)
- .setMetricDescriptor(metricDescriptor)
- .build();
- return createMetricDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new metric descriptor. User-created metric descriptors define [custom
- * metrics](/monitoring/custom-metrics).
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
- * MetricDescriptor response = metricServiceClient.createMetricDescriptor(name.toString(), metricDescriptor);
- * }
- *
- *
- * @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 MetricDescriptor createMetricDescriptor(CreateMetricDescriptorRequest request) {
- return createMetricDescriptorCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new metric descriptor. User-created metric descriptors define [custom
- * metrics](/monitoring/custom-metrics).
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
- * CreateMetricDescriptorRequest request = CreateMetricDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .setMetricDescriptor(metricDescriptor)
- * .build();
- * MetricDescriptor response = metricServiceClient.createMetricDescriptor(request);
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
- * CreateMetricDescriptorRequest request = CreateMetricDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .setMetricDescriptor(metricDescriptor)
- * .build();
- * ApiFuture<MetricDescriptor> future = metricServiceClient.createMetricDescriptorCallable().futureCall(request);
- * // Do something
- * MetricDescriptor response = future.get();
- * }
- *
- *
- * @param name The metric descriptor on which to execute the request. The format is
- * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of
- * `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteMetricDescriptor(MetricDescriptorName name) {
-
- DeleteMetricDescriptorRequest request =
- DeleteMetricDescriptorRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- deleteMetricDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can
- * be deleted.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * metricServiceClient.deleteMetricDescriptor(name);
- * }
- *
- *
- * @param name The metric descriptor on which to execute the request. The format is
- * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of
- * `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteMetricDescriptor(String name) {
-
- DeleteMetricDescriptorRequest request =
- DeleteMetricDescriptorRequest.newBuilder().setName(name).build();
- deleteMetricDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can
- * be deleted.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * metricServiceClient.deleteMetricDescriptor(name.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 deleteMetricDescriptor(DeleteMetricDescriptorRequest request) {
- deleteMetricDescriptorCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can
- * be deleted.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * DeleteMetricDescriptorRequest request = DeleteMetricDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * metricServiceClient.deleteMetricDescriptor(request);
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
- * DeleteMetricDescriptorRequest request = DeleteMetricDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Void> future = metricServiceClient.deleteMetricDescriptorCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * "projects/{project_id_or_number}".
- * @param filter A [monitoring filter](/monitoring/api/v3/filters) that specifies which time
- * series should be returned. The filter must specify a single metric type, and can
- * additionally specify metric labels and other information. For example:
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * String filter = "";
- * TimeInterval interval = TimeInterval.newBuilder().build();
- * ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
- * for (TimeSeries element : metricServiceClient.listTimeSeries(name, filter, interval, view).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * "projects/{project_id_or_number}".
- * @param filter A [monitoring filter](/monitoring/api/v3/filters) that specifies which time
- * series should be returned. The filter must specify a single metric type, and can
- * additionally specify metric labels and other information. For example:
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * String filter = "";
- * TimeInterval interval = TimeInterval.newBuilder().build();
- * ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
- * for (TimeSeries element : metricServiceClient.listTimeSeries(name.toString(), filter, interval, view).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 ListTimeSeriesPagedResponse listTimeSeries(ListTimeSeriesRequest request) {
- return listTimeSeriesPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists time series that match a filter. This method does not require a Stackdriver account.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * String filter = "";
- * TimeInterval interval = TimeInterval.newBuilder().build();
- * ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
- * ListTimeSeriesRequest request = ListTimeSeriesRequest.newBuilder()
- * .setName(name.toString())
- * .setFilter(filter)
- * .setInterval(interval)
- * .setView(view)
- * .build();
- * for (TimeSeries element : metricServiceClient.listTimeSeries(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * String filter = "";
- * TimeInterval interval = TimeInterval.newBuilder().build();
- * ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
- * ListTimeSeriesRequest request = ListTimeSeriesRequest.newBuilder()
- * .setName(name.toString())
- * .setFilter(filter)
- * .setInterval(interval)
- * .setView(view)
- * .build();
- * ApiFuture<ListTimeSeriesPagedResponse> future = metricServiceClient.listTimeSeriesPagedCallable().futureCall(request);
- * // Do something
- * for (TimeSeries element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * String filter = "";
- * TimeInterval interval = TimeInterval.newBuilder().build();
- * ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
- * ListTimeSeriesRequest request = ListTimeSeriesRequest.newBuilder()
- * .setName(name.toString())
- * .setFilter(filter)
- * .setInterval(interval)
- * .setView(view)
- * .build();
- * while (true) {
- * ListTimeSeriesResponse response = metricServiceClient.listTimeSeriesCallable().call(request);
- * for (TimeSeries element : response.getTimeSeriesList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @param timeSeries The new data to be added to a list of time series. Adds at most one data
- * point to each of several time series. The new data point must be more recent than any other
- * point in its time series. Each `TimeSeries` value must fully specify a unique time series
- * by supplying all label values for the metric and the monitored resource.
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * List<TimeSeries> timeSeries = new ArrayList<>();
- * metricServiceClient.createTimeSeries(name, timeSeries);
- * }
- *
- *
- * @param name The project on which to execute the request. The format is
- * `"projects/{project_id_or_number}"`.
- * @param timeSeries The new data to be added to a list of time series. Adds at most one data
- * point to each of several time series. The new data point must be more recent than any other
- * point in its time series. Each `TimeSeries` value must fully specify a unique time series
- * by supplying all label values for the metric and the monitored resource.
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * List<TimeSeries> timeSeries = new ArrayList<>();
- * metricServiceClient.createTimeSeries(name.toString(), timeSeries);
- * }
- *
- *
- * @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 createTimeSeries(CreateTimeSeriesRequest request) {
- createTimeSeriesCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates or adds data to one or more time series. The response is empty if all time series in
- * the request were written. If any time series could not be written, a corresponding failure
- * message is included in the error response.
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * List<TimeSeries> timeSeries = new ArrayList<>();
- * CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder()
- * .setName(name.toString())
- * .addAllTimeSeries(timeSeries)
- * .build();
- * metricServiceClient.createTimeSeries(request);
- * }
- *
- */
- public final UnaryCallable
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * List<TimeSeries> timeSeries = new ArrayList<>();
- * CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder()
- * .setName(name.toString())
- * .addAllTimeSeries(timeSeries)
- * .build();
- * ApiFuture<Void> future = metricServiceClient.createTimeSeriesCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
- *
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class MetricServiceSettings extends ClientSettings
- * MetricServiceSettings.Builder metricServiceSettingsBuilder =
- * MetricServiceSettings.newBuilder();
- * metricServiceSettingsBuilder.getMonitoredResourceDescriptorSettings().getRetrySettings().toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30));
- * MetricServiceSettings metricServiceSettings = metricServiceSettingsBuilder.build();
- *
- *
- *
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
- * NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
- * }
- *
- *
- *
- *
- *
- *
- *
- * To customize the endpoint:
- *
- *
- * NotificationChannelServiceSettings notificationChannelServiceSettings =
- * NotificationChannelServiceSettings.newBuilder()
- * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- * .build();
- * NotificationChannelServiceClient notificationChannelServiceClient =
- * NotificationChannelServiceClient.create(notificationChannelServiceSettings);
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class NotificationChannelServiceClient implements BackgroundResource {
- private final NotificationChannelServiceSettings settings;
- private final NotificationChannelServiceStub stub;
-
- /** Constructs an instance of NotificationChannelServiceClient with default settings. */
- public static final NotificationChannelServiceClient create() throws IOException {
- return create(NotificationChannelServiceSettings.newBuilder().build());
- }
-
- /**
- * Constructs an instance of NotificationChannelServiceClient, 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 NotificationChannelServiceClient create(
- NotificationChannelServiceSettings settings) throws IOException {
- return new NotificationChannelServiceClient(settings);
- }
-
- /**
- * Constructs an instance of NotificationChannelServiceClient, using the given stub for making
- * calls. This is for advanced usage - prefer to use NotificationChannelServiceSettings}.
- */
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public static final NotificationChannelServiceClient create(NotificationChannelServiceStub stub) {
- return new NotificationChannelServiceClient(stub);
- }
-
- /**
- * Constructs an instance of NotificationChannelServiceClient, 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 NotificationChannelServiceClient(NotificationChannelServiceSettings settings)
- throws IOException {
- this.settings = settings;
- this.stub = ((NotificationChannelServiceStubSettings) settings.getStubSettings()).createStub();
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- protected NotificationChannelServiceClient(NotificationChannelServiceStub stub) {
- this.settings = null;
- this.stub = stub;
- }
-
- public final NotificationChannelServiceSettings getSettings() {
- return settings;
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public NotificationChannelServiceStub getStub() {
- return stub;
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the descriptors for supported channel types. The use of descriptors makes it possible for
- * new channel types to be dynamically added.
- *
- *
- * NotificationChannelServiceSettings notificationChannelServiceSettings =
- * NotificationChannelServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * NotificationChannelServiceClient notificationChannelServiceClient =
- * NotificationChannelServiceClient.create(notificationChannelServiceSettings);
- *
- *
- *
- * @param name The REST resource name of the parent from which to retrieve the notification
- * channel descriptors. The expected syntax is:
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(name).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The REST resource name of the parent from which to retrieve the notification
- * channel descriptors. The expected syntax is:
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(name.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 ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors(
- ListNotificationChannelDescriptorsRequest request) {
- return listNotificationChannelDescriptorsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the descriptors for supported channel types. The use of descriptors makes it possible for
- * new channel types to be dynamically added.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable<
- ListNotificationChannelDescriptorsRequest,
- ListNotificationChannelDescriptorsPagedResponse>
- listNotificationChannelDescriptorsPagedCallable() {
- return stub.listNotificationChannelDescriptorsPagedCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the descriptors for supported channel types. The use of descriptors makes it possible for
- * new channel types to be dynamically added.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<ListNotificationChannelDescriptorsPagedResponse> future = notificationChannelServiceClient.listNotificationChannelDescriptorsPagedCallable().futureCall(request);
- * // Do something
- * for (NotificationChannelDescriptor element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable<
- ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse>
- listNotificationChannelDescriptorsCallable() {
- return stub.listNotificationChannelDescriptorsCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single channel descriptor. The descriptor indicates which fields are expected /
- * permitted for a notification channel of the given type.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * while (true) {
- * ListNotificationChannelDescriptorsResponse response = notificationChannelServiceClient.listNotificationChannelDescriptorsCallable().call(request);
- * for (NotificationChannelDescriptor element : response.getChannelDescriptorsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- * @param name The channel type for which to execute the request. The format is
- * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannelDescriptor getNotificationChannelDescriptor(
- NotificationChannelDescriptorName name) {
-
- GetNotificationChannelDescriptorRequest request =
- GetNotificationChannelDescriptorRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return getNotificationChannelDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single channel descriptor. The descriptor indicates which fields are expected /
- * permitted for a notification channel of the given type.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
- * NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
- * }
- *
- *
- * @param name The channel type for which to execute the request. The format is
- * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannelDescriptor getNotificationChannelDescriptor(String name) {
-
- GetNotificationChannelDescriptorRequest request =
- GetNotificationChannelDescriptorRequest.newBuilder().setName(name).build();
- return getNotificationChannelDescriptor(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single channel descriptor. The descriptor indicates which fields are expected /
- * permitted for a notification channel of the given type.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
- * NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name.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 NotificationChannelDescriptor getNotificationChannelDescriptor(
- GetNotificationChannelDescriptorRequest request) {
- return getNotificationChannelDescriptorCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single channel descriptor. The descriptor indicates which fields are expected /
- * permitted for a notification channel of the given type.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
- * GetNotificationChannelDescriptorRequest request = GetNotificationChannelDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(request);
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
- * GetNotificationChannelDescriptorRequest request = GetNotificationChannelDescriptorRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<NotificationChannelDescriptor> future = notificationChannelServiceClient.getNotificationChannelDescriptorCallable().futureCall(request);
- * // Do something
- * NotificationChannelDescriptor response = future.get();
- * }
- *
- *
- * @param name The project on which to execute the request. The format is `projects/[PROJECT_ID]`.
- * That is, this names the container in which to look for the notification channels; it does
- * not name a specific channel. To query a specific channel by REST resource name, use the
- * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
- * operation.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListNotificationChannelsPagedResponse listNotificationChannels(ProjectName name) {
- ListNotificationChannelsRequest request =
- ListNotificationChannelsRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return listNotificationChannels(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the notification channels that have been created for the project.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(name).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param name The project on which to execute the request. The format is `projects/[PROJECT_ID]`.
- * That is, this names the container in which to look for the notification channels; it does
- * not name a specific channel. To query a specific channel by REST resource name, use the
- * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
- * operation.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListNotificationChannelsPagedResponse listNotificationChannels(String name) {
- ListNotificationChannelsRequest request =
- ListNotificationChannelsRequest.newBuilder().setName(name).build();
- return listNotificationChannels(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the notification channels that have been created for the project.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(name.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 ListNotificationChannelsPagedResponse listNotificationChannels(
- ListNotificationChannelsRequest request) {
- return listNotificationChannelsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the notification channels that have been created for the project.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<ListNotificationChannelsPagedResponse> future = notificationChannelServiceClient.listNotificationChannelsPagedCallable().futureCall(request);
- * // Do something
- * for (NotificationChannel element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * while (true) {
- * ListNotificationChannelsResponse response = notificationChannelServiceClient.listNotificationChannelsCallable().call(request);
- * for (NotificationChannel element : response.getNotificationChannelsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- * @param name The channel for which to execute the request. The format is
- * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannel getNotificationChannel(NotificationChannelName name) {
-
- GetNotificationChannelRequest request =
- GetNotificationChannelRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return getNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single notification channel. The channel includes the relevant configuration details
- * with which the channel was created. However, the response may truncate or omit passwords, API
- * keys, or other private key matter and thus the response may not be 100% identical to the
- * information that was supplied in the call to the create method.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(name);
- * }
- *
- *
- * @param name The channel for which to execute the request. The format is
- * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannel getNotificationChannel(String name) {
-
- GetNotificationChannelRequest request =
- GetNotificationChannelRequest.newBuilder().setName(name).build();
- return getNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single notification channel. The channel includes the relevant configuration details
- * with which the channel was created. However, the response may truncate or omit passwords, API
- * keys, or other private key matter and thus the response may not be 100% identical to the
- * information that was supplied in the call to the create method.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(name.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 NotificationChannel getNotificationChannel(GetNotificationChannelRequest request) {
- return getNotificationChannelCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single notification channel. The channel includes the relevant configuration details
- * with which the channel was created. However, the response may truncate or omit passwords, API
- * keys, or other private key matter and thus the response may not be 100% identical to the
- * information that was supplied in the call to the create method.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * GetNotificationChannelRequest request = GetNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(request);
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * GetNotificationChannelRequest request = GetNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<NotificationChannel> future = notificationChannelServiceClient.getNotificationChannelCallable().futureCall(request);
- * // Do something
- * NotificationChannel response = future.get();
- * }
- *
- *
- * @param name The project on which to execute the request. The format is:
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
- * NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(name, notificationChannel);
- * }
- *
- *
- * @param name The project on which to execute the request. The format is:
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
- * NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(name.toString(), notificationChannel);
- * }
- *
- *
- * @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 NotificationChannel createNotificationChannel(
- CreateNotificationChannelRequest request) {
- return createNotificationChannelCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new notification channel, representing a single notification endpoint such as an
- * email address, SMS number, or PagerDuty service.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
- * CreateNotificationChannelRequest request = CreateNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .setNotificationChannel(notificationChannel)
- * .build();
- * NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(request);
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * ProjectName name = ProjectName.of("[PROJECT]");
- * NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
- * CreateNotificationChannelRequest request = CreateNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .setNotificationChannel(notificationChannel)
- * .build();
- * ApiFuture<NotificationChannel> future = notificationChannelServiceClient.createNotificationChannelCallable().futureCall(request);
- * // Do something
- * NotificationChannel response = future.get();
- * }
- *
- *
- * @param updateMask The fields to update.
- * @param notificationChannel A description of the changes to be applied to the specified
- * notification channel. The description must provide a definition for fields to be updated;
- * the names of these fields should also be included in the `update_mask`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannel updateNotificationChannel(
- FieldMask updateMask, NotificationChannel notificationChannel) {
-
- UpdateNotificationChannelRequest request =
- UpdateNotificationChannelRequest.newBuilder()
- .setUpdateMask(updateMask)
- .setNotificationChannel(notificationChannel)
- .build();
- return updateNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates a notification channel. Fields not specified in the field mask remain unchanged.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * FieldMask updateMask = FieldMask.newBuilder().build();
- * NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
- * NotificationChannel response = notificationChannelServiceClient.updateNotificationChannel(updateMask, notificationChannel);
- * }
- *
- *
- * @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 NotificationChannel updateNotificationChannel(
- UpdateNotificationChannelRequest request) {
- return updateNotificationChannelCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates a notification channel. Fields not specified in the field mask remain unchanged.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
- * UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder()
- * .setNotificationChannel(notificationChannel)
- * .build();
- * NotificationChannel response = notificationChannelServiceClient.updateNotificationChannel(request);
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
- * UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder()
- * .setNotificationChannel(notificationChannel)
- * .build();
- * ApiFuture<NotificationChannel> future = notificationChannelServiceClient.updateNotificationChannelCallable().futureCall(request);
- * // Do something
- * NotificationChannel response = future.get();
- * }
- *
- *
- * @param name The channel for which to execute the request. The format is
- * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.
- * @param force If true, the notification channel will be deleted regardless of its use in alert
- * policies (the policies will be updated to remove the channel). If false, channels that are
- * still referenced by an existing alerting policy will fail to be deleted in a delete
- * operation.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteNotificationChannel(NotificationChannelName name, boolean force) {
-
- DeleteNotificationChannelRequest request =
- DeleteNotificationChannelRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .setForce(force)
- .build();
- deleteNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes a notification channel.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * boolean force = false;
- * notificationChannelServiceClient.deleteNotificationChannel(name, force);
- * }
- *
- *
- * @param name The channel for which to execute the request. The format is
- * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.
- * @param force If true, the notification channel will be deleted regardless of its use in alert
- * policies (the policies will be updated to remove the channel). If false, channels that are
- * still referenced by an existing alerting policy will fail to be deleted in a delete
- * operation.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteNotificationChannel(String name, boolean force) {
-
- DeleteNotificationChannelRequest request =
- DeleteNotificationChannelRequest.newBuilder().setName(name).setForce(force).build();
- deleteNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes a notification channel.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * boolean force = false;
- * notificationChannelServiceClient.deleteNotificationChannel(name.toString(), force);
- * }
- *
- *
- * @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 deleteNotificationChannel(DeleteNotificationChannelRequest request) {
- deleteNotificationChannelCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes a notification channel.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * notificationChannelServiceClient.deleteNotificationChannel(request);
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Void> future = notificationChannelServiceClient.deleteNotificationChannelCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
- *
- * @param name The notification channel to which to send a verification code.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void sendNotificationChannelVerificationCode(NotificationChannelName name) {
-
- SendNotificationChannelVerificationCodeRequest request =
- SendNotificationChannelVerificationCodeRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- sendNotificationChannelVerificationCode(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Causes a verification code to be delivered to the channel. The code can then be supplied in
- * `VerifyNotificationChannel` to verify the channel.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * notificationChannelServiceClient.sendNotificationChannelVerificationCode(name);
- * }
- *
- *
- * @param name The notification channel to which to send a verification code.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void sendNotificationChannelVerificationCode(String name) {
-
- SendNotificationChannelVerificationCodeRequest request =
- SendNotificationChannelVerificationCodeRequest.newBuilder().setName(name).build();
- sendNotificationChannelVerificationCode(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Causes a verification code to be delivered to the channel. The code can then be supplied in
- * `VerifyNotificationChannel` to verify the channel.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * notificationChannelServiceClient.sendNotificationChannelVerificationCode(name.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 sendNotificationChannelVerificationCode(
- SendNotificationChannelVerificationCodeRequest request) {
- sendNotificationChannelVerificationCodeCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Causes a verification code to be delivered to the channel. The code can then be supplied in
- * `VerifyNotificationChannel` to verify the channel.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * notificationChannelServiceClient.sendNotificationChannelVerificationCode(request);
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Void> future = notificationChannelServiceClient.sendNotificationChannelVerificationCodeCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
- *
- * @param name The notification channel for which a verification code is to be generated and
- * retrieved. This must name a channel that is already verified; if the specified channel is
- * not verified, the request will fail.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final GetNotificationChannelVerificationCodeResponse
- getNotificationChannelVerificationCode(NotificationChannelName name) {
-
- GetNotificationChannelVerificationCodeRequest request =
- GetNotificationChannelVerificationCodeRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return getNotificationChannelVerificationCode(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Requests a verification code for an already verified channel that can then be used in a call to
- * VerifyNotificationChannel() on a different channel with an equivalent identity in the same or
- * in a different project. This makes it possible to copy a channel between projects without
- * requiring manual reverification of the channel. If the channel is not in the verified state,
- * this method will fail (in other words, this may only be used if the
- * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been
- * used to put the given channel into the verified state).
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(name);
- * }
- *
- *
- * @param name The notification channel for which a verification code is to be generated and
- * retrieved. This must name a channel that is already verified; if the specified channel is
- * not verified, the request will fail.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final GetNotificationChannelVerificationCodeResponse
- getNotificationChannelVerificationCode(String name) {
-
- GetNotificationChannelVerificationCodeRequest request =
- GetNotificationChannelVerificationCodeRequest.newBuilder().setName(name).build();
- return getNotificationChannelVerificationCode(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Requests a verification code for an already verified channel that can then be used in a call to
- * VerifyNotificationChannel() on a different channel with an equivalent identity in the same or
- * in a different project. This makes it possible to copy a channel between projects without
- * requiring manual reverification of the channel. If the channel is not in the verified state,
- * this method will fail (in other words, this may only be used if the
- * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been
- * used to put the given channel into the verified state).
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(name.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 GetNotificationChannelVerificationCodeResponse
- getNotificationChannelVerificationCode(
- GetNotificationChannelVerificationCodeRequest request) {
- return getNotificationChannelVerificationCodeCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Requests a verification code for an already verified channel that can then be used in a call to
- * VerifyNotificationChannel() on a different channel with an equivalent identity in the same or
- * in a different project. This makes it possible to copy a channel between projects without
- * requiring manual reverification of the channel. If the channel is not in the verified state,
- * this method will fail (in other words, this may only be used if the
- * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been
- * used to put the given channel into the verified state).
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * GetNotificationChannelVerificationCodeRequest request = GetNotificationChannelVerificationCodeRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(request);
- * }
- *
- */
- public final UnaryCallable<
- GetNotificationChannelVerificationCodeRequest,
- GetNotificationChannelVerificationCodeResponse>
- getNotificationChannelVerificationCodeCallable() {
- return stub.getNotificationChannelVerificationCodeCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
- * result of calling `SendNotificationChannelVerificationCode`.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * GetNotificationChannelVerificationCodeRequest request = GetNotificationChannelVerificationCodeRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<GetNotificationChannelVerificationCodeResponse> future = notificationChannelServiceClient.getNotificationChannelVerificationCodeCallable().futureCall(request);
- * // Do something
- * GetNotificationChannelVerificationCodeResponse response = future.get();
- * }
- *
- *
- * @param name The notification channel to verify.
- * @param code The verification code that was delivered to the channel as a result of invoking the
- * `SendNotificationChannelVerificationCode` API method or that was retrieved from a verified
- * channel via `GetNotificationChannelVerificationCode`. For example, one might have
- * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only guaranteed that the code
- * is valid UTF-8; one should not make any assumptions regarding the structure or format of
- * the code).
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannel verifyNotificationChannel(
- NotificationChannelName name, String code) {
-
- VerifyNotificationChannelRequest request =
- VerifyNotificationChannelRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .setCode(code)
- .build();
- return verifyNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
- * result of calling `SendNotificationChannelVerificationCode`.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * String code = "";
- * NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(name, code);
- * }
- *
- *
- * @param name The notification channel to verify.
- * @param code The verification code that was delivered to the channel as a result of invoking the
- * `SendNotificationChannelVerificationCode` API method or that was retrieved from a verified
- * channel via `GetNotificationChannelVerificationCode`. For example, one might have
- * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only guaranteed that the code
- * is valid UTF-8; one should not make any assumptions regarding the structure or format of
- * the code).
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final NotificationChannel verifyNotificationChannel(String name, String code) {
-
- VerifyNotificationChannelRequest request =
- VerifyNotificationChannelRequest.newBuilder().setName(name).setCode(code).build();
- return verifyNotificationChannel(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
- * result of calling `SendNotificationChannelVerificationCode`.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * String code = "";
- * NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(name.toString(), code);
- * }
- *
- *
- * @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 NotificationChannel verifyNotificationChannel(
- VerifyNotificationChannelRequest request) {
- return verifyNotificationChannelCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
- * result of calling `SendNotificationChannelVerificationCode`.
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * String code = "";
- * VerifyNotificationChannelRequest request = VerifyNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .setCode(code)
- * .build();
- * NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(request);
- * }
- *
- */
- public final UnaryCallable
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
- * String code = "";
- * VerifyNotificationChannelRequest request = VerifyNotificationChannelRequest.newBuilder()
- * .setName(name.toString())
- * .setCode(code)
- * .build();
- * ApiFuture<NotificationChannel> future = notificationChannelServiceClient.verifyNotificationChannelCallable().futureCall(request);
- * // Do something
- * NotificationChannel response = future.get();
- * }
- *
- *
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class NotificationChannelServiceSettings
- extends ClientSettings
- * NotificationChannelServiceSettings.Builder notificationChannelServiceSettingsBuilder =
- * NotificationChannelServiceSettings.newBuilder();
- * notificationChannelServiceSettingsBuilder.getNotificationChannelDescriptorSettings().getRetrySettings().toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30));
- * NotificationChannelServiceSettings notificationChannelServiceSettings = notificationChannelServiceSettingsBuilder.build();
- *
- *
- *
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
- * }
- *
- *
- *
- *
- *
- *
- *
- * To customize the endpoint:
- *
- *
- * UptimeCheckServiceSettings uptimeCheckServiceSettings =
- * UptimeCheckServiceSettings.newBuilder()
- * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- * .build();
- * UptimeCheckServiceClient uptimeCheckServiceClient =
- * UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class UptimeCheckServiceClient implements BackgroundResource {
- private final UptimeCheckServiceSettings settings;
- private final UptimeCheckServiceStub stub;
-
- /** Constructs an instance of UptimeCheckServiceClient with default settings. */
- public static final UptimeCheckServiceClient create() throws IOException {
- return create(UptimeCheckServiceSettings.newBuilder().build());
- }
-
- /**
- * Constructs an instance of UptimeCheckServiceClient, 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 UptimeCheckServiceClient create(UptimeCheckServiceSettings settings)
- throws IOException {
- return new UptimeCheckServiceClient(settings);
- }
-
- /**
- * Constructs an instance of UptimeCheckServiceClient, using the given stub for making calls. This
- * is for advanced usage - prefer to use UptimeCheckServiceSettings}.
- */
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public static final UptimeCheckServiceClient create(UptimeCheckServiceStub stub) {
- return new UptimeCheckServiceClient(stub);
- }
-
- /**
- * Constructs an instance of UptimeCheckServiceClient, 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 UptimeCheckServiceClient(UptimeCheckServiceSettings settings) throws IOException {
- this.settings = settings;
- this.stub = ((UptimeCheckServiceStubSettings) settings.getStubSettings()).createStub();
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- protected UptimeCheckServiceClient(UptimeCheckServiceStub stub) {
- this.settings = null;
- this.stub = stub;
- }
-
- public final UptimeCheckServiceSettings getSettings() {
- return settings;
- }
-
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
- public UptimeCheckServiceStub getStub() {
- return stub;
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing valid Uptime check configurations for the project (leaving out any invalid
- * configurations).
- *
- *
- * UptimeCheckServiceSettings uptimeCheckServiceSettings =
- * UptimeCheckServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * UptimeCheckServiceClient uptimeCheckServiceClient =
- * UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
- *
- *
- *
- * @param parent The project whose Uptime check configurations are listed. The format is
- * `projects/[PROJECT_ID]`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(String parent) {
- ListUptimeCheckConfigsRequest request =
- ListUptimeCheckConfigsRequest.newBuilder().setParent(parent).build();
- return listUptimeCheckConfigs(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing valid Uptime check configurations for the project (leaving out any invalid
- * configurations).
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * String formattedParent = ProjectName.format("[PROJECT]");
- * for (UptimeCheckConfig element : uptimeCheckServiceClient.listUptimeCheckConfigs(formattedParent).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 ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(
- ListUptimeCheckConfigsRequest request) {
- return listUptimeCheckConfigsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the existing valid Uptime check configurations for the project (leaving out any invalid
- * configurations).
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * String formattedParent = ProjectName.format("[PROJECT]");
- * ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
- * .setParent(formattedParent)
- * .build();
- * for (UptimeCheckConfig element : uptimeCheckServiceClient.listUptimeCheckConfigs(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * String formattedParent = ProjectName.format("[PROJECT]");
- * ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
- * .setParent(formattedParent)
- * .build();
- * ApiFuture<ListUptimeCheckConfigsPagedResponse> future = uptimeCheckServiceClient.listUptimeCheckConfigsPagedCallable().futureCall(request);
- * // Do something
- * for (UptimeCheckConfig element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * String formattedParent = ProjectName.format("[PROJECT]");
- * ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
- * .setParent(formattedParent)
- * .build();
- * while (true) {
- * ListUptimeCheckConfigsResponse response = uptimeCheckServiceClient.listUptimeCheckConfigsCallable().call(request);
- * for (UptimeCheckConfig element : response.getUptimeCheckConfigsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- * @param name The Uptime check configuration to retrieve. The format is
- * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final UptimeCheckConfig getUptimeCheckConfig(UptimeCheckConfigName name) {
-
- GetUptimeCheckConfigRequest request =
- GetUptimeCheckConfigRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- return getUptimeCheckConfig(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single Uptime check configuration.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
- * }
- *
- *
- * @param name The Uptime check configuration to retrieve. The format is
- * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final UptimeCheckConfig getUptimeCheckConfig(String name) {
-
- GetUptimeCheckConfigRequest request =
- GetUptimeCheckConfigRequest.newBuilder().setName(name).build();
- return getUptimeCheckConfig(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single Uptime check configuration.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name.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 UptimeCheckConfig getUptimeCheckConfig(GetUptimeCheckConfigRequest request) {
- return getUptimeCheckConfigCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets a single Uptime check configuration.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * GetUptimeCheckConfigRequest request = GetUptimeCheckConfigRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(request);
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * GetUptimeCheckConfigRequest request = GetUptimeCheckConfigRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.getUptimeCheckConfigCallable().futureCall(request);
- * // Do something
- * UptimeCheckConfig response = future.get();
- * }
- *
- *
- * @param parent The project in which to create the Uptime check. The format is
- * `projects/[PROJECT_ID]`.
- * @param uptimeCheckConfig The new Uptime check configuration.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final UptimeCheckConfig createUptimeCheckConfig(
- String parent, UptimeCheckConfig uptimeCheckConfig) {
-
- CreateUptimeCheckConfigRequest request =
- CreateUptimeCheckConfigRequest.newBuilder()
- .setParent(parent)
- .setUptimeCheckConfig(uptimeCheckConfig)
- .build();
- return createUptimeCheckConfig(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new Uptime check configuration.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * String formattedParent = ProjectName.format("[PROJECT]");
- * UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
- * UptimeCheckConfig response = uptimeCheckServiceClient.createUptimeCheckConfig(formattedParent, uptimeCheckConfig);
- * }
- *
- *
- * @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 UptimeCheckConfig createUptimeCheckConfig(CreateUptimeCheckConfigRequest request) {
- return createUptimeCheckConfigCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a new Uptime check configuration.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * String formattedParent = ProjectName.format("[PROJECT]");
- * UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
- * CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest.newBuilder()
- * .setParent(formattedParent)
- * .setUptimeCheckConfig(uptimeCheckConfig)
- * .build();
- * UptimeCheckConfig response = uptimeCheckServiceClient.createUptimeCheckConfig(request);
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * String formattedParent = ProjectName.format("[PROJECT]");
- * UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
- * CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest.newBuilder()
- * .setParent(formattedParent)
- * .setUptimeCheckConfig(uptimeCheckConfig)
- * .build();
- * ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.createUptimeCheckConfigCallable().futureCall(request);
- * // Do something
- * UptimeCheckConfig response = future.get();
- * }
- *
- *
- * @param uptimeCheckConfig Required. If an `updateMask` has been specified, this field gives the
- * values for the set of fields mentioned in the `updateMask`. If an `updateMask` has not been
- * given, this Uptime check configuration replaces the current configuration. If a field is
- * mentioned in `updateMask` but the corresonding field is omitted in this partial Uptime
- * check configuration, it has the effect of deleting/clearing the field from the
- * configuration on the server.
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
- * UptimeCheckConfig response = uptimeCheckServiceClient.updateUptimeCheckConfig(uptimeCheckConfig);
- * }
- *
- *
- * @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 UptimeCheckConfig updateUptimeCheckConfig(UpdateUptimeCheckConfigRequest request) {
- return updateUptimeCheckConfigCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates an Uptime check configuration. You can either replace the entire configuration with a
- * new one or replace only certain fields in the current configuration by specifying the fields to
- * be updated via `updateMask`. Returns the updated configuration.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
- * UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest.newBuilder()
- * .setUptimeCheckConfig(uptimeCheckConfig)
- * .build();
- * UptimeCheckConfig response = uptimeCheckServiceClient.updateUptimeCheckConfig(request);
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
- * UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest.newBuilder()
- * .setUptimeCheckConfig(uptimeCheckConfig)
- * .build();
- * ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.updateUptimeCheckConfigCallable().futureCall(request);
- * // Do something
- * UptimeCheckConfig response = future.get();
- * }
- *
- *
- * @param name The Uptime check configuration to delete. The format is
- * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteUptimeCheckConfig(UptimeCheckConfigName name) {
-
- DeleteUptimeCheckConfigRequest request =
- DeleteUptimeCheckConfigRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .build();
- deleteUptimeCheckConfig(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check
- * configuration is referenced by an alert policy or other dependent configs that would be
- * rendered invalid by the deletion.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * uptimeCheckServiceClient.deleteUptimeCheckConfig(name);
- * }
- *
- *
- * @param name The Uptime check configuration to delete. The format is
- * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteUptimeCheckConfig(String name) {
-
- DeleteUptimeCheckConfigRequest request =
- DeleteUptimeCheckConfigRequest.newBuilder().setName(name).build();
- deleteUptimeCheckConfig(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check
- * configuration is referenced by an alert policy or other dependent configs that would be
- * rendered invalid by the deletion.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * uptimeCheckServiceClient.deleteUptimeCheckConfig(name.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 deleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest request) {
- deleteUptimeCheckConfigCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check
- * configuration is referenced by an alert policy or other dependent configs that would be
- * rendered invalid by the deletion.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * uptimeCheckServiceClient.deleteUptimeCheckConfig(request);
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Void> future = uptimeCheckServiceClient.deleteUptimeCheckConfigCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
- *
- * @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 ListUptimeCheckIpsPagedResponse listUptimeCheckIps(
- ListUptimeCheckIpsRequest request) {
- return listUptimeCheckIpsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Returns the list of IP addresses that checkers run from
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
- * for (UptimeCheckIp element : uptimeCheckServiceClient.listUptimeCheckIps(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
- * ApiFuture<ListUptimeCheckIpsPagedResponse> future = uptimeCheckServiceClient.listUptimeCheckIpsPagedCallable().futureCall(request);
- * // Do something
- * for (UptimeCheckIp element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
- * while (true) {
- * ListUptimeCheckIpsResponse response = uptimeCheckServiceClient.listUptimeCheckIpsCallable().call(request);
- * for (UptimeCheckIp element : response.getUptimeCheckIpsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- *
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class UptimeCheckServiceSettings extends ClientSettings
- * UptimeCheckServiceSettings.Builder uptimeCheckServiceSettingsBuilder =
- * UptimeCheckServiceSettings.newBuilder();
- * uptimeCheckServiceSettingsBuilder.getUptimeCheckConfigSettings().getRetrySettings().toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30));
- * UptimeCheckServiceSettings uptimeCheckServiceSettings = uptimeCheckServiceSettingsBuilder.build();
- *
- *
- *
- *
- * ================== GroupServiceClient ==================
- *
- *
- * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
- * AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
- * AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
- * }
- *
- *
- *
- *
- * =================== MetricServiceClient ===================
- *
- *
- * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
- * GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
- * Group response = groupServiceClient.getGroup(name);
- * }
- *
- *
- *
- *
- * ================================ NotificationChannelServiceClient
- * ================================
- *
- *
- * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
- * MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
- * MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name);
- * }
- *
- *
- *
- *
- * ======================== UptimeCheckServiceClient ========================
- *
- *
- * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
- * NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
- * NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
- * }
- *
- *
- *
- */
-@Generated("by gapic-generator")
-package com.google.cloud.monitoring.v3;
-
-import javax.annotation.Generated;
diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStub.java
deleted file mode 100644
index 8af23ae2..00000000
--- a/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStub.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2019 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.monitoring.v3.stub;
-
-import static com.google.cloud.monitoring.v3.AlertPolicyServiceClient.ListAlertPoliciesPagedResponse;
-
-import com.google.api.core.BetaApi;
-import com.google.api.gax.core.BackgroundResource;
-import com.google.api.gax.rpc.UnaryCallable;
-import com.google.monitoring.v3.AlertPolicy;
-import com.google.monitoring.v3.CreateAlertPolicyRequest;
-import com.google.monitoring.v3.DeleteAlertPolicyRequest;
-import com.google.monitoring.v3.GetAlertPolicyRequest;
-import com.google.monitoring.v3.ListAlertPoliciesRequest;
-import com.google.monitoring.v3.ListAlertPoliciesResponse;
-import com.google.monitoring.v3.UpdateAlertPolicyRequest;
-import com.google.protobuf.Empty;
-import javax.annotation.Generated;
-
-// AUTO-GENERATED DOCUMENTATION AND CLASS
-/**
- * Base stub class for Stackdriver Monitoring API.
- *
- *
- * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
- * UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
- * UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
- * }
- *
- *
- *
- *
- *
- *
- */
-@Generated("by gapic-generator")
-public class AlertPolicyServiceStubSettings extends StubSettings
- * AlertPolicyServiceStubSettings.Builder alertPolicyServiceSettingsBuilder =
- * AlertPolicyServiceStubSettings.newBuilder();
- * alertPolicyServiceSettingsBuilder.getAlertPolicySettings().getRetrySettings().toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30));
- * AlertPolicyServiceStubSettings alertPolicyServiceSettings = alertPolicyServiceSettingsBuilder.build();
- *
- *