Secret Manager v1beta2 API - Class SecretManagerServiceClient (1.0.0-beta03)

public abstract class SecretManagerServiceClient

Reference documentation and code samples for the Secret Manager v1beta2 API class SecretManagerServiceClient.

SecretManagerService client wrapper, for convenient use.

Inheritance

object > SecretManagerServiceClient

Namespace

Google.Cloud.SecretManager.V1Beta2

Assembly

Google.Cloud.SecretManager.V1Beta2.dll

Remarks

Secret Manager Service

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

  • [Secret][google.cloud.secretmanager.v1beta2.Secret]
  • [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the SecretManagerService service, which is a host of "secretmanager.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default SecretManagerService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default SecretManagerService scopes are:

GrpcClient

public virtual SecretManagerService.SecretManagerServiceClient GrpcClient { get; }

The underlying gRPC SecretManagerService client

Property Value
Type Description
SecretManagerServiceSecretManagerServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

AccessSecretVersion(AccessSecretVersionRequest, CallSettings)

public virtual AccessSecretVersionResponse AccessSecretVersion(AccessSecretVersionRequest request, CallSettings callSettings = null)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request AccessSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AccessSecretVersionResponse

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
AccessSecretVersionRequest request = new AccessSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
};
// Make the request
AccessSecretVersionResponse response = secretManagerServiceClient.AccessSecretVersion(request);

AccessSecretVersion(SecretVersionName, CallSettings)

public virtual AccessSecretVersionResponse AccessSecretVersion(SecretVersionName name, CallSettings callSettings = null)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AccessSecretVersionResponse

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
AccessSecretVersionResponse response = secretManagerServiceClient.AccessSecretVersion(name);

AccessSecretVersion(string, CallSettings)

public virtual AccessSecretVersionResponse AccessSecretVersion(string name, CallSettings callSettings = null)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AccessSecretVersionResponse

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
AccessSecretVersionResponse response = secretManagerServiceClient.AccessSecretVersion(name);

AccessSecretVersionAsync(AccessSecretVersionRequest, CallSettings)

public virtual Task<AccessSecretVersionResponse> AccessSecretVersionAsync(AccessSecretVersionRequest request, CallSettings callSettings = null)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request AccessSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAccessSecretVersionResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
AccessSecretVersionRequest request = new AccessSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
};
// Make the request
AccessSecretVersionResponse response = await secretManagerServiceClient.AccessSecretVersionAsync(request);

AccessSecretVersionAsync(AccessSecretVersionRequest, CancellationToken)

public virtual Task<AccessSecretVersionResponse> AccessSecretVersionAsync(AccessSecretVersionRequest request, CancellationToken cancellationToken)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request AccessSecretVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAccessSecretVersionResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
AccessSecretVersionRequest request = new AccessSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
};
// Make the request
AccessSecretVersionResponse response = await secretManagerServiceClient.AccessSecretVersionAsync(request);

AccessSecretVersionAsync(SecretVersionName, CallSettings)

public virtual Task<AccessSecretVersionResponse> AccessSecretVersionAsync(SecretVersionName name, CallSettings callSettings = null)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAccessSecretVersionResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
AccessSecretVersionResponse response = await secretManagerServiceClient.AccessSecretVersionAsync(name);

AccessSecretVersionAsync(SecretVersionName, CancellationToken)

public virtual Task<AccessSecretVersionResponse> AccessSecretVersionAsync(SecretVersionName name, CancellationToken cancellationToken)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAccessSecretVersionResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
AccessSecretVersionResponse response = await secretManagerServiceClient.AccessSecretVersionAsync(name);

AccessSecretVersionAsync(string, CallSettings)

public virtual Task<AccessSecretVersionResponse> AccessSecretVersionAsync(string name, CallSettings callSettings = null)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAccessSecretVersionResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
AccessSecretVersionResponse response = await secretManagerServiceClient.AccessSecretVersionAsync(name);

AccessSecretVersionAsync(string, CancellationToken)

public virtual Task<AccessSecretVersionResponse> AccessSecretVersionAsync(string name, CancellationToken cancellationToken)

Accesses a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion]. This call returns the secret data.

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAccessSecretVersionResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
AccessSecretVersionResponse response = await secretManagerServiceClient.AccessSecretVersionAsync(name);

AddSecretVersion(AddSecretVersionRequest, CallSettings)

public virtual SecretVersion AddSecretVersion(AddSecretVersionRequest request, CallSettings callSettings = null)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request AddSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
AddSecretVersionRequest request = new AddSecretVersionRequest
{
    ParentAsSecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Payload = new SecretPayload(),
};
// Make the request
SecretVersion response = secretManagerServiceClient.AddSecretVersion(request);

AddSecretVersion(SecretName, SecretPayload, CallSettings)

public virtual SecretVersion AddSecretVersion(SecretName parent, SecretPayload payload, CallSettings callSettings = null)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to associate with the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

payload SecretPayload

Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretName parent = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
SecretPayload payload = new SecretPayload();
// Make the request
SecretVersion response = secretManagerServiceClient.AddSecretVersion(parent, payload);

AddSecretVersion(string, SecretPayload, CallSettings)

public virtual SecretVersion AddSecretVersion(string parent, SecretPayload payload, CallSettings callSettings = null)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to associate with the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

payload SecretPayload

Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/secrets/[SECRET]";
SecretPayload payload = new SecretPayload();
// Make the request
SecretVersion response = secretManagerServiceClient.AddSecretVersion(parent, payload);

AddSecretVersionAsync(AddSecretVersionRequest, CallSettings)

public virtual Task<SecretVersion> AddSecretVersionAsync(AddSecretVersionRequest request, CallSettings callSettings = null)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request AddSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
AddSecretVersionRequest request = new AddSecretVersionRequest
{
    ParentAsSecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Payload = new SecretPayload(),
};
// Make the request
SecretVersion response = await secretManagerServiceClient.AddSecretVersionAsync(request);

AddSecretVersionAsync(AddSecretVersionRequest, CancellationToken)

public virtual Task<SecretVersion> AddSecretVersionAsync(AddSecretVersionRequest request, CancellationToken cancellationToken)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request AddSecretVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
AddSecretVersionRequest request = new AddSecretVersionRequest
{
    ParentAsSecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Payload = new SecretPayload(),
};
// Make the request
SecretVersion response = await secretManagerServiceClient.AddSecretVersionAsync(request);

AddSecretVersionAsync(SecretName, SecretPayload, CallSettings)

public virtual Task<SecretVersion> AddSecretVersionAsync(SecretName parent, SecretPayload payload, CallSettings callSettings = null)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to associate with the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

payload SecretPayload

Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretName parent = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
SecretPayload payload = new SecretPayload();
// Make the request
SecretVersion response = await secretManagerServiceClient.AddSecretVersionAsync(parent, payload);

AddSecretVersionAsync(SecretName, SecretPayload, CancellationToken)

public virtual Task<SecretVersion> AddSecretVersionAsync(SecretName parent, SecretPayload payload, CancellationToken cancellationToken)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to associate with the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

payload SecretPayload

Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretName parent = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
SecretPayload payload = new SecretPayload();
// Make the request
SecretVersion response = await secretManagerServiceClient.AddSecretVersionAsync(parent, payload);

AddSecretVersionAsync(string, SecretPayload, CallSettings)

public virtual Task<SecretVersion> AddSecretVersionAsync(string parent, SecretPayload payload, CallSettings callSettings = null)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to associate with the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

payload SecretPayload

Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/secrets/[SECRET]";
SecretPayload payload = new SecretPayload();
// Make the request
SecretVersion response = await secretManagerServiceClient.AddSecretVersionAsync(parent, payload);

AddSecretVersionAsync(string, SecretPayload, CancellationToken)

public virtual Task<SecretVersion> AddSecretVersionAsync(string parent, SecretPayload payload, CancellationToken cancellationToken)

Creates a new [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to associate with the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

payload SecretPayload

Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/secrets/[SECRET]";
SecretPayload payload = new SecretPayload();
// Make the request
SecretVersion response = await secretManagerServiceClient.AddSecretVersionAsync(parent, payload);

Create()

public static SecretManagerServiceClient Create()

Synchronously creates a SecretManagerServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use SecretManagerServiceClientBuilder.

Returns
Type Description
SecretManagerServiceClient

The created SecretManagerServiceClient.

CreateAsync(CancellationToken)

public static Task<SecretManagerServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a SecretManagerServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use SecretManagerServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskSecretManagerServiceClient

The task representing the created SecretManagerServiceClient.

CreateSecret(LocationName, string, Secret, CallSettings)

public virtual Secret CreateSecret(LocationName parent, string secretId, Secret secret, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent LocationName

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = secretManagerServiceClient.CreateSecret(parent, secretId, secret);

CreateSecret(ProjectName, string, Secret, CallSettings)

public virtual Secret CreateSecret(ProjectName parent, string secretId, Secret secret, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent ProjectName

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = secretManagerServiceClient.CreateSecret(parent, secretId, secret);

CreateSecret(CreateSecretRequest, CallSettings)

public virtual Secret CreateSecret(CreateSecretRequest request, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request CreateSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
CreateSecretRequest request = new CreateSecretRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    SecretId = "",
    Secret = new Secret(),
};
// Make the request
Secret response = secretManagerServiceClient.CreateSecret(request);

CreateSecret(string, string, Secret, CallSettings)

public virtual Secret CreateSecret(string parent, string secretId, Secret secret, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent string

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = secretManagerServiceClient.CreateSecret(parent, secretId, secret);

CreateSecretAsync(LocationName, string, Secret, CallSettings)

public virtual Task<Secret> CreateSecretAsync(LocationName parent, string secretId, Secret secret, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent LocationName

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(parent, secretId, secret);

CreateSecretAsync(LocationName, string, Secret, CancellationToken)

public virtual Task<Secret> CreateSecretAsync(LocationName parent, string secretId, Secret secret, CancellationToken cancellationToken)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent LocationName

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(parent, secretId, secret);

CreateSecretAsync(ProjectName, string, Secret, CallSettings)

public virtual Task<Secret> CreateSecretAsync(ProjectName parent, string secretId, Secret secret, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent ProjectName

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(parent, secretId, secret);

CreateSecretAsync(ProjectName, string, Secret, CancellationToken)

public virtual Task<Secret> CreateSecretAsync(ProjectName parent, string secretId, Secret secret, CancellationToken cancellationToken)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent ProjectName

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(parent, secretId, secret);

CreateSecretAsync(CreateSecretRequest, CallSettings)

public virtual Task<Secret> CreateSecretAsync(CreateSecretRequest request, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request CreateSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateSecretRequest request = new CreateSecretRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    SecretId = "",
    Secret = new Secret(),
};
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(request);

CreateSecretAsync(CreateSecretRequest, CancellationToken)

public virtual Task<Secret> CreateSecretAsync(CreateSecretRequest request, CancellationToken cancellationToken)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request CreateSecretRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateSecretRequest request = new CreateSecretRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    SecretId = "",
    Secret = new Secret(),
};
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(request);

CreateSecretAsync(string, string, Secret, CallSettings)

public virtual Task<Secret> CreateSecretAsync(string parent, string secretId, Secret secret, CallSettings callSettings = null)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent string

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(parent, secretId, secret);

CreateSecretAsync(string, string, Secret, CancellationToken)

public virtual Task<Secret> CreateSecretAsync(string parent, string secretId, Secret secret, CancellationToken cancellationToken)

Creates a new [Secret][google.cloud.secretmanager.v1beta2.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
parent string

Required. The resource name of the project to associate with the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*.

secretId string

Required. This must be unique within the project.

A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

secret Secret

Required. A [Secret][google.cloud.secretmanager.v1beta2.Secret] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
string secretId = "";
Secret secret = new Secret();
// Make the request
Secret response = await secretManagerServiceClient.CreateSecretAsync(parent, secretId, secret);

DeleteSecret(DeleteSecretRequest, CallSettings)

public virtual void DeleteSecret(DeleteSecretRequest request, CallSettings callSettings = null)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request DeleteSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
DeleteSecretRequest request = new DeleteSecretRequest
{
    SecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Etag = "",
};
// Make the request
secretManagerServiceClient.DeleteSecret(request);

DeleteSecret(SecretName, CallSettings)

public virtual void DeleteSecret(SecretName name, CallSettings callSettings = null)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to delete in the format projects/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretName name = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
secretManagerServiceClient.DeleteSecret(name);

DeleteSecret(string, CallSettings)

public virtual void DeleteSecret(string name, CallSettings callSettings = null)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to delete in the format projects/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
secretManagerServiceClient.DeleteSecret(name);

DeleteSecretAsync(DeleteSecretRequest, CallSettings)

public virtual Task DeleteSecretAsync(DeleteSecretRequest request, CallSettings callSettings = null)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request DeleteSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteSecretRequest request = new DeleteSecretRequest
{
    SecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Etag = "",
};
// Make the request
await secretManagerServiceClient.DeleteSecretAsync(request);

DeleteSecretAsync(DeleteSecretRequest, CancellationToken)

public virtual Task DeleteSecretAsync(DeleteSecretRequest request, CancellationToken cancellationToken)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request DeleteSecretRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteSecretRequest request = new DeleteSecretRequest
{
    SecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Etag = "",
};
// Make the request
await secretManagerServiceClient.DeleteSecretAsync(request);

DeleteSecretAsync(SecretName, CallSettings)

public virtual Task DeleteSecretAsync(SecretName name, CallSettings callSettings = null)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to delete in the format projects/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretName name = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
await secretManagerServiceClient.DeleteSecretAsync(name);

DeleteSecretAsync(SecretName, CancellationToken)

public virtual Task DeleteSecretAsync(SecretName name, CancellationToken cancellationToken)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to delete in the format projects/*/secrets/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretName name = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
await secretManagerServiceClient.DeleteSecretAsync(name);

DeleteSecretAsync(string, CallSettings)

public virtual Task DeleteSecretAsync(string name, CallSettings callSettings = null)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to delete in the format projects/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
await secretManagerServiceClient.DeleteSecretAsync(name);

DeleteSecretAsync(string, CancellationToken)

public virtual Task DeleteSecretAsync(string name, CancellationToken cancellationToken)

Deletes a [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] to delete in the format projects/*/secrets/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
await secretManagerServiceClient.DeleteSecretAsync(name);

DestroySecretVersion(DestroySecretVersionRequest, CallSettings)

public virtual SecretVersion DestroySecretVersion(DestroySecretVersionRequest request, CallSettings callSettings = null)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
request DestroySecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
DestroySecretVersionRequest request = new DestroySecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = secretManagerServiceClient.DestroySecretVersion(request);

DestroySecretVersion(SecretVersionName, CallSettings)

public virtual SecretVersion DestroySecretVersion(SecretVersionName name, CallSettings callSettings = null)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to destroy in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = secretManagerServiceClient.DestroySecretVersion(name);

DestroySecretVersion(string, CallSettings)

public virtual SecretVersion DestroySecretVersion(string name, CallSettings callSettings = null)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to destroy in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = secretManagerServiceClient.DestroySecretVersion(name);

DestroySecretVersionAsync(DestroySecretVersionRequest, CallSettings)

public virtual Task<SecretVersion> DestroySecretVersionAsync(DestroySecretVersionRequest request, CallSettings callSettings = null)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
request DestroySecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
DestroySecretVersionRequest request = new DestroySecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = await secretManagerServiceClient.DestroySecretVersionAsync(request);

DestroySecretVersionAsync(DestroySecretVersionRequest, CancellationToken)

public virtual Task<SecretVersion> DestroySecretVersionAsync(DestroySecretVersionRequest request, CancellationToken cancellationToken)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
request DestroySecretVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
DestroySecretVersionRequest request = new DestroySecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = await secretManagerServiceClient.DestroySecretVersionAsync(request);

DestroySecretVersionAsync(SecretVersionName, CallSettings)

public virtual Task<SecretVersion> DestroySecretVersionAsync(SecretVersionName name, CallSettings callSettings = null)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to destroy in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.DestroySecretVersionAsync(name);

DestroySecretVersionAsync(SecretVersionName, CancellationToken)

public virtual Task<SecretVersion> DestroySecretVersionAsync(SecretVersionName name, CancellationToken cancellationToken)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to destroy in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.DestroySecretVersionAsync(name);

DestroySecretVersionAsync(string, CallSettings)

public virtual Task<SecretVersion> DestroySecretVersionAsync(string name, CallSettings callSettings = null)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to destroy in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.DestroySecretVersionAsync(name);

DestroySecretVersionAsync(string, CancellationToken)

public virtual Task<SecretVersion> DestroySecretVersionAsync(string name, CancellationToken cancellationToken)

Destroys a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to destroy in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.DestroySecretVersionAsync(name);

DisableSecretVersion(DisableSecretVersionRequest, CallSettings)

public virtual SecretVersion DisableSecretVersion(DisableSecretVersionRequest request, CallSettings callSettings = null)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
request DisableSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
DisableSecretVersionRequest request = new DisableSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = secretManagerServiceClient.DisableSecretVersion(request);

DisableSecretVersion(SecretVersionName, CallSettings)

public virtual SecretVersion DisableSecretVersion(SecretVersionName name, CallSettings callSettings = null)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to disable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = secretManagerServiceClient.DisableSecretVersion(name);

DisableSecretVersion(string, CallSettings)

public virtual SecretVersion DisableSecretVersion(string name, CallSettings callSettings = null)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to disable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = secretManagerServiceClient.DisableSecretVersion(name);

DisableSecretVersionAsync(DisableSecretVersionRequest, CallSettings)

public virtual Task<SecretVersion> DisableSecretVersionAsync(DisableSecretVersionRequest request, CallSettings callSettings = null)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
request DisableSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
DisableSecretVersionRequest request = new DisableSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = await secretManagerServiceClient.DisableSecretVersionAsync(request);

DisableSecretVersionAsync(DisableSecretVersionRequest, CancellationToken)

public virtual Task<SecretVersion> DisableSecretVersionAsync(DisableSecretVersionRequest request, CancellationToken cancellationToken)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
request DisableSecretVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
DisableSecretVersionRequest request = new DisableSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = await secretManagerServiceClient.DisableSecretVersionAsync(request);

DisableSecretVersionAsync(SecretVersionName, CallSettings)

public virtual Task<SecretVersion> DisableSecretVersionAsync(SecretVersionName name, CallSettings callSettings = null)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to disable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.DisableSecretVersionAsync(name);

DisableSecretVersionAsync(SecretVersionName, CancellationToken)

public virtual Task<SecretVersion> DisableSecretVersionAsync(SecretVersionName name, CancellationToken cancellationToken)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to disable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.DisableSecretVersionAsync(name);

DisableSecretVersionAsync(string, CallSettings)

public virtual Task<SecretVersion> DisableSecretVersionAsync(string name, CallSettings callSettings = null)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to disable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.DisableSecretVersionAsync(name);

DisableSecretVersionAsync(string, CancellationToken)

public virtual Task<SecretVersion> DisableSecretVersionAsync(string name, CancellationToken cancellationToken)

Disables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.DISABLED].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to disable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.DisableSecretVersionAsync(name);

EnableSecretVersion(EnableSecretVersionRequest, CallSettings)

public virtual SecretVersion EnableSecretVersion(EnableSecretVersionRequest request, CallSettings callSettings = null)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
request EnableSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
EnableSecretVersionRequest request = new EnableSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = secretManagerServiceClient.EnableSecretVersion(request);

EnableSecretVersion(SecretVersionName, CallSettings)

public virtual SecretVersion EnableSecretVersion(SecretVersionName name, CallSettings callSettings = null)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to enable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = secretManagerServiceClient.EnableSecretVersion(name);

EnableSecretVersion(string, CallSettings)

public virtual SecretVersion EnableSecretVersion(string name, CallSettings callSettings = null)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to enable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = secretManagerServiceClient.EnableSecretVersion(name);

EnableSecretVersionAsync(EnableSecretVersionRequest, CallSettings)

public virtual Task<SecretVersion> EnableSecretVersionAsync(EnableSecretVersionRequest request, CallSettings callSettings = null)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
request EnableSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
EnableSecretVersionRequest request = new EnableSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = await secretManagerServiceClient.EnableSecretVersionAsync(request);

EnableSecretVersionAsync(EnableSecretVersionRequest, CancellationToken)

public virtual Task<SecretVersion> EnableSecretVersionAsync(EnableSecretVersionRequest request, CancellationToken cancellationToken)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
request EnableSecretVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
EnableSecretVersionRequest request = new EnableSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
    Etag = "",
};
// Make the request
SecretVersion response = await secretManagerServiceClient.EnableSecretVersionAsync(request);

EnableSecretVersionAsync(SecretVersionName, CallSettings)

public virtual Task<SecretVersion> EnableSecretVersionAsync(SecretVersionName name, CallSettings callSettings = null)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to enable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.EnableSecretVersionAsync(name);

EnableSecretVersionAsync(SecretVersionName, CancellationToken)

public virtual Task<SecretVersion> EnableSecretVersionAsync(SecretVersionName name, CancellationToken cancellationToken)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to enable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.EnableSecretVersionAsync(name);

EnableSecretVersionAsync(string, CallSettings)

public virtual Task<SecretVersion> EnableSecretVersionAsync(string name, CallSettings callSettings = null)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to enable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.EnableSecretVersionAsync(name);

EnableSecretVersionAsync(string, CancellationToken)

public virtual Task<SecretVersion> EnableSecretVersionAsync(string name, CancellationToken cancellationToken)

Enables a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Sets the [state][google.cloud.secretmanager.v1beta2.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1beta2.SecretVersion.State.ENABLED].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] to enable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.EnableSecretVersionAsync(name);

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public virtual Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.

Parameters
Name Description
request GetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
GetIamPolicyRequest request = new GetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Options = new GetPolicyOptions(),
};
// Make the request
Policy response = secretManagerServiceClient.GetIamPolicy(request);

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.

Parameters
Name Description
request GetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
GetIamPolicyRequest request = new GetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Options = new GetPolicyOptions(),
};
// Make the request
Policy response = await secretManagerServiceClient.GetIamPolicyAsync(request);

GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CancellationToken cancellationToken)

Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.

Parameters
Name Description
request GetIamPolicyRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
GetIamPolicyRequest request = new GetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Options = new GetPolicyOptions(),
};
// Make the request
Policy response = await secretManagerServiceClient.GetIamPolicyAsync(request);

GetSecret(GetSecretRequest, CallSettings)

public virtual Secret GetSecret(GetSecretRequest request, CallSettings callSettings = null)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request GetSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
GetSecretRequest request = new GetSecretRequest
{
    SecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
};
// Make the request
Secret response = secretManagerServiceClient.GetSecret(request);

GetSecret(SecretName, CallSettings)

public virtual Secret GetSecret(SecretName name, CallSettings callSettings = null)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretName name = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
Secret response = secretManagerServiceClient.GetSecret(name);

GetSecret(string, CallSettings)

public virtual Secret GetSecret(string name, CallSettings callSettings = null)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
Secret response = secretManagerServiceClient.GetSecret(name);

GetSecretAsync(GetSecretRequest, CallSettings)

public virtual Task<Secret> GetSecretAsync(GetSecretRequest request, CallSettings callSettings = null)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request GetSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
GetSecretRequest request = new GetSecretRequest
{
    SecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
};
// Make the request
Secret response = await secretManagerServiceClient.GetSecretAsync(request);

GetSecretAsync(GetSecretRequest, CancellationToken)

public virtual Task<Secret> GetSecretAsync(GetSecretRequest request, CancellationToken cancellationToken)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request GetSecretRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
GetSecretRequest request = new GetSecretRequest
{
    SecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
};
// Make the request
Secret response = await secretManagerServiceClient.GetSecretAsync(request);

GetSecretAsync(SecretName, CallSettings)

public virtual Task<Secret> GetSecretAsync(SecretName name, CallSettings callSettings = null)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretName name = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
Secret response = await secretManagerServiceClient.GetSecretAsync(name);

GetSecretAsync(SecretName, CancellationToken)

public virtual Task<Secret> GetSecretAsync(SecretName name, CancellationToken cancellationToken)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretName name = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
Secret response = await secretManagerServiceClient.GetSecretAsync(name);

GetSecretAsync(string, CallSettings)

public virtual Task<Secret> GetSecretAsync(string name, CallSettings callSettings = null)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
Secret response = await secretManagerServiceClient.GetSecretAsync(name);

GetSecretAsync(string, CancellationToken)

public virtual Task<Secret> GetSecretAsync(string name, CancellationToken cancellationToken)

Gets metadata for a given [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
name string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret], in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
Secret response = await secretManagerServiceClient.GetSecretAsync(name);

GetSecretVersion(GetSecretVersionRequest, CallSettings)

