All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.monitoring.v3.stub.GrpcUptimeCheckServiceStub Maven / Gradle / Ivy

There is a newer version: 3.55.0
Show newest version
/*
 * Copyright 2024 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.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse;
import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.monitoring.v3.CreateUptimeCheckConfigRequest;
import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest;
import com.google.monitoring.v3.GetUptimeCheckConfigRequest;
import com.google.monitoring.v3.ListUptimeCheckConfigsRequest;
import com.google.monitoring.v3.ListUptimeCheckConfigsResponse;
import com.google.monitoring.v3.ListUptimeCheckIpsRequest;
import com.google.monitoring.v3.ListUptimeCheckIpsResponse;
import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest;
import com.google.monitoring.v3.UptimeCheckConfig;
import com.google.protobuf.Empty;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * gRPC stub implementation for the UptimeCheckService service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class GrpcUptimeCheckServiceStub extends UptimeCheckServiceStub { private static final MethodDescriptor< ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse> listUptimeCheckConfigsMethodDescriptor = MethodDescriptor .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.monitoring.v3.UptimeCheckService/ListUptimeCheckConfigs") .setRequestMarshaller( ProtoUtils.marshaller(ListUptimeCheckConfigsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListUptimeCheckConfigsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getUptimeCheckConfigMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.monitoring.v3.UptimeCheckService/GetUptimeCheckConfig") .setRequestMarshaller( ProtoUtils.marshaller(GetUptimeCheckConfigRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(UptimeCheckConfig.getDefaultInstance())) .build(); private static final MethodDescriptor createUptimeCheckConfigMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.monitoring.v3.UptimeCheckService/CreateUptimeCheckConfig") .setRequestMarshaller( ProtoUtils.marshaller(CreateUptimeCheckConfigRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(UptimeCheckConfig.getDefaultInstance())) .build(); private static final MethodDescriptor updateUptimeCheckConfigMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.monitoring.v3.UptimeCheckService/UpdateUptimeCheckConfig") .setRequestMarshaller( ProtoUtils.marshaller(UpdateUptimeCheckConfigRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(UptimeCheckConfig.getDefaultInstance())) .build(); private static final MethodDescriptor deleteUptimeCheckConfigMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.monitoring.v3.UptimeCheckService/DeleteUptimeCheckConfig") .setRequestMarshaller( ProtoUtils.marshaller(DeleteUptimeCheckConfigRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private static final MethodDescriptor listUptimeCheckIpsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps") .setRequestMarshaller( ProtoUtils.marshaller(ListUptimeCheckIpsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListUptimeCheckIpsResponse.getDefaultInstance())) .build(); private final UnaryCallable listUptimeCheckConfigsCallable; private final UnaryCallable listUptimeCheckConfigsPagedCallable; private final UnaryCallable getUptimeCheckConfigCallable; private final UnaryCallable createUptimeCheckConfigCallable; private final UnaryCallable updateUptimeCheckConfigCallable; private final UnaryCallable deleteUptimeCheckConfigCallable; private final UnaryCallable listUptimeCheckIpsCallable; private final UnaryCallable listUptimeCheckIpsPagedCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcUptimeCheckServiceStub create(UptimeCheckServiceStubSettings settings) throws IOException { return new GrpcUptimeCheckServiceStub(settings, ClientContext.create(settings)); } public static final GrpcUptimeCheckServiceStub create(ClientContext clientContext) throws IOException { return new GrpcUptimeCheckServiceStub( UptimeCheckServiceStubSettings.newBuilder().build(), clientContext); } public static final GrpcUptimeCheckServiceStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcUptimeCheckServiceStub( UptimeCheckServiceStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcUptimeCheckServiceStub, 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 GrpcUptimeCheckServiceStub( UptimeCheckServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcUptimeCheckServiceCallableFactory()); } /** * Constructs an instance of GrpcUptimeCheckServiceStub, 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 GrpcUptimeCheckServiceStub( UptimeCheckServiceStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listUptimeCheckConfigsTransportSettings = GrpcCallSettings .newBuilder() .setMethodDescriptor(listUptimeCheckConfigsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getUptimeCheckConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getUptimeCheckConfigMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings createUptimeCheckConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createUptimeCheckConfigMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings updateUptimeCheckConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateUptimeCheckConfigMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "uptime_check_config.name", String.valueOf(request.getUptimeCheckConfig().getName())); return builder.build(); }) .build(); GrpcCallSettings deleteUptimeCheckConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteUptimeCheckConfigMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings listUptimeCheckIpsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listUptimeCheckIpsMethodDescriptor) .build(); this.listUptimeCheckConfigsCallable = callableFactory.createUnaryCallable( listUptimeCheckConfigsTransportSettings, settings.listUptimeCheckConfigsSettings(), clientContext); this.listUptimeCheckConfigsPagedCallable = callableFactory.createPagedCallable( listUptimeCheckConfigsTransportSettings, settings.listUptimeCheckConfigsSettings(), clientContext); this.getUptimeCheckConfigCallable = callableFactory.createUnaryCallable( getUptimeCheckConfigTransportSettings, settings.getUptimeCheckConfigSettings(), clientContext); this.createUptimeCheckConfigCallable = callableFactory.createUnaryCallable( createUptimeCheckConfigTransportSettings, settings.createUptimeCheckConfigSettings(), clientContext); this.updateUptimeCheckConfigCallable = callableFactory.createUnaryCallable( updateUptimeCheckConfigTransportSettings, settings.updateUptimeCheckConfigSettings(), clientContext); this.deleteUptimeCheckConfigCallable = callableFactory.createUnaryCallable( deleteUptimeCheckConfigTransportSettings, settings.deleteUptimeCheckConfigSettings(), clientContext); this.listUptimeCheckIpsCallable = callableFactory.createUnaryCallable( listUptimeCheckIpsTransportSettings, settings.listUptimeCheckIpsSettings(), clientContext); this.listUptimeCheckIpsPagedCallable = callableFactory.createPagedCallable( listUptimeCheckIpsTransportSettings, settings.listUptimeCheckIpsSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable listUptimeCheckConfigsCallable() { return listUptimeCheckConfigsCallable; } @Override public UnaryCallable listUptimeCheckConfigsPagedCallable() { return listUptimeCheckConfigsPagedCallable; } @Override public UnaryCallable getUptimeCheckConfigCallable() { return getUptimeCheckConfigCallable; } @Override public UnaryCallable createUptimeCheckConfigCallable() { return createUptimeCheckConfigCallable; } @Override public UnaryCallable updateUptimeCheckConfigCallable() { return updateUptimeCheckConfigCallable; } @Override public UnaryCallable deleteUptimeCheckConfigCallable() { return deleteUptimeCheckConfigCallable; } @Override public UnaryCallable listUptimeCheckIpsCallable() { return listUptimeCheckIpsCallable; } @Override public UnaryCallable listUptimeCheckIpsPagedCallable() { return listUptimeCheckIpsPagedCallable; } @Override public final void close() { try { backgroundResources.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Failed to close resource", e); } } @Override public void shutdown() { backgroundResources.shutdown(); } @Override public boolean isShutdown() { return backgroundResources.isShutdown(); } @Override public boolean isTerminated() { return backgroundResources.isTerminated(); } @Override public void shutdownNow() { backgroundResources.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return backgroundResources.awaitTermination(duration, unit); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy