Package com.google.cloud.secretmanager.v1 (2.27.0)

A client to Secret Manager API

The interfaces provided are listed below, along with usage samples.

SecretManagerServiceClient

Service Description: Secret Manager Service

Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

Sample for SecretManagerServiceClient:


 // 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 (SecretManagerServiceClient secretManagerServiceClient =
     SecretManagerServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   String secretId = "secretId945974251";
   Secret secret = Secret.newBuilder().build();
   Secret response = secretManagerServiceClient.createSecret(parent, secretId, secret);
 }
 

Classes

AccessSecretVersionRequest

Request message for SecretManagerService.AccessSecretVersion.

Protobuf type google.cloud.secretmanager.v1.AccessSecretVersionRequest

AccessSecretVersionRequest.Builder

Request message for SecretManagerService.AccessSecretVersion.

Protobuf type google.cloud.secretmanager.v1.AccessSecretVersionRequest

AccessSecretVersionResponse

Response message for SecretManagerService.AccessSecretVersion.

Protobuf type google.cloud.secretmanager.v1.AccessSecretVersionResponse

AccessSecretVersionResponse.Builder

Response message for SecretManagerService.AccessSecretVersion.

Protobuf type google.cloud.secretmanager.v1.AccessSecretVersionResponse

AddSecretVersionRequest

Request message for SecretManagerService.AddSecretVersion.

Protobuf type google.cloud.secretmanager.v1.AddSecretVersionRequest

AddSecretVersionRequest.Builder

Request message for SecretManagerService.AddSecretVersion.

Protobuf type google.cloud.secretmanager.v1.AddSecretVersionRequest

CreateSecretRequest

Request message for SecretManagerService.CreateSecret.

Protobuf type google.cloud.secretmanager.v1.CreateSecretRequest

CreateSecretRequest.Builder

Request message for SecretManagerService.CreateSecret.

Protobuf type google.cloud.secretmanager.v1.CreateSecretRequest

CustomerManagedEncryption

Configuration for encrypting secret payloads using customer-managed encryption keys (CMEK).

Protobuf type google.cloud.secretmanager.v1.CustomerManagedEncryption

CustomerManagedEncryption.Builder

Configuration for encrypting secret payloads using customer-managed encryption keys (CMEK).

Protobuf type google.cloud.secretmanager.v1.CustomerManagedEncryption

CustomerManagedEncryptionStatus

Describes the status of customer-managed encryption.

Protobuf type google.cloud.secretmanager.v1.CustomerManagedEncryptionStatus

CustomerManagedEncryptionStatus.Builder

Describes the status of customer-managed encryption.

Protobuf type google.cloud.secretmanager.v1.CustomerManagedEncryptionStatus

DeleteSecretRequest

Request message for SecretManagerService.DeleteSecret.

Protobuf type google.cloud.secretmanager.v1.DeleteSecretRequest

DeleteSecretRequest.Builder

Request message for SecretManagerService.DeleteSecret.

Protobuf type google.cloud.secretmanager.v1.DeleteSecretRequest

DestroySecretVersionRequest

Request message for SecretManagerService.DestroySecretVersion.

Protobuf type google.cloud.secretmanager.v1.DestroySecretVersionRequest

DestroySecretVersionRequest.Builder

Request message for SecretManagerService.DestroySecretVersion.

Protobuf type google.cloud.secretmanager.v1.DestroySecretVersionRequest

DisableSecretVersionRequest

Request message for SecretManagerService.DisableSecretVersion.

Protobuf type google.cloud.secretmanager.v1.DisableSecretVersionRequest

DisableSecretVersionRequest.Builder

Request message for SecretManagerService.DisableSecretVersion.

Protobuf type google.cloud.secretmanager.v1.DisableSecretVersionRequest

EnableSecretVersionRequest

Request message for SecretManagerService.EnableSecretVersion.

Protobuf type google.cloud.secretmanager.v1.EnableSecretVersionRequest

EnableSecretVersionRequest.Builder

Request message for SecretManagerService.EnableSecretVersion.