public virtual SecretVersion GetSecretVersion(GetSecretVersionRequest request, CallSettings callSettings = null)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request GetSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
GetSecretVersionRequest request = new GetSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
};
// Make the request
SecretVersion response = secretManagerServiceClient.GetSecretVersion(request);

GetSecretVersion(SecretVersionName, CallSettings)

public virtual SecretVersion GetSecretVersion(SecretVersionName name, CallSettings callSettings = null)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = secretManagerServiceClient.GetSecretVersion(name);

GetSecretVersion(string, CallSettings)

public virtual SecretVersion GetSecretVersion(string name, CallSettings callSettings = null)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SecretVersion

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = secretManagerServiceClient.GetSecretVersion(name);

GetSecretVersionAsync(GetSecretVersionRequest, CallSettings)

public virtual Task<SecretVersion> GetSecretVersionAsync(GetSecretVersionRequest request, CallSettings callSettings = null)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request GetSecretVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
GetSecretVersionRequest request = new GetSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
};
// Make the request
SecretVersion response = await secretManagerServiceClient.GetSecretVersionAsync(request);

GetSecretVersionAsync(GetSecretVersionRequest, CancellationToken)

public virtual Task<SecretVersion> GetSecretVersionAsync(GetSecretVersionRequest request, CancellationToken cancellationToken)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
request GetSecretVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
GetSecretVersionRequest request = new GetSecretVersionRequest
{
    SecretVersionName = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]"),
};
// Make the request
SecretVersion response = await secretManagerServiceClient.GetSecretVersionAsync(request);

GetSecretVersionAsync(SecretVersionName, CallSettings)

public virtual Task<SecretVersion> GetSecretVersionAsync(SecretVersionName name, CallSettings callSettings = null)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.GetSecretVersionAsync(name);

GetSecretVersionAsync(SecretVersionName, CancellationToken)

public virtual Task<SecretVersion> GetSecretVersionAsync(SecretVersionName name, CancellationToken cancellationToken)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name SecretVersionName

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretVersionName name = SecretVersionName.FromProjectSecretSecretVersion("[PROJECT]", "[SECRET]", "[SECRET_VERSION]");
// Make the request
SecretVersion response = await secretManagerServiceClient.GetSecretVersionAsync(name);

GetSecretVersionAsync(string, CallSettings)

public virtual Task<SecretVersion> GetSecretVersionAsync(string name, CallSettings callSettings = null)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.GetSecretVersionAsync(name);

GetSecretVersionAsync(string, CancellationToken)

public virtual Task<SecretVersion> GetSecretVersionAsync(string name, CancellationToken cancellationToken)

Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

projects/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

Parameters
Name Description
name string

Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion] in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1beta2.SecretVersion].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecretVersion

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/secrets/[SECRET]/versions/[SECRET_VERSION]";
// Make the request
SecretVersion response = await secretManagerServiceClient.GetSecretVersionAsync(name);

ListSecretVersions(ListSecretVersionsRequest, CallSettings)

public virtual PagedEnumerable<ListSecretVersionsResponse, SecretVersion> ListSecretVersions(ListSecretVersionsRequest request, CallSettings callSettings = null)

Lists [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion]. This call does not return secret data.

Parameters
Name Description
request ListSecretVersionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSecretVersionsResponseSecretVersion

A pageable sequence of SecretVersion resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
ListSecretVersionsRequest request = new ListSecretVersionsRequest
{
    ParentAsSecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Filter = "",
};
// Make the request
PagedEnumerable<ListSecretVersionsResponse, SecretVersion> response = secretManagerServiceClient.ListSecretVersions(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (SecretVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSecretVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SecretVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SecretVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SecretVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretVersions(SecretName, string, int?, CallSettings)

public virtual PagedEnumerable<ListSecretVersionsResponse, SecretVersion> ListSecretVersions(SecretName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion]. This call does not return secret data.

Parameters
Name Description
parent SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] associated with the [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion] to list, in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSecretVersionsResponseSecretVersion

A pageable sequence of SecretVersion resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SecretName parent = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
PagedEnumerable<ListSecretVersionsResponse, SecretVersion> response = secretManagerServiceClient.ListSecretVersions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (SecretVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSecretVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SecretVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SecretVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SecretVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretVersions(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListSecretVersionsResponse, SecretVersion> ListSecretVersions(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion]. This call does not return secret data.

Parameters
Name Description
parent string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] associated with the [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion] to list, in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSecretVersionsResponseSecretVersion

A pageable sequence of SecretVersion resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
PagedEnumerable<ListSecretVersionsResponse, SecretVersion> response = secretManagerServiceClient.ListSecretVersions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (SecretVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSecretVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SecretVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SecretVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SecretVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretVersionsAsync(ListSecretVersionsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListSecretVersionsResponse, SecretVersion> ListSecretVersionsAsync(ListSecretVersionsRequest request, CallSettings callSettings = null)

Lists [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion]. This call does not return secret data.

Parameters
Name Description
request ListSecretVersionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSecretVersionsResponseSecretVersion

A pageable asynchronous sequence of SecretVersion resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
ListSecretVersionsRequest request = new ListSecretVersionsRequest
{
    ParentAsSecretName = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]"),
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListSecretVersionsResponse, SecretVersion> response = secretManagerServiceClient.ListSecretVersionsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((SecretVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSecretVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SecretVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SecretVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SecretVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretVersionsAsync(SecretName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSecretVersionsResponse, SecretVersion> ListSecretVersionsAsync(SecretName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion]. This call does not return secret data.

Parameters
Name Description
parent SecretName

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] associated with the [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion] to list, in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSecretVersionsResponseSecretVersion

A pageable asynchronous sequence of SecretVersion resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SecretName parent = SecretName.FromProjectSecret("[PROJECT]", "[SECRET]");
// Make the request
PagedAsyncEnumerable<ListSecretVersionsResponse, SecretVersion> response = secretManagerServiceClient.ListSecretVersionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((SecretVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSecretVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SecretVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SecretVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SecretVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretVersionsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSecretVersionsResponse, SecretVersion> ListSecretVersionsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion]. This call does not return secret data.

Parameters
Name Description
parent string

Required. The resource name of the [Secret][google.cloud.secretmanager.v1beta2.Secret] associated with the [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion] to list, in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSecretVersionsResponseSecretVersion

A pageable asynchronous sequence of SecretVersion resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/secrets/[SECRET]";
// Make the request
PagedAsyncEnumerable<ListSecretVersionsResponse, SecretVersion> response = secretManagerServiceClient.ListSecretVersionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((SecretVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSecretVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SecretVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SecretVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SecretVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecrets(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListSecretsResponse, Secret> ListSecrets(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent LocationName

Required. The resource name of the project associated with the [Secrets][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSecretsResponseSecret

A pageable sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecrets(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Secret item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSecretsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecrets(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListSecretsResponse, Secret> ListSecrets(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent ProjectName

Required. The resource name of the project associated with the [Secrets][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSecretsResponseSecret

A pageable sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecrets(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Secret item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSecretsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecrets(ListSecretsRequest, CallSettings)

public virtual PagedEnumerable<ListSecretsResponse, Secret> ListSecrets(ListSecretsRequest request, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request ListSecretsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSecretsResponseSecret

A pageable sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
ListSecretsRequest request = new ListSecretsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Filter = "",
};
// Make the request
PagedEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecrets(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Secret item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSecretsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecrets(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListSecretsResponse, Secret> ListSecrets(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent string

Required. The resource name of the project associated with the [Secrets][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSecretsResponseSecret

A pageable sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecrets(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Secret item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSecretsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSecretsResponse, Secret> ListSecretsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent LocationName

Required. The resource name of the project associated with the [Secrets][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSecretsResponseSecret

A pageable asynchronous sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecretsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Secret item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSecretsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretsAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSecretsResponse, Secret> ListSecretsAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent ProjectName

Required. The resource name of the project associated with the [Secrets][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSecretsResponseSecret

A pageable asynchronous sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecretsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Secret item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSecretsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretsAsync(ListSecretsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListSecretsResponse, Secret> ListSecretsAsync(ListSecretsRequest request, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request ListSecretsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSecretsResponseSecret

A pageable asynchronous sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
ListSecretsRequest request = new ListSecretsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecretsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Secret item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSecretsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSecretsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSecretsResponse, Secret> ListSecretsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [Secrets][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
parent string

Required. The resource name of the project associated with the [Secrets][google.cloud.secretmanager.v1beta2.Secret], in the format projects/* or projects/*/locations/*

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSecretsResponseSecret

A pageable asynchronous sequence of Secret resources.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListSecretsResponse, Secret> response = secretManagerServiceClient.ListSecretsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Secret item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSecretsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Secret item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Secret> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Secret item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public virtual Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on the specified secret. Replaces any existing policy.

Permissions on [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion] are enforced according to the policy set on the associated [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request SetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
SetIamPolicyRequest request = new SetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Policy = new Policy(),
    UpdateMask = new FieldMask(),
};
// Make the request
Policy response = secretManagerServiceClient.SetIamPolicy(request);

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on the specified secret. Replaces any existing policy.

Permissions on [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion] are enforced according to the policy set on the associated [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request SetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SetIamPolicyRequest request = new SetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Policy = new Policy(),
    UpdateMask = new FieldMask(),
};
// Make the request
Policy response = await secretManagerServiceClient.SetIamPolicyAsync(request);

SetIamPolicyAsync(SetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CancellationToken cancellationToken)

Sets the access control policy on the specified secret. Replaces any existing policy.

Permissions on [SecretVersions][google.cloud.secretmanager.v1beta2.SecretVersion] are enforced according to the policy set on the associated [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request SetIamPolicyRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
SetIamPolicyRequest request = new SetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Policy = new Policy(),
    UpdateMask = new FieldMask(),
};
// Make the request
Policy response = await secretManagerServiceClient.SetIamPolicyAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TestIamPermissionsResponse

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
TestIamPermissionsRequest request = new TestIamPermissionsRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Permissions = { "", },
};
// Make the request
TestIamPermissionsResponse response = secretManagerServiceClient.TestIamPermissions(request);

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
TestIamPermissionsRequest request = new TestIamPermissionsRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Permissions = { "", },
};
// Make the request
TestIamPermissionsResponse response = await secretManagerServiceClient.TestIamPermissionsAsync(request);

TestIamPermissionsAsync(TestIamPermissionsRequest, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CancellationToken cancellationToken)

Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
TestIamPermissionsRequest request = new TestIamPermissionsRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Permissions = { "", },
};
// Make the request
TestIamPermissionsResponse response = await secretManagerServiceClient.TestIamPermissionsAsync(request);

UpdateSecret(Secret, FieldMask, CallSettings)

public virtual Secret UpdateSecret(Secret secret, FieldMask updateMask, CallSettings callSettings = null)

Updates metadata of an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
secret Secret

Required. [Secret][google.cloud.secretmanager.v1beta2.Secret] with updated field values.

updateMask FieldMask

Required. Specifies the fields to be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
Secret secret = new Secret();
FieldMask updateMask = new FieldMask();
// Make the request
Secret response = secretManagerServiceClient.UpdateSecret(secret, updateMask);

UpdateSecret(UpdateSecretRequest, CallSettings)

public virtual Secret UpdateSecret(UpdateSecretRequest request, CallSettings callSettings = null)

Updates metadata of an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request UpdateSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Secret

The RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = SecretManagerServiceClient.Create();
// Initialize request argument(s)
UpdateSecretRequest request = new UpdateSecretRequest
{
    Secret = new Secret(),
    UpdateMask = new FieldMask(),
};
// Make the request
Secret response = secretManagerServiceClient.UpdateSecret(request);

UpdateSecretAsync(Secret, FieldMask, CallSettings)

public virtual Task<Secret> UpdateSecretAsync(Secret secret, FieldMask updateMask, CallSettings callSettings = null)

Updates metadata of an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
secret Secret

Required. [Secret][google.cloud.secretmanager.v1beta2.Secret] with updated field values.

updateMask FieldMask

Required. Specifies the fields to be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
Secret secret = new Secret();
FieldMask updateMask = new FieldMask();
// Make the request
Secret response = await secretManagerServiceClient.UpdateSecretAsync(secret, updateMask);

UpdateSecretAsync(Secret, FieldMask, CancellationToken)

public virtual Task<Secret> UpdateSecretAsync(Secret secret, FieldMask updateMask, CancellationToken cancellationToken)

Updates metadata of an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
secret Secret

Required. [Secret][google.cloud.secretmanager.v1beta2.Secret] with updated field values.

updateMask FieldMask

Required. Specifies the fields to be updated.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
Secret secret = new Secret();
FieldMask updateMask = new FieldMask();
// Make the request
Secret response = await secretManagerServiceClient.UpdateSecretAsync(secret, updateMask);

UpdateSecretAsync(UpdateSecretRequest, CallSettings)

public virtual Task<Secret> UpdateSecretAsync(UpdateSecretRequest request, CallSettings callSettings = null)

Updates metadata of an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request UpdateSecretRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateSecretRequest request = new UpdateSecretRequest
{
    Secret = new Secret(),
    UpdateMask = new FieldMask(),
};
// Make the request
Secret response = await secretManagerServiceClient.UpdateSecretAsync(request);

UpdateSecretAsync(UpdateSecretRequest, CancellationToken)

public virtual Task<Secret> UpdateSecretAsync(UpdateSecretRequest request, CancellationToken cancellationToken)

Updates metadata of an existing [Secret][google.cloud.secretmanager.v1beta2.Secret].

Parameters
Name Description
request UpdateSecretRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSecret

A Task containing the RPC response.

Example
// Create client
SecretManagerServiceClient secretManagerServiceClient = await SecretManagerServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateSecretRequest request = new UpdateSecretRequest
{
    Secret = new Secret(),
    UpdateMask = new FieldMask(),
};
// Make the request
Secret response = await secretManagerServiceClient.UpdateSecretAsync(request);