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

com.google.cloud.binaryauthorization.v1beta1.stub.GrpcBinauthzManagementServiceV1Beta1Stub Maven / Gradle / Ivy

Go to download

Binary Authorization is a service on Google Cloud that provides centralized software supply-chain security for applications that run on Google Kubernetes Engine (GKE) and Anthos clusters on VMware

There is a newer version: 1.48.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.binaryauthorization.v1beta1.stub;

import static com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse;

import com.google.api.core.BetaApi;
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.cloud.binaryauthorization.v1beta1.Attestor;
import com.google.cloud.binaryauthorization.v1beta1.CreateAttestorRequest;
import com.google.cloud.binaryauthorization.v1beta1.DeleteAttestorRequest;
import com.google.cloud.binaryauthorization.v1beta1.GetAttestorRequest;
import com.google.cloud.binaryauthorization.v1beta1.GetPolicyRequest;
import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsRequest;
import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsResponse;
import com.google.cloud.binaryauthorization.v1beta1.Policy;
import com.google.cloud.binaryauthorization.v1beta1.UpdateAttestorRequest;
import com.google.cloud.binaryauthorization.v1beta1.UpdatePolicyRequest;
import com.google.longrunning.stub.GrpcOperationsStub;
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 BinauthzManagementServiceV1Beta1 service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @BetaApi @Generated("by gapic-generator-java") public class GrpcBinauthzManagementServiceV1Beta1Stub extends BinauthzManagementServiceV1Beta1Stub { private static final MethodDescriptor getPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/GetPolicy") .setRequestMarshaller(ProtoUtils.marshaller(GetPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor updatePolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/UpdatePolicy") .setRequestMarshaller(ProtoUtils.marshaller(UpdatePolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor createAttestorMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/CreateAttestor") .setRequestMarshaller( ProtoUtils.marshaller(CreateAttestorRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Attestor.getDefaultInstance())) .build(); private static final MethodDescriptor getAttestorMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/GetAttestor") .setRequestMarshaller(ProtoUtils.marshaller(GetAttestorRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Attestor.getDefaultInstance())) .build(); private static final MethodDescriptor updateAttestorMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/UpdateAttestor") .setRequestMarshaller( ProtoUtils.marshaller(UpdateAttestorRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Attestor.getDefaultInstance())) .build(); private static final MethodDescriptor listAttestorsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/ListAttestors") .setRequestMarshaller( ProtoUtils.marshaller(ListAttestorsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListAttestorsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor deleteAttestorMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/DeleteAttestor") .setRequestMarshaller( ProtoUtils.marshaller(DeleteAttestorRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private final UnaryCallable getPolicyCallable; private final UnaryCallable updatePolicyCallable; private final UnaryCallable createAttestorCallable; private final UnaryCallable getAttestorCallable; private final UnaryCallable updateAttestorCallable; private final UnaryCallable listAttestorsCallable; private final UnaryCallable listAttestorsPagedCallable; private final UnaryCallable deleteAttestorCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcBinauthzManagementServiceV1Beta1Stub create( BinauthzManagementServiceV1Beta1StubSettings settings) throws IOException { return new GrpcBinauthzManagementServiceV1Beta1Stub(settings, ClientContext.create(settings)); } public static final GrpcBinauthzManagementServiceV1Beta1Stub create(ClientContext clientContext) throws IOException { return new GrpcBinauthzManagementServiceV1Beta1Stub( BinauthzManagementServiceV1Beta1StubSettings.newBuilder().build(), clientContext); } public static final GrpcBinauthzManagementServiceV1Beta1Stub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcBinauthzManagementServiceV1Beta1Stub( BinauthzManagementServiceV1Beta1StubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcBinauthzManagementServiceV1Beta1Stub, 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 GrpcBinauthzManagementServiceV1Beta1Stub( BinauthzManagementServiceV1Beta1StubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcBinauthzManagementServiceV1Beta1CallableFactory()); } /** * Constructs an instance of GrpcBinauthzManagementServiceV1Beta1Stub, 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 GrpcBinauthzManagementServiceV1Beta1Stub( BinauthzManagementServiceV1Beta1StubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings getPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getPolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updatePolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updatePolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("policy.name", String.valueOf(request.getPolicy().getName())); return builder.build(); }) .build(); GrpcCallSettings createAttestorTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createAttestorMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getAttestorTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getAttestorMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateAttestorTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateAttestorMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("attestor.name", String.valueOf(request.getAttestor().getName())); return builder.build(); }) .build(); GrpcCallSettings listAttestorsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listAttestorsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings deleteAttestorTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteAttestorMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.getPolicyCallable = callableFactory.createUnaryCallable( getPolicyTransportSettings, settings.getPolicySettings(), clientContext); this.updatePolicyCallable = callableFactory.createUnaryCallable( updatePolicyTransportSettings, settings.updatePolicySettings(), clientContext); this.createAttestorCallable = callableFactory.createUnaryCallable( createAttestorTransportSettings, settings.createAttestorSettings(), clientContext); this.getAttestorCallable = callableFactory.createUnaryCallable( getAttestorTransportSettings, settings.getAttestorSettings(), clientContext); this.updateAttestorCallable = callableFactory.createUnaryCallable( updateAttestorTransportSettings, settings.updateAttestorSettings(), clientContext); this.listAttestorsCallable = callableFactory.createUnaryCallable( listAttestorsTransportSettings, settings.listAttestorsSettings(), clientContext); this.listAttestorsPagedCallable = callableFactory.createPagedCallable( listAttestorsTransportSettings, settings.listAttestorsSettings(), clientContext); this.deleteAttestorCallable = callableFactory.createUnaryCallable( deleteAttestorTransportSettings, settings.deleteAttestorSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable getPolicyCallable() { return getPolicyCallable; } @Override public UnaryCallable updatePolicyCallable() { return updatePolicyCallable; } @Override public UnaryCallable createAttestorCallable() { return createAttestorCallable; } @Override public UnaryCallable getAttestorCallable() { return getAttestorCallable; } @Override public UnaryCallable updateAttestorCallable() { return updateAttestorCallable; } @Override public UnaryCallable listAttestorsCallable() { return listAttestorsCallable; } @Override public UnaryCallable listAttestorsPagedCallable() { return listAttestorsPagedCallable; } @Override public UnaryCallable deleteAttestorCallable() { return deleteAttestorCallable; } @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