Protobuf type google.cloud.secretmanager.v1.EnableSecretVersionRequest

GetSecretRequest

Request message for SecretManagerService.GetSecret.

Protobuf type google.cloud.secretmanager.v1.GetSecretRequest

GetSecretRequest.Builder

Request message for SecretManagerService.GetSecret.

Protobuf type google.cloud.secretmanager.v1.GetSecretRequest

GetSecretVersionRequest

Request message for SecretManagerService.GetSecretVersion.

Protobuf type google.cloud.secretmanager.v1.GetSecretVersionRequest

GetSecretVersionRequest.Builder

Request message for SecretManagerService.GetSecretVersion.

Protobuf type google.cloud.secretmanager.v1.GetSecretVersionRequest

ListSecretVersionsRequest

Request message for SecretManagerService.ListSecretVersions.

Protobuf type google.cloud.secretmanager.v1.ListSecretVersionsRequest

ListSecretVersionsRequest.Builder

Request message for SecretManagerService.ListSecretVersions.

Protobuf type google.cloud.secretmanager.v1.ListSecretVersionsRequest

ListSecretVersionsResponse

Response message for SecretManagerService.ListSecretVersions.

Protobuf type google.cloud.secretmanager.v1.ListSecretVersionsResponse

ListSecretVersionsResponse.Builder

Response message for SecretManagerService.ListSecretVersions.

Protobuf type google.cloud.secretmanager.v1.ListSecretVersionsResponse

ListSecretsRequest

Request message for SecretManagerService.ListSecrets.

Protobuf type google.cloud.secretmanager.v1.ListSecretsRequest

ListSecretsRequest.Builder

Request message for SecretManagerService.ListSecrets.

Protobuf type google.cloud.secretmanager.v1.ListSecretsRequest

ListSecretsResponse

Response message for SecretManagerService.ListSecrets.

Protobuf type google.cloud.secretmanager.v1.ListSecretsResponse

ListSecretsResponse.Builder

Response message for SecretManagerService.ListSecrets.

Protobuf type google.cloud.secretmanager.v1.ListSecretsResponse

ProjectName

ProjectName.Builder

Builder for projects/{project}.

Replication

A policy that defines the replication and encryption configuration of data.

Protobuf type google.cloud.secretmanager.v1.Replication

Replication.Automatic

A replication policy that replicates the Secret payload without any restrictions.

Protobuf type google.cloud.secretmanager.v1.Replication.Automatic

Replication.Automatic.Builder

A replication policy that replicates the Secret payload without any restrictions.

Protobuf type google.cloud.secretmanager.v1.Replication.Automatic

Replication.Builder

A policy that defines the replication and encryption configuration of data.

Protobuf type google.cloud.secretmanager.v1.Replication

Replication.UserManaged

A replication policy that replicates the Secret payload into the locations specified in [Secret.replication.user_managed.replicas][]

Protobuf type google.cloud.secretmanager.v1.Replication.UserManaged

Replication.UserManaged.Builder

A replication policy that replicates the Secret payload into the locations specified in [Secret.replication.user_managed.replicas][]

Protobuf type google.cloud.secretmanager.v1.Replication.UserManaged

Replication.UserManaged.Replica

Represents a Replica for this Secret.

Protobuf type google.cloud.secretmanager.v1.Replication.UserManaged.Replica

Replication.UserManaged.Replica.Builder

Represents a Replica for this Secret.

Protobuf type google.cloud.secretmanager.v1.Replication.UserManaged.Replica

ReplicationStatus

The replication status of a SecretVersion.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus

ReplicationStatus.AutomaticStatus

The replication status of a SecretVersion using automatic replication.

Only populated if the parent Secret has an automatic replication policy.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus.AutomaticStatus

ReplicationStatus.AutomaticStatus.Builder

The replication status of a SecretVersion using automatic replication.

Only populated if the parent Secret has an automatic replication policy.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus.AutomaticStatus

ReplicationStatus.Builder

The replication status of a SecretVersion.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus

ReplicationStatus.UserManagedStatus

