com.google.cloud.monitoring.v3.stub.GrpcNotificationChannelServiceStub Maven / Gradle / Ivy
Show all versions of google-cloud-monitoring Show documentation
/*
* 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.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse;
import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelsPagedResponse;
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.CreateNotificationChannelRequest;
import com.google.monitoring.v3.DeleteNotificationChannelRequest;
import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest;
import com.google.monitoring.v3.GetNotificationChannelRequest;
import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest;
import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse;
import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest;
import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse;
import com.google.monitoring.v3.ListNotificationChannelsRequest;
import com.google.monitoring.v3.ListNotificationChannelsResponse;
import com.google.monitoring.v3.NotificationChannel;
import com.google.monitoring.v3.NotificationChannelDescriptor;
import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest;
import com.google.monitoring.v3.UpdateNotificationChannelRequest;
import com.google.monitoring.v3.VerifyNotificationChannelRequest;
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 NotificationChannelService service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class GrpcNotificationChannelServiceStub extends NotificationChannelServiceStub {
private static final MethodDescriptor<
ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse>
listNotificationChannelDescriptorsMethodDescriptor =
MethodDescriptor
.
newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/ListNotificationChannelDescriptors")
.setRequestMarshaller(
ProtoUtils.marshaller(
ListNotificationChannelDescriptorsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(
ListNotificationChannelDescriptorsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor<
GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor>
getNotificationChannelDescriptorMethodDescriptor =
MethodDescriptor
.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/GetNotificationChannelDescriptor")
.setRequestMarshaller(
ProtoUtils.marshaller(
GetNotificationChannelDescriptorRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(NotificationChannelDescriptor.getDefaultInstance()))
.build();
private static final MethodDescriptor<
ListNotificationChannelsRequest, ListNotificationChannelsResponse>
listNotificationChannelsMethodDescriptor =
MethodDescriptor
.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/ListNotificationChannels")
.setRequestMarshaller(
ProtoUtils.marshaller(ListNotificationChannelsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListNotificationChannelsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
getNotificationChannelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/GetNotificationChannel")
.setRequestMarshaller(
ProtoUtils.marshaller(GetNotificationChannelRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(NotificationChannel.getDefaultInstance()))
.build();
private static final MethodDescriptor
createNotificationChannelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/CreateNotificationChannel")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateNotificationChannelRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(NotificationChannel.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateNotificationChannelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/UpdateNotificationChannel")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateNotificationChannelRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(NotificationChannel.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteNotificationChannelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/DeleteNotificationChannel")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteNotificationChannelRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor
sendNotificationChannelVerificationCodeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/SendNotificationChannelVerificationCode")
.setRequestMarshaller(
ProtoUtils.marshaller(
SendNotificationChannelVerificationCodeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor<
GetNotificationChannelVerificationCodeRequest,
GetNotificationChannelVerificationCodeResponse>
getNotificationChannelVerificationCodeMethodDescriptor =
MethodDescriptor
.
newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/GetNotificationChannelVerificationCode")
.setRequestMarshaller(
ProtoUtils.marshaller(
GetNotificationChannelVerificationCodeRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(
GetNotificationChannelVerificationCodeResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
verifyNotificationChannelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.monitoring.v3.NotificationChannelService/VerifyNotificationChannel")
.setRequestMarshaller(
ProtoUtils.marshaller(VerifyNotificationChannelRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(NotificationChannel.getDefaultInstance()))
.build();
private final UnaryCallable<
ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse>
listNotificationChannelDescriptorsCallable;
private final UnaryCallable<
ListNotificationChannelDescriptorsRequest,
ListNotificationChannelDescriptorsPagedResponse>
listNotificationChannelDescriptorsPagedCallable;
private final UnaryCallable<
GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor>
getNotificationChannelDescriptorCallable;
private final UnaryCallable
listNotificationChannelsCallable;
private final UnaryCallable<
ListNotificationChannelsRequest, ListNotificationChannelsPagedResponse>
listNotificationChannelsPagedCallable;
private final UnaryCallable
getNotificationChannelCallable;
private final UnaryCallable
createNotificationChannelCallable;
private final UnaryCallable
updateNotificationChannelCallable;
private final UnaryCallable
deleteNotificationChannelCallable;
private final UnaryCallable
sendNotificationChannelVerificationCodeCallable;
private final UnaryCallable<
GetNotificationChannelVerificationCodeRequest,
GetNotificationChannelVerificationCodeResponse>
getNotificationChannelVerificationCodeCallable;
private final UnaryCallable
verifyNotificationChannelCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcNotificationChannelServiceStub create(
NotificationChannelServiceStubSettings settings) throws IOException {
return new GrpcNotificationChannelServiceStub(settings, ClientContext.create(settings));
}
public static final GrpcNotificationChannelServiceStub create(ClientContext clientContext)
throws IOException {
return new GrpcNotificationChannelServiceStub(
NotificationChannelServiceStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcNotificationChannelServiceStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcNotificationChannelServiceStub(
NotificationChannelServiceStubSettings.newBuilder().build(),
clientContext,
callableFactory);
}
/**
* Constructs an instance of GrpcNotificationChannelServiceStub, 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 GrpcNotificationChannelServiceStub(
NotificationChannelServiceStubSettings settings, ClientContext clientContext)
throws IOException {
this(settings, clientContext, new GrpcNotificationChannelServiceCallableFactory());
}
/**
* Constructs an instance of GrpcNotificationChannelServiceStub, 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 GrpcNotificationChannelServiceStub(
NotificationChannelServiceStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings<
ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse>
listNotificationChannelDescriptorsTransportSettings =
GrpcCallSettings
.
newBuilder()
.setMethodDescriptor(listNotificationChannelDescriptorsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
getNotificationChannelDescriptorTransportSettings =
GrpcCallSettings
.
newBuilder()
.setMethodDescriptor(getNotificationChannelDescriptorMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
listNotificationChannelsTransportSettings =
GrpcCallSettings
.newBuilder()
.setMethodDescriptor(listNotificationChannelsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
getNotificationChannelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getNotificationChannelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
createNotificationChannelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createNotificationChannelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
updateNotificationChannelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateNotificationChannelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add(
"notification_channel.name",
String.valueOf(request.getNotificationChannel().getName()));
return builder.build();
})
.build();
GrpcCallSettings
deleteNotificationChannelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteNotificationChannelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
sendNotificationChannelVerificationCodeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(sendNotificationChannelVerificationCodeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings<
GetNotificationChannelVerificationCodeRequest,
GetNotificationChannelVerificationCodeResponse>
getNotificationChannelVerificationCodeTransportSettings =
GrpcCallSettings
.
newBuilder()
.setMethodDescriptor(getNotificationChannelVerificationCodeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
verifyNotificationChannelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(verifyNotificationChannelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
this.listNotificationChannelDescriptorsCallable =
callableFactory.createUnaryCallable(
listNotificationChannelDescriptorsTransportSettings,
settings.listNotificationChannelDescriptorsSettings(),
clientContext);
this.listNotificationChannelDescriptorsPagedCallable =
callableFactory.createPagedCallable(
listNotificationChannelDescriptorsTransportSettings,
settings.listNotificationChannelDescriptorsSettings(),
clientContext);
this.getNotificationChannelDescriptorCallable =
callableFactory.createUnaryCallable(
getNotificationChannelDescriptorTransportSettings,
settings.getNotificationChannelDescriptorSettings(),
clientContext);
this.listNotificationChannelsCallable =
callableFactory.createUnaryCallable(
listNotificationChannelsTransportSettings,
settings.listNotificationChannelsSettings(),
clientContext);
this.listNotificationChannelsPagedCallable =
callableFactory.createPagedCallable(
listNotificationChannelsTransportSettings,
settings.listNotificationChannelsSettings(),
clientContext);
this.getNotificationChannelCallable =
callableFactory.createUnaryCallable(
getNotificationChannelTransportSettings,
settings.getNotificationChannelSettings(),
clientContext);
this.createNotificationChannelCallable =
callableFactory.createUnaryCallable(
createNotificationChannelTransportSettings,
settings.createNotificationChannelSettings(),
clientContext);
this.updateNotificationChannelCallable =
callableFactory.createUnaryCallable(
updateNotificationChannelTransportSettings,
settings.updateNotificationChannelSettings(),
clientContext);
this.deleteNotificationChannelCallable =
callableFactory.createUnaryCallable(
deleteNotificationChannelTransportSettings,
settings.deleteNotificationChannelSettings(),
clientContext);
this.sendNotificationChannelVerificationCodeCallable =
callableFactory.createUnaryCallable(
sendNotificationChannelVerificationCodeTransportSettings,
settings.sendNotificationChannelVerificationCodeSettings(),
clientContext);
this.getNotificationChannelVerificationCodeCallable =
callableFactory.createUnaryCallable(
getNotificationChannelVerificationCodeTransportSettings,
settings.getNotificationChannelVerificationCodeSettings(),
clientContext);
this.verifyNotificationChannelCallable =
callableFactory.createUnaryCallable(
verifyNotificationChannelTransportSettings,
settings.verifyNotificationChannelSettings(),
clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable<
ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse>
listNotificationChannelDescriptorsCallable() {
return listNotificationChannelDescriptorsCallable;
}
@Override
public UnaryCallable<
ListNotificationChannelDescriptorsRequest,
ListNotificationChannelDescriptorsPagedResponse>
listNotificationChannelDescriptorsPagedCallable() {
return listNotificationChannelDescriptorsPagedCallable;
}
@Override
public UnaryCallable
getNotificationChannelDescriptorCallable() {
return getNotificationChannelDescriptorCallable;
}
@Override
public UnaryCallable
listNotificationChannelsCallable() {
return listNotificationChannelsCallable;
}
@Override
public UnaryCallable
listNotificationChannelsPagedCallable() {
return listNotificationChannelsPagedCallable;
}
@Override
public UnaryCallable
getNotificationChannelCallable() {
return getNotificationChannelCallable;
}
@Override
public UnaryCallable
createNotificationChannelCallable() {
return createNotificationChannelCallable;
}
@Override
public UnaryCallable
updateNotificationChannelCallable() {
return updateNotificationChannelCallable;
}
@Override
public UnaryCallable
deleteNotificationChannelCallable() {
return deleteNotificationChannelCallable;
}
@Override
public UnaryCallable
sendNotificationChannelVerificationCodeCallable() {
return sendNotificationChannelVerificationCodeCallable;
}
@Override
public UnaryCallable<
GetNotificationChannelVerificationCodeRequest,
GetNotificationChannelVerificationCodeResponse>
getNotificationChannelVerificationCodeCallable() {
return getNotificationChannelVerificationCodeCallable;
}
@Override
public UnaryCallable
verifyNotificationChannelCallable() {
return verifyNotificationChannelCallable;
}
@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);
}
}