Class BinauthzManagementServiceV1Beta1Client
- java.lang.Object
-
- com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class BinauthzManagementServiceV1Beta1Client extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Google Cloud Management Service for Binary Authorization admission policies and attestation authorities.This API implements a REST model with the following objects:
- [Policy][google.cloud.binaryauthorization.v1beta1.Policy]
- [Attestor][google.cloud.binaryauthorization.v1beta1.Attestor]
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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { PolicyName name = PolicyName.ofProjectName("[PROJECT]"); Policy response = binauthzManagementServiceV1Beta1Client.getPolicy(name); }
Note: close() needs to be called on the BinauthzManagementServiceV1Beta1Client 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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 BinauthzManagementServiceV1Beta1Settings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings = BinauthzManagementServiceV1Beta1Settings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings = BinauthzManagementServiceV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build(); BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings = BinauthzManagementServiceV1Beta1Settings.newHttpJsonBuilder().build(); BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BinauthzManagementServiceV1Beta1Client.ListAttestorsFixedSizeCollection
static class
BinauthzManagementServiceV1Beta1Client.ListAttestorsPage
static class
BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
BinauthzManagementServiceV1Beta1Client(BinauthzManagementServiceV1Beta1Settings settings)
Constructs an instance of BinauthzManagementServiceV1Beta1Client, using the given settings.protected
BinauthzManagementServiceV1Beta1Client(BinauthzManagementServiceV1Beta1Stub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static BinauthzManagementServiceV1Beta1Client
create()
Constructs an instance of BinauthzManagementServiceV1Beta1Client with default settings.static BinauthzManagementServiceV1Beta1Client
create(BinauthzManagementServiceV1Beta1Settings settings)
Constructs an instance of BinauthzManagementServiceV1Beta1Client, using the given settings.static BinauthzManagementServiceV1Beta1Client
create(BinauthzManagementServiceV1Beta1Stub stub)
Constructs an instance of BinauthzManagementServiceV1Beta1Client, using the given stub for making calls.Attestor
createAttestor(CreateAttestorRequest request)
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Attestor
createAttestor(ProjectName parent, String attestorId, Attestor attestor)
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Attestor
createAttestor(String parent, String attestorId, Attestor attestor)
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].com.google.api.gax.rpc.UnaryCallable<CreateAttestorRequest,Attestor>
createAttestorCallable()
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].void
deleteAttestor(AttestorName name)
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].void
deleteAttestor(DeleteAttestorRequest request)
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].void
deleteAttestor(String name)
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].com.google.api.gax.rpc.UnaryCallable<DeleteAttestorRequest,com.google.protobuf.Empty>
deleteAttestorCallable()
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Attestor
getAttestor(AttestorName name)
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Attestor
getAttestor(GetAttestorRequest request)
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Attestor
getAttestor(String name)
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].com.google.api.gax.rpc.UnaryCallable<GetAttestorRequest,Attestor>
getAttestorCallable()
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Policy
getPolicy(GetPolicyRequest request)
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image.Policy
getPolicy(PolicyName name)
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image.Policy
getPolicy(String name)
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image.com.google.api.gax.rpc.UnaryCallable<GetPolicyRequest,Policy>
getPolicyCallable()
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image.BinauthzManagementServiceV1Beta1Settings
getSettings()
BinauthzManagementServiceV1Beta1Stub
getStub()
boolean
isShutdown()
boolean
isTerminated()
BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse
listAttestors(ListAttestorsRequest request)
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor].BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse
listAttestors(ProjectName parent)
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor].BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse
listAttestors(String parent)
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor].com.google.api.gax.rpc.UnaryCallable<ListAttestorsRequest,ListAttestorsResponse>
listAttestorsCallable()
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor].com.google.api.gax.rpc.UnaryCallable<ListAttestorsRequest,BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse>
listAttestorsPagedCallable()
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor].void
shutdown()
void
shutdownNow()
Attestor
updateAttestor(Attestor attestor)
Updates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Attestor
updateAttestor(UpdateAttestorRequest request)
Updates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].com.google.api.gax.rpc.UnaryCallable<UpdateAttestorRequest,Attestor>
updateAttestorCallable()
Updates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].Policy
updatePolicy(Policy policy)
Creates or updates a project's [policy][google.cloud.binaryauthorization.v1beta1.Policy], and returns a copy of the new [policy][google.cloud.binaryauthorization.v1beta1.Policy].Policy
updatePolicy(UpdatePolicyRequest request)
Creates or updates a project's [policy][google.cloud.binaryauthorization.v1beta1.Policy], and returns a copy of the new [policy][google.cloud.binaryauthorization.v1beta1.Policy].com.google.api.gax.rpc.UnaryCallable<UpdatePolicyRequest,Policy>
updatePolicyCallable()
Creates or updates a project's [policy][google.cloud.binaryauthorization.v1beta1.Policy], and returns a copy of the new [policy][google.cloud.binaryauthorization.v1beta1.Policy].
-
-
-
Constructor Detail
-
BinauthzManagementServiceV1Beta1Client
protected BinauthzManagementServiceV1Beta1Client(BinauthzManagementServiceV1Beta1Settings settings) throws IOException
Constructs an instance of BinauthzManagementServiceV1Beta1Client, 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.- Throws:
IOException
-
BinauthzManagementServiceV1Beta1Client
protected BinauthzManagementServiceV1Beta1Client(BinauthzManagementServiceV1Beta1Stub stub)
-
-
Method Detail
-
create
public static final BinauthzManagementServiceV1Beta1Client create() throws IOException
Constructs an instance of BinauthzManagementServiceV1Beta1Client with default settings.- Throws:
IOException
-
create
public static final BinauthzManagementServiceV1Beta1Client create(BinauthzManagementServiceV1Beta1Settings settings) throws IOException
Constructs an instance of BinauthzManagementServiceV1Beta1Client, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
public static final BinauthzManagementServiceV1Beta1Client create(BinauthzManagementServiceV1Beta1Stub stub)
Constructs an instance of BinauthzManagementServiceV1Beta1Client, using the given stub for making calls. This is for advanced usage - prefer using create(BinauthzManagementServiceV1Beta1Settings).
-
getSettings
public final BinauthzManagementServiceV1Beta1Settings getSettings()
-
getStub
public BinauthzManagementServiceV1Beta1Stub getStub()
-
getPolicy
public final Policy getPolicy(PolicyName name)
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image. There is at most one policy per project. All image admission requests are permitted if a project has no policy.Gets the [policy][google.cloud.binaryauthorization.v1beta1.Policy] for this project. Returns a default [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { PolicyName name = PolicyName.ofProjectName("[PROJECT]"); Policy response = binauthzManagementServiceV1Beta1Client.getPolicy(name); }
- Parameters:
name
- Required. The resource name of the [policy][google.cloud.binaryauthorization.v1beta1.Policy] to retrieve, in the format `projects/*/policy`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getPolicy
public final Policy getPolicy(String name)
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image. There is at most one policy per project. All image admission requests are permitted if a project has no policy.Gets the [policy][google.cloud.binaryauthorization.v1beta1.Policy] for this project. Returns a default [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { String name = PolicyName.ofProjectName("[PROJECT]").toString(); Policy response = binauthzManagementServiceV1Beta1Client.getPolicy(name); }
- Parameters:
name
- Required. The resource name of the [policy][google.cloud.binaryauthorization.v1beta1.Policy] to retrieve, in the format `projects/*/policy`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getPolicy
public final Policy getPolicy(GetPolicyRequest request)
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image. There is at most one policy per project. All image admission requests are permitted if a project has no policy.Gets the [policy][google.cloud.binaryauthorization.v1beta1.Policy] for this project. Returns a default [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { GetPolicyRequest request = GetPolicyRequest.newBuilder() .setName(PolicyName.ofProjectName("[PROJECT]").toString()) .build(); Policy response = binauthzManagementServiceV1Beta1Client.getPolicy(request); }
- Parameters:
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
-
getPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<GetPolicyRequest,Policy> getPolicyCallable()
A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to a container image, before the project is allowed to deploy that image. There is at most one policy per project. All image admission requests are permitted if a project has no policy.Gets the [policy][google.cloud.binaryauthorization.v1beta1.Policy] for this project. Returns a default [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { GetPolicyRequest request = GetPolicyRequest.newBuilder() .setName(PolicyName.ofProjectName("[PROJECT]").toString()) .build(); ApiFuture<Policy> future = binauthzManagementServiceV1Beta1Client.getPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
updatePolicy
public final Policy updatePolicy(Policy policy)
Creates or updates a project's [policy][google.cloud.binaryauthorization.v1beta1.Policy], and returns a copy of the new [policy][google.cloud.binaryauthorization.v1beta1.Policy]. A policy is always updated as a whole, to avoid race conditions with concurrent policy enforcement (or management!) requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { Policy policy = Policy.newBuilder().build(); Policy response = binauthzManagementServiceV1Beta1Client.updatePolicy(policy); }
- Parameters:
policy
- Required. A new or updated [policy][google.cloud.binaryauthorization.v1beta1.Policy] value. The service will overwrite the [policy name][google.cloud.binaryauthorization.v1beta1.Policy.name] field with the resource name in the request URL, in the format `projects/*/policy`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updatePolicy
public final Policy updatePolicy(UpdatePolicyRequest request)
Creates or updates a project's [policy][google.cloud.binaryauthorization.v1beta1.Policy], and returns a copy of the new [policy][google.cloud.binaryauthorization.v1beta1.Policy]. A policy is always updated as a whole, to avoid race conditions with concurrent policy enforcement (or management!) requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { UpdatePolicyRequest request = UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build(); Policy response = binauthzManagementServiceV1Beta1Client.updatePolicy(request); }
- Parameters:
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
-
updatePolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdatePolicyRequest,Policy> updatePolicyCallable()
Creates or updates a project's [policy][google.cloud.binaryauthorization.v1beta1.Policy], and returns a copy of the new [policy][google.cloud.binaryauthorization.v1beta1.Policy]. A policy is always updated as a whole, to avoid race conditions with concurrent policy enforcement (or management!) requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { UpdatePolicyRequest request = UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build(); ApiFuture<Policy> future = binauthzManagementServiceV1Beta1Client.updatePolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
createAttestor
public final Attestor createAttestor(ProjectName parent, String attestorId, Attestor attestor)
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); String attestorId = "attestorId2055733027"; Attestor attestor = Attestor.newBuilder().build(); Attestor response = binauthzManagementServiceV1Beta1Client.createAttestor(parent, attestorId, attestor); }
- Parameters:
parent
- Required. The parent of this [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].attestorId
- Required. The [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] ID.attestor
- Required. The initial [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] value. The service will overwrite the [attestor name][google.cloud.binaryauthorization.v1beta1.Attestor.name] field with the resource name, in the format `projects/*/attestors/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createAttestor
public final Attestor createAttestor(String parent, String attestorId, Attestor attestor)
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { String parent = ProjectName.of("[PROJECT]").toString(); String attestorId = "attestorId2055733027"; Attestor attestor = Attestor.newBuilder().build(); Attestor response = binauthzManagementServiceV1Beta1Client.createAttestor(parent, attestorId, attestor); }
- Parameters:
parent
- Required. The parent of this [attestor][google.cloud.binaryauthorization.v1beta1.Attestor].attestorId
- Required. The [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] ID.attestor
- Required. The initial [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] value. The service will overwrite the [attestor name][google.cloud.binaryauthorization.v1beta1.Attestor.name] field with the resource name, in the format `projects/*/attestors/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createAttestor
public final Attestor createAttestor(CreateAttestorRequest request)
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { CreateAttestorRequest request = CreateAttestorRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setAttestorId("attestorId2055733027") .setAttestor(Attestor.newBuilder().build()) .build(); Attestor response = binauthzManagementServiceV1Beta1Client.createAttestor(request); }
- Parameters:
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
-
createAttestorCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateAttestorRequest,Attestor> createAttestorCallable()
Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { CreateAttestorRequest request = CreateAttestorRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setAttestorId("attestorId2055733027") .setAttestor(Attestor.newBuilder().build()) .build(); ApiFuture<Attestor> future = binauthzManagementServiceV1Beta1Client.createAttestorCallable().futureCall(request); // Do something. Attestor response = future.get(); }
-
getAttestor
public final Attestor getAttestor(AttestorName name)
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); Attestor response = binauthzManagementServiceV1Beta1Client.getAttestor(name); }
- Parameters:
name
- Required. The name of the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] to retrieve, in the format `projects/*/attestors/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getAttestor
public final Attestor getAttestor(String name)
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { String name = AttestorName.of("[PROJECT]", "[ATTESTOR]").toString(); Attestor response = binauthzManagementServiceV1Beta1Client.getAttestor(name); }
- Parameters:
name
- Required. The name of the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] to retrieve, in the format `projects/*/attestors/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getAttestor
public final Attestor getAttestor(GetAttestorRequest request)
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { GetAttestorRequest request = GetAttestorRequest.newBuilder() .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) .build(); Attestor response = binauthzManagementServiceV1Beta1Client.getAttestor(request); }
- Parameters:
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
-
getAttestorCallable
public final com.google.api.gax.rpc.UnaryCallable<GetAttestorRequest,Attestor> getAttestorCallable()
Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { GetAttestorRequest request = GetAttestorRequest.newBuilder() .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) .build(); ApiFuture<Attestor> future = binauthzManagementServiceV1Beta1Client.getAttestorCallable().futureCall(request); // Do something. Attestor response = future.get(); }
-
updateAttestor
public final Attestor updateAttestor(Attestor attestor)
Updates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { Attestor attestor = Attestor.newBuilder().build(); Attestor response = binauthzManagementServiceV1Beta1Client.updateAttestor(attestor); }
- Parameters:
attestor
- Required. The updated [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] value. The service will overwrite the [attestor name][google.cloud.binaryauthorization.v1beta1.Attestor.name] field with the resource name in the request URL, in the format `projects/*/attestors/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateAttestor
public final Attestor updateAttestor(UpdateAttestorRequest request)
Updates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { UpdateAttestorRequest request = UpdateAttestorRequest.newBuilder().setAttestor(Attestor.newBuilder().build()).build(); Attestor response = binauthzManagementServiceV1Beta1Client.updateAttestor(request); }
- Parameters:
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
-
updateAttestorCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateAttestorRequest,Attestor> updateAttestorCallable()
Updates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { UpdateAttestorRequest request = UpdateAttestorRequest.newBuilder().setAttestor(Attestor.newBuilder().build()).build(); ApiFuture<Attestor> future = binauthzManagementServiceV1Beta1Client.updateAttestorCallable().futureCall(request); // Do something. Attestor response = future.get(); }
-
listAttestors
public final BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse listAttestors(ProjectName parent)
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); for (Attestor element : binauthzManagementServiceV1Beta1Client.listAttestors(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The resource name of the project associated with the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor], in the format `projects/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAttestors
public final BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse listAttestors(String parent)
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { String parent = ProjectName.of("[PROJECT]").toString(); for (Attestor element : binauthzManagementServiceV1Beta1Client.listAttestors(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The resource name of the project associated with the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor], in the format `projects/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAttestors
public final BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse listAttestors(ListAttestorsRequest request)
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { ListAttestorsRequest request = ListAttestorsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Attestor element : binauthzManagementServiceV1Beta1Client.listAttestors(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
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
-
listAttestorsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListAttestorsRequest,BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse> listAttestorsPagedCallable()
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { ListAttestorsRequest request = ListAttestorsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Attestor> future = binauthzManagementServiceV1Beta1Client.listAttestorsPagedCallable().futureCall(request); // Do something. for (Attestor element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listAttestorsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListAttestorsRequest,ListAttestorsResponse> listAttestorsCallable()
Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { ListAttestorsRequest request = ListAttestorsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListAttestorsResponse response = binauthzManagementServiceV1Beta1Client.listAttestorsCallable().call(request); for (Attestor element : response.getAttestorsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
deleteAttestor
public final void deleteAttestor(AttestorName name)
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); binauthzManagementServiceV1Beta1Client.deleteAttestor(name); }
- Parameters:
name
- Required. The name of the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] to delete, in the format `projects/*/attestors/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteAttestor
public final void deleteAttestor(String name)
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { String name = AttestorName.of("[PROJECT]", "[ATTESTOR]").toString(); binauthzManagementServiceV1Beta1Client.deleteAttestor(name); }
- Parameters:
name
- Required. The name of the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] to delete, in the format `projects/*/attestors/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteAttestor
public final void deleteAttestor(DeleteAttestorRequest request)
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { DeleteAttestorRequest request = DeleteAttestorRequest.newBuilder() .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) .build(); binauthzManagementServiceV1Beta1Client.deleteAttestor(request); }
- Parameters:
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
-
deleteAttestorCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteAttestorRequest,com.google.protobuf.Empty> deleteAttestorCallable()
Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.create()) { DeleteAttestorRequest request = DeleteAttestorRequest.newBuilder() .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) .build(); ApiFuture<Empty> future = binauthzManagementServiceV1Beta1Client.deleteAttestorCallable().futureCall(request); // Do something. future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-