The replication status of a SecretVersion using user-managed replication.

Only populated if the parent Secret has a user-managed replication policy.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus.UserManagedStatus

ReplicationStatus.UserManagedStatus.Builder

The replication status of a SecretVersion using user-managed replication.

Only populated if the parent Secret has a user-managed replication policy.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus.UserManagedStatus

ReplicationStatus.UserManagedStatus.ReplicaStatus

Describes the status of a user-managed replica for the SecretVersion.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus.UserManagedStatus.ReplicaStatus

ReplicationStatus.UserManagedStatus.ReplicaStatus.Builder

Describes the status of a user-managed replica for the SecretVersion.

Protobuf type google.cloud.secretmanager.v1.ReplicationStatus.UserManagedStatus.ReplicaStatus

ResourcesProto

Rotation

The rotation time and period for a Secret. At next_rotation_time, Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. Secret.topics must be set to configure rotation.

Protobuf type google.cloud.secretmanager.v1.Rotation

Rotation.Builder

The rotation time and period for a Secret. At next_rotation_time, Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. Secret.topics must be set to configure rotation.

Protobuf type google.cloud.secretmanager.v1.Rotation

Secret

A Secret is a logical secret whose value and versions can be accessed.

A Secret is made up of zero or more SecretVersions that represent the secret data.

Protobuf type google.cloud.secretmanager.v1.Secret

Secret.Builder

A Secret is a logical secret whose value and versions can be accessed.

A Secret is made up of zero or more SecretVersions that represent the secret data.

Protobuf type google.cloud.secretmanager.v1.Secret

SecretManagerServiceClient

Service Description: Secret Manager Service

Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

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 (SecretManagerServiceClient secretManagerServiceClient =
     SecretManagerServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   String secretId = "secretId945974251";
   Secret secret = Secret.newBuilder().build();
   Secret response = secretManagerServiceClient.createSecret(parent, secretId, secret);
 }
 

Note: close() needs to be called on the SecretManagerServiceClient 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:

  1. 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.
  2. 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.
  3. 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 SecretManagerServiceSettings 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
 SecretManagerServiceSettings secretManagerServiceSettings =
     SecretManagerServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 SecretManagerServiceClient secretManagerServiceClient =
     SecretManagerServiceClient.create(secretManagerServiceSettings);
 

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
 SecretManagerServiceSettings secretManagerServiceSettings =
     SecretManagerServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 SecretManagerServiceClient secretManagerServiceClient =
     SecretManagerServiceClient.create(secretManagerServiceSettings);
 

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
 SecretManagerServiceSettings secretManagerServiceSettings =
     SecretManagerServiceSettings.newHttpJsonBuilder().build();
 SecretManagerServiceClient secretManagerServiceClient =
     SecretManagerServiceClient.create(secretManagerServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

SecretManagerServiceClient.ListSecretVersionsFixedSizeCollection

SecretManagerServiceClient.ListSecretVersionsPage

SecretManagerServiceClient.ListSecretVersionsPagedResponse

SecretManagerServiceClient.ListSecretsFixedSizeCollection

SecretManagerServiceClient.ListSecretsPage

SecretManagerServiceClient.ListSecretsPagedResponse

SecretManagerServiceGrpc

Secret Manager Service Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

SecretManagerServiceGrpc.SecretManagerServiceBlockingStub

A stub to allow clients to do synchronous rpc calls to service SecretManagerService.

Secret Manager Service Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

SecretManagerServiceGrpc.SecretManagerServiceFutureStub

A stub to allow clients to do ListenableFuture-style rpc calls to service SecretManagerService.

Secret Manager Service Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

SecretManagerServiceGrpc.SecretManagerServiceImplBase

Base class for the server implementation of the service SecretManagerService.

Secret Manager Service Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

SecretManagerServiceGrpc.SecretManagerServiceStub

A stub to allow clients to do asynchronous rpc calls to service SecretManagerService.

Secret Manager Service Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

SecretManagerServiceSettings

Settings class to configure an instance of SecretManagerServiceClient.

The default instance has everything set to sensible defaults:

  • The default service address (secretmanager.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of createSecret to 30 seconds:


 // 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
 SecretManagerServiceSettings.Builder secretManagerServiceSettingsBuilder =
     SecretManagerServiceSettings.newBuilder();
 secretManagerServiceSettingsBuilder
     .createSecretSettings()
     .setRetrySettings(
         secretManagerServiceSettingsBuilder
             .createSecretSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 SecretManagerServiceSettings secretManagerServiceSettings =
     secretManagerServiceSettingsBuilder.build();
 

SecretManagerServiceSettings.Builder

Builder for SecretManagerServiceSettings.

SecretName

SecretName.Builder

Builder for projects/{project}/secrets/{secret}.

SecretPayload

A secret payload resource in the Secret Manager API. This contains the sensitive secret payload that is associated with a SecretVersion.

Protobuf type google.cloud.secretmanager.v1.SecretPayload

SecretPayload.Builder

A secret payload resource in the Secret Manager API. This contains the sensitive secret payload that is associated with a SecretVersion.

Protobuf type google.cloud.secretmanager.v1.SecretPayload

SecretVersion

A secret version resource in the Secret Manager API.

Protobuf type google.cloud.secretmanager.v1.SecretVersion

SecretVersion.Builder

A secret version resource in the Secret Manager API.

Protobuf type google.cloud.secretmanager.v1.SecretVersion

SecretVersionName

SecretVersionName.Builder

Builder for projects/{project}/secrets/{secret}/versions/{secret_version}.

ServiceProto

Topic

A Pub/Sub topic which Secret Manager will publish to when control plane events occur on this secret.

Protobuf type google.cloud.secretmanager.v1.Topic

Topic.Builder

A Pub/Sub topic which Secret Manager will publish to when control plane events occur on this secret.

Protobuf type google.cloud.secretmanager.v1.Topic

UpdateSecretRequest

Request message for SecretManagerService.UpdateSecret.

Protobuf type google.cloud.secretmanager.v1.UpdateSecretRequest

UpdateSecretRequest.Builder

Request message for SecretManagerService.UpdateSecret.

Protobuf type google.cloud.secretmanager.v1.UpdateSecretRequest

Interfaces

AccessSecretVersionRequestOrBuilder

AccessSecretVersionResponseOrBuilder

AddSecretVersionRequestOrBuilder

CreateSecretRequestOrBuilder

CustomerManagedEncryptionOrBuilder

CustomerManagedEncryptionStatusOrBuilder

DeleteSecretRequestOrBuilder

DestroySecretVersionRequestOrBuilder

DisableSecretVersionRequestOrBuilder

EnableSecretVersionRequestOrBuilder

GetSecretRequestOrBuilder

GetSecretVersionRequestOrBuilder

ListSecretVersionsRequestOrBuilder

ListSecretVersionsResponseOrBuilder

ListSecretsRequestOrBuilder

ListSecretsResponseOrBuilder

Replication.AutomaticOrBuilder

Replication.UserManaged.ReplicaOrBuilder

Replication.UserManagedOrBuilder

ReplicationOrBuilder

ReplicationStatus.AutomaticStatusOrBuilder

ReplicationStatus.UserManagedStatus.ReplicaStatusOrBuilder

ReplicationStatus.UserManagedStatusOrBuilder

ReplicationStatusOrBuilder

RotationOrBuilder

SecretManagerServiceGrpc.AsyncService

Secret Manager Service Manages secrets and operations using those secrets. Implements a REST model with the following objects:

  • Secret
  • SecretVersion

SecretOrBuilder

SecretPayloadOrBuilder

SecretVersionOrBuilder

TopicOrBuilder

UpdateSecretRequestOrBuilder

Enums

Replication.ReplicationCase

ReplicationStatus.ReplicationStatusCase

Secret.ExpirationCase

SecretVersion.State

The state of a SecretVersion, indicating if it can be accessed.

Protobuf enum google.cloud.secretmanager.v1.SecretVersion.State