Secret Manager v1 API - Class SecretOperationsServiceClient (3.1.0)

public abstract class SecretOperationsServiceClient

Reference documentation and code samples for the Secret Manager v1 API class SecretOperationsServiceClient.

SecretOperationsService client wrapper, for convenient use.

Inheritance

object > SecretOperationsServiceClient

Namespace

Google.Cloud.SecretManager.V1

Assembly

Google.Cloud.SecretManager.V1.dll

Remarks

Secret Operations Service

Manages backups of secrets. Implements a REST model with the following objects:

  • [Backup][google.cloud.secretmanager.v1.Backup]

Note: SecretOperationsService is a regional service and must be called using regional endpoints (secretmanager.{location}.rep.googleapis.com).

Properties

CreateBackupOperationsClient

public virtual OperationsClient CreateBackupOperationsClient { get; }

The long-running operations client for CreateBackup.

Property Value
Type Description
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the SecretOperationsService 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 SecretOperationsService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default SecretOperationsService scopes are:

DeleteBackupOperationsClient

public virtual OperationsClient DeleteBackupOperationsClient { get; }

The long-running operations client for DeleteBackup.

Property Value
Type Description
OperationsClient

GrpcClient

public virtual SecretOperationsService.SecretOperationsServiceClient GrpcClient { get; }

The underlying gRPC SecretOperationsService client

Property Value
Type Description
SecretOperationsServiceSecretOperationsServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

RestoreBackupOperationsClient

public virtual OperationsClient RestoreBackupOperationsClient { get; }

The long-running operations client for RestoreBackup.

Property Value
Type Description
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

UpdateBackupOperationsClient

public virtual OperationsClient UpdateBackupOperationsClient { get; }

The long-running operations client for UpdateBackup.

Property Value
Type Description
OperationsClient

Methods

Create()

public static SecretOperationsServiceClient Create()

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

Returns
Type Description
SecretOperationsServiceClient

The created SecretOperationsServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskSecretOperationsServiceClient

The task representing the created SecretOperationsServiceClient.

CreateBackup(LocationName, Backup, string, CallSettings)

public virtual Operation<Backup, OperationMetadata> CreateBackup(LocationName parent, Backup backup, string backupId, CallSettings callSettings = null)

Creates a new Backup in a given project and location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location where the [Backup][google.cloud.secretmanager.v1.Backup] will be created, in the format projects/{project}/locations/{location}.

backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource to create.

backupId string

Required. The ID to use for the backup, which will become the final component of the backup's resource name.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationBackupOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Backup backup = new Backup();
string backupId = "";
// Make the request
Operation<Backup, OperationMetadata> response = secretOperationsServiceClient.CreateBackup(parent, backup, backupId);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceCreateBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackup(CreateBackupRequest, CallSettings)

public virtual Operation<Backup, OperationMetadata> CreateBackup(CreateBackupRequest request, CallSettings callSettings = null)

Creates a new Backup in a given project and location.

Parameters
Name Description
request CreateBackupRequest

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
OperationBackupOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
CreateBackupRequest request = new CreateBackupRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    BackupId = "",
    Backup = new Backup(),
};
// Make the request
Operation<Backup, OperationMetadata> response = secretOperationsServiceClient.CreateBackup(request);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceCreateBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackup(string, Backup, string, CallSettings)

public virtual Operation<Backup, OperationMetadata> CreateBackup(string parent, Backup backup, string backupId, CallSettings callSettings = null)

Creates a new Backup in a given project and location.

Parameters
Name Description
parent string

Required. The resource name of the location where the [Backup][google.cloud.secretmanager.v1.Backup] will be created, in the format projects/{project}/locations/{location}.

backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource to create.

backupId string

Required. The ID to use for the backup, which will become the final component of the backup's resource name.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationBackupOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Backup backup = new Backup();
string backupId = "";
// Make the request
Operation<Backup, OperationMetadata> response = secretOperationsServiceClient.CreateBackup(parent, backup, backupId);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceCreateBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackupAsync(LocationName, Backup, string, CallSettings)

public virtual Task<Operation<Backup, OperationMetadata>> CreateBackupAsync(LocationName parent, Backup backup, string backupId, CallSettings callSettings = null)

Creates a new Backup in a given project and location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location where the [Backup][google.cloud.secretmanager.v1.Backup] will be created, in the format projects/{project}/locations/{location}.

backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource to create.

backupId string

Required. The ID to use for the backup, which will become the final component of the backup's resource name.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Backup backup = new Backup();
string backupId = "";
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.CreateBackupAsync(parent, backup, backupId);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceCreateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackupAsync(LocationName, Backup, string, CancellationToken)

public virtual Task<Operation<Backup, OperationMetadata>> CreateBackupAsync(LocationName parent, Backup backup, string backupId, CancellationToken cancellationToken)

Creates a new Backup in a given project and location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location where the [Backup][google.cloud.secretmanager.v1.Backup] will be created, in the format projects/{project}/locations/{location}.

backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource to create.

backupId string

Required. The ID to use for the backup, which will become the final component of the backup's resource name.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Backup backup = new Backup();
string backupId = "";
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.CreateBackupAsync(parent, backup, backupId);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceCreateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackupAsync(CreateBackupRequest, CallSettings)

public virtual Task<Operation<Backup, OperationMetadata>> CreateBackupAsync(CreateBackupRequest request, CallSettings callSettings = null)

Creates a new Backup in a given project and location.

Parameters
Name Description
request CreateBackupRequest

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
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
CreateBackupRequest request = new CreateBackupRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    BackupId = "",
    Backup = new Backup(),
};
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.CreateBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceCreateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackupAsync(CreateBackupRequest, CancellationToken)

public virtual Task<Operation<Backup, OperationMetadata>> CreateBackupAsync(CreateBackupRequest request, CancellationToken cancellationToken)

Creates a new Backup in a given project and location.

Parameters
Name Description
request CreateBackupRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
CreateBackupRequest request = new CreateBackupRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    BackupId = "",
    Backup = new Backup(),
};
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.CreateBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceCreateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackupAsync(string, Backup, string, CallSettings)

public virtual Task<Operation<Backup, OperationMetadata>> CreateBackupAsync(string parent, Backup backup, string backupId, CallSettings callSettings = null)

Creates a new Backup in a given project and location.

Parameters
Name Description
parent string

Required. The resource name of the location where the [Backup][google.cloud.secretmanager.v1.Backup] will be created, in the format projects/{project}/locations/{location}.

backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource to create.

backupId string

Required. The ID to use for the backup, which will become the final component of the backup's resource name.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Backup backup = new Backup();
string backupId = "";
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.CreateBackupAsync(parent, backup, backupId);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceCreateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

CreateBackupAsync(string, Backup, string, CancellationToken)

public virtual Task<Operation<Backup, OperationMetadata>> CreateBackupAsync(string parent, Backup backup, string backupId, CancellationToken cancellationToken)

Creates a new Backup in a given project and location.

Parameters
Name Description
parent string

Required. The resource name of the location where the [Backup][google.cloud.secretmanager.v1.Backup] will be created, in the format projects/{project}/locations/{location}.

backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource to create.

backupId string

Required. The ID to use for the backup, which will become the final component of the backup's resource name.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Backup backup = new Backup();
string backupId = "";
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.CreateBackupAsync(parent, backup, backupId);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceCreateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

DeleteBackup(BackupName, CallSettings)

public virtual Operation<Empty, OperationMetadata> DeleteBackup(BackupName name, CallSettings callSettings = null)

Deletes a single Backup.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to delete, in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
// Make the request
Operation<Empty, OperationMetadata> response = secretOperationsServiceClient.DeleteBackup(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceDeleteBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackup(DeleteBackupRequest, CallSettings)

public virtual Operation<Empty, OperationMetadata> DeleteBackup(DeleteBackupRequest request, CallSettings callSettings = null)

Deletes a single Backup.

Parameters
Name Description
request DeleteBackupRequest

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
OperationEmptyOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
DeleteBackupRequest request = new DeleteBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
    Etag = "",
};
// Make the request
Operation<Empty, OperationMetadata> response = secretOperationsServiceClient.DeleteBackup(request);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceDeleteBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackup(string, CallSettings)

public virtual Operation<Empty, OperationMetadata> DeleteBackup(string name, CallSettings callSettings = null)

Deletes a single Backup.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to delete, in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
// Make the request
Operation<Empty, OperationMetadata> response = secretOperationsServiceClient.DeleteBackup(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceDeleteBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackupAsync(BackupName, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteBackupAsync(BackupName name, CallSettings callSettings = null)

Deletes a single Backup.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to delete, in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
// Make the request
Operation<Empty, OperationMetadata> response = await secretOperationsServiceClient.DeleteBackupAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceDeleteBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackupAsync(BackupName, CancellationToken)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteBackupAsync(BackupName name, CancellationToken cancellationToken)

Deletes a single Backup.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to delete, in the format projects/{project}/locations/{location}/backups/{backup}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
// Make the request
Operation<Empty, OperationMetadata> response = await secretOperationsServiceClient.DeleteBackupAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceDeleteBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackupAsync(DeleteBackupRequest, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteBackupAsync(DeleteBackupRequest request, CallSettings callSettings = null)

Deletes a single Backup.

Parameters
Name Description
request DeleteBackupRequest

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
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteBackupRequest request = new DeleteBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
    Etag = "",
};
// Make the request
Operation<Empty, OperationMetadata> response = await secretOperationsServiceClient.DeleteBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceDeleteBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackupAsync(DeleteBackupRequest, CancellationToken)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteBackupAsync(DeleteBackupRequest request, CancellationToken cancellationToken)

Deletes a single Backup.

Parameters
Name Description
request DeleteBackupRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteBackupRequest request = new DeleteBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
    Etag = "",
};
// Make the request
Operation<Empty, OperationMetadata> response = await secretOperationsServiceClient.DeleteBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceDeleteBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackupAsync(string, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteBackupAsync(string name, CallSettings callSettings = null)

Deletes a single Backup.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to delete, in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
// Make the request
Operation<Empty, OperationMetadata> response = await secretOperationsServiceClient.DeleteBackupAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceDeleteBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteBackupAsync(string, CancellationToken)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteBackupAsync(string name, CancellationToken cancellationToken)

Deletes a single Backup.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to delete, in the format projects/{project}/locations/{location}/backups/{backup}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
// Make the request
Operation<Empty, OperationMetadata> response = await secretOperationsServiceClient.DeleteBackupAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceDeleteBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

GetBackup(BackupName, CallSettings)

public virtual Backup GetBackup(BackupName name, CallSettings callSettings = null)

Gets details of a single Backup.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Backup

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
// Make the request
Backup response = secretOperationsServiceClient.GetBackup(name);

GetBackup(GetBackupRequest, CallSettings)

public virtual Backup GetBackup(GetBackupRequest request, CallSettings callSettings = null)

Gets details of a single Backup.

Parameters
Name Description
request GetBackupRequest

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
Backup

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
GetBackupRequest request = new GetBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
};
// Make the request
Backup response = secretOperationsServiceClient.GetBackup(request);

GetBackup(string, CallSettings)

public virtual Backup GetBackup(string name, CallSettings callSettings = null)

Gets details of a single Backup.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Backup

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
// Make the request
Backup response = secretOperationsServiceClient.GetBackup(name);

GetBackupAsync(BackupName, CallSettings)

public virtual Task<Backup> GetBackupAsync(BackupName name, CallSettings callSettings = null)

Gets details of a single Backup.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBackup

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
// Make the request
Backup response = await secretOperationsServiceClient.GetBackupAsync(name);

GetBackupAsync(BackupName, CancellationToken)

public virtual Task<Backup> GetBackupAsync(BackupName name, CancellationToken cancellationToken)

Gets details of a single Backup.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}/backups/{backup}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBackup

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
// Make the request
Backup response = await secretOperationsServiceClient.GetBackupAsync(name);

GetBackupAsync(GetBackupRequest, CallSettings)

public virtual Task<Backup> GetBackupAsync(GetBackupRequest request, CallSettings callSettings = null)

Gets details of a single Backup.

Parameters
Name Description
request GetBackupRequest

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
TaskBackup

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
GetBackupRequest request = new GetBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
};
// Make the request
Backup response = await secretOperationsServiceClient.GetBackupAsync(request);

GetBackupAsync(GetBackupRequest, CancellationToken)

public virtual Task<Backup> GetBackupAsync(GetBackupRequest request, CancellationToken cancellationToken)

Gets details of a single Backup.

Parameters
Name Description
request GetBackupRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBackup

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
GetBackupRequest request = new GetBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
};
// Make the request
Backup response = await secretOperationsServiceClient.GetBackupAsync(request);

GetBackupAsync(string, CallSettings)

public virtual Task<Backup> GetBackupAsync(string name, CallSettings callSettings = null)

Gets details of a single Backup.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}/backups/{backup}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBackup

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
// Make the request
Backup response = await secretOperationsServiceClient.GetBackupAsync(name);

GetBackupAsync(string, CancellationToken)

public virtual Task<Backup> GetBackupAsync(string name, CancellationToken cancellationToken)

Gets details of a single Backup.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}/backups/{backup}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBackup

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
// Make the request
Backup response = await secretOperationsServiceClient.GetBackupAsync(name);

ListBackups(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListBackupsResponse, Backup> ListBackups(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists Backups in a given project and location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location associated with the [Backups][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}.

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
PagedEnumerableListBackupsResponseBackup

A pageable sequence of Backup resources.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListBackupsResponse, Backup> response = secretOperationsServiceClient.ListBackups(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Backup 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 (ListBackupsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Backup 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<Backup> 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 (Backup 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;

ListBackups(ListBackupsRequest, CallSettings)

public virtual PagedEnumerable<ListBackupsResponse, Backup> ListBackups(ListBackupsRequest request, CallSettings callSettings = null)

Lists Backups in a given project and location.

Parameters
Name Description
request ListBackupsRequest

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
PagedEnumerableListBackupsResponseBackup

A pageable sequence of Backup resources.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
ListBackupsRequest request = new ListBackupsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListBackupsResponse, Backup> response = secretOperationsServiceClient.ListBackups(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Backup 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 (ListBackupsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Backup 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<Backup> 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 (Backup 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;

ListBackups(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListBackupsResponse, Backup> ListBackups(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists Backups in a given project and location.

Parameters
Name Description
parent string

Required. The resource name of the location associated with the [Backups][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}.

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
PagedEnumerableListBackupsResponseBackup

A pageable sequence of Backup resources.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListBackupsResponse, Backup> response = secretOperationsServiceClient.ListBackups(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Backup 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 (ListBackupsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Backup 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<Backup> 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 (Backup 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;

ListBackupsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListBackupsResponse, Backup> ListBackupsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists Backups in a given project and location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location associated with the [Backups][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}.

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
PagedAsyncEnumerableListBackupsResponseBackup

A pageable asynchronous sequence of Backup resources.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListBackupsResponse, Backup> response = secretOperationsServiceClient.ListBackupsAsync(parent);

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

// Or iterate over pages (of server-defined size), performing one RPC per page
await foreach (ListBackupsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Backup 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<Backup> 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 (Backup 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;

ListBackupsAsync(ListBackupsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListBackupsResponse, Backup> ListBackupsAsync(ListBackupsRequest request, CallSettings callSettings = null)

Lists Backups in a given project and location.

Parameters
Name Description
request ListBackupsRequest

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
PagedAsyncEnumerableListBackupsResponseBackup

A pageable asynchronous sequence of Backup resources.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
ListBackupsRequest request = new ListBackupsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListBackupsResponse, Backup> response = secretOperationsServiceClient.ListBackupsAsync(request);

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

// Or iterate over pages (of server-defined size), performing one RPC per page
await foreach (ListBackupsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Backup 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<Backup> 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 (Backup 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;

ListBackupsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListBackupsResponse, Backup> ListBackupsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists Backups in a given project and location.

Parameters
Name Description
parent string

Required. The resource name of the location associated with the [Backups][google.cloud.secretmanager.v1.Backup], in the format projects/{project}/locations/{location}.

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
PagedAsyncEnumerableListBackupsResponseBackup

A pageable asynchronous sequence of Backup resources.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListBackupsResponse, Backup> response = secretOperationsServiceClient.ListBackupsAsync(parent);

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

// Or iterate over pages (of server-defined size), performing one RPC per page
await foreach (ListBackupsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Backup 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<Backup> 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 (Backup 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;

PollOnceCreateBackup(string, CallSettings)

public virtual Operation<Backup, OperationMetadata> PollOnceCreateBackup(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of CreateBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationBackupOperationMetadata

The result of polling the operation.

PollOnceCreateBackupAsync(string, CallSettings)

public virtual Task<Operation<Backup, OperationMetadata>> PollOnceCreateBackupAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of CreateBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationBackupOperationMetadata

A task representing the result of polling the operation.

PollOnceDeleteBackup(string, CallSettings)

public virtual Operation<Empty, OperationMetadata> PollOnceDeleteBackup(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of DeleteBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyOperationMetadata

The result of polling the operation.

PollOnceDeleteBackupAsync(string, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> PollOnceDeleteBackupAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of DeleteBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A task representing the result of polling the operation.

PollOnceRestoreBackup(string, CallSettings)

public virtual Operation<Secret, OperationMetadata> PollOnceRestoreBackup(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of RestoreBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationSecretOperationMetadata

The result of polling the operation.

PollOnceRestoreBackupAsync(string, CallSettings)

public virtual Task<Operation<Secret, OperationMetadata>> PollOnceRestoreBackupAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of RestoreBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationSecretOperationMetadata

A task representing the result of polling the operation.

PollOnceUpdateBackup(string, CallSettings)

public virtual Operation<Backup, OperationMetadata> PollOnceUpdateBackup(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of UpdateBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationBackupOperationMetadata

The result of polling the operation.

PollOnceUpdateBackupAsync(string, CallSettings)

public virtual Task<Operation<Backup, OperationMetadata>> PollOnceUpdateBackupAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of UpdateBackup.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationBackupOperationMetadata

A task representing the result of polling the operation.

RestoreBackup(BackupName, LocationName, string, CallSettings)

public virtual Operation<Secret, OperationMetadata> RestoreBackup(BackupName name, LocationName destinationSecretParent, string destinationSecretId, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent LocationName

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationSecretOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
LocationName destinationSecretParent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = secretOperationsServiceClient.RestoreBackup(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceRestoreBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackup(BackupName, ProjectName, string, CallSettings)

public virtual Operation<Secret, OperationMetadata> RestoreBackup(BackupName name, ProjectName destinationSecretParent, string destinationSecretId, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent ProjectName

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationSecretOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
ProjectName destinationSecretParent = ProjectName.FromProject("[PROJECT]");
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = secretOperationsServiceClient.RestoreBackup(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceRestoreBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackup(RestoreBackupRequest, CallSettings)

public virtual Operation<Secret, OperationMetadata> RestoreBackup(RestoreBackupRequest request, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
request RestoreBackupRequest

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
OperationSecretOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
RestoreBackupRequest request = new RestoreBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
    DestinationSecretParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    DestinationSecretId = "",
    KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
Operation<Secret, OperationMetadata> response = secretOperationsServiceClient.RestoreBackup(request);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceRestoreBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackup(string, string, string, CallSettings)

public virtual Operation<Secret, OperationMetadata> RestoreBackup(string name, string destinationSecretParent, string destinationSecretId, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent string

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationSecretOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
string destinationSecretParent = "projects/[PROJECT]";
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = secretOperationsServiceClient.RestoreBackup(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceRestoreBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(BackupName, LocationName, string, CallSettings)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(BackupName name, LocationName destinationSecretParent, string destinationSecretId, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent LocationName

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
LocationName destinationSecretParent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(BackupName, LocationName, string, CancellationToken)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(BackupName name, LocationName destinationSecretParent, string destinationSecretId, CancellationToken cancellationToken)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent LocationName

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
LocationName destinationSecretParent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(BackupName, ProjectName, string, CallSettings)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(BackupName name, ProjectName destinationSecretParent, string destinationSecretId, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent ProjectName

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
ProjectName destinationSecretParent = ProjectName.FromProject("[PROJECT]");
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(BackupName, ProjectName, string, CancellationToken)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(BackupName name, ProjectName destinationSecretParent, string destinationSecretId, CancellationToken cancellationToken)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name BackupName

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent ProjectName

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
BackupName name = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]");
ProjectName destinationSecretParent = ProjectName.FromProject("[PROJECT]");
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(RestoreBackupRequest, CallSettings)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(RestoreBackupRequest request, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
request RestoreBackupRequest

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
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
RestoreBackupRequest request = new RestoreBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
    DestinationSecretParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    DestinationSecretId = "",
    KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(RestoreBackupRequest, CancellationToken)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(RestoreBackupRequest request, CancellationToken cancellationToken)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
request RestoreBackupRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
RestoreBackupRequest request = new RestoreBackupRequest
{
    BackupName = BackupName.FromProjectLocationBackup("[PROJECT]", "[LOCATION]", "[BACKUP]"),
    DestinationSecretParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    DestinationSecretId = "",
    KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(string, string, string, CallSettings)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(string name, string destinationSecretParent, string destinationSecretId, CallSettings callSettings = null)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent string

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
string destinationSecretParent = "projects/[PROJECT]";
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

RestoreBackupAsync(string, string, string, CancellationToken)

public virtual Task<Operation<Secret, OperationMetadata>> RestoreBackupAsync(string name, string destinationSecretParent, string destinationSecretId, CancellationToken cancellationToken)

Restores a [Secret][google.cloud.secretmanager.v1.Secret] from the given [Backup][google.cloud.secretmanager.v1.Backup]. This creates a new [Secret][google.cloud.secretmanager.v1.Secret] resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.

Parameters
Name Description
name string

Required. The resource name of the [Backup][google.cloud.secretmanager.v1.Backup] to restore from. Format: projects/{project}/locations/{location}/backups/{backup}

destinationSecretParent string

Required. Parent of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. Formats:

  • projects/{project}/locations/{location} (for regional secrets)
  • projects/{project} (for global secrets)
destinationSecretId string

Required. ID of the new [Secret][google.cloud.secretmanager.v1.Secret] to be created from this backup. 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.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationSecretOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/backups/[BACKUP]";
string destinationSecretParent = "projects/[PROJECT]";
string destinationSecretId = "";
// Make the request
Operation<Secret, OperationMetadata> response = await secretOperationsServiceClient.RestoreBackupAsync(name, destinationSecretParent, destinationSecretId);

// Poll until the returned long-running operation is complete
Operation<Secret, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Secret result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Secret, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceRestoreBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Secret retrievedResult = retrievedResponse.Result;
}

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.

UpdateBackup(Backup, FieldMask, CallSettings)

public virtual Operation<Backup, OperationMetadata> UpdateBackup(Backup backup, FieldMask updateMask, CallSettings callSettings = null)

Updates the parameters of a single Backup.

Parameters
Name Description
backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource with updated fields.

updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the [Backup][google.cloud.secretmanager.v1.Backup] resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields present in the request will be overwritten.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationBackupOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
Backup backup = new Backup();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Backup, OperationMetadata> response = secretOperationsServiceClient.UpdateBackup(backup, updateMask);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceUpdateBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

UpdateBackup(UpdateBackupRequest, CallSettings)

public virtual Operation<Backup, OperationMetadata> UpdateBackup(UpdateBackupRequest request, CallSettings callSettings = null)

Updates the parameters of a single Backup.

Parameters
Name Description
request UpdateBackupRequest

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
OperationBackupOperationMetadata

The RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = SecretOperationsServiceClient.Create();
// Initialize request argument(s)
UpdateBackupRequest request = new UpdateBackupRequest
{
    UpdateMask = new FieldMask(),
    Backup = new Backup(),
};
// Make the request
Operation<Backup, OperationMetadata> response = secretOperationsServiceClient.UpdateBackup(request);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = secretOperationsServiceClient.PollOnceUpdateBackup(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

UpdateBackupAsync(Backup, FieldMask, CallSettings)

public virtual Task<Operation<Backup, OperationMetadata>> UpdateBackupAsync(Backup backup, FieldMask updateMask, CallSettings callSettings = null)

Updates the parameters of a single Backup.

Parameters
Name Description
backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource with updated fields.

updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the [Backup][google.cloud.secretmanager.v1.Backup] resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields present in the request will be overwritten.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
Backup backup = new Backup();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.UpdateBackupAsync(backup, updateMask);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceUpdateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

UpdateBackupAsync(Backup, FieldMask, CancellationToken)

public virtual Task<Operation<Backup, OperationMetadata>> UpdateBackupAsync(Backup backup, FieldMask updateMask, CancellationToken cancellationToken)

Updates the parameters of a single Backup.

Parameters
Name Description
backup Backup

Required. The [Backup][google.cloud.secretmanager.v1.Backup] resource with updated fields.

updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the [Backup][google.cloud.secretmanager.v1.Backup] resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields present in the request will be overwritten.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
Backup backup = new Backup();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.UpdateBackupAsync(backup, updateMask);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceUpdateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

UpdateBackupAsync(UpdateBackupRequest, CallSettings)

public virtual Task<Operation<Backup, OperationMetadata>> UpdateBackupAsync(UpdateBackupRequest request, CallSettings callSettings = null)

Updates the parameters of a single Backup.

Parameters
Name Description
request UpdateBackupRequest

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
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateBackupRequest request = new UpdateBackupRequest
{
    UpdateMask = new FieldMask(),
    Backup = new Backup(),
};
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.UpdateBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceUpdateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}

UpdateBackupAsync(UpdateBackupRequest, CancellationToken)

public virtual Task<Operation<Backup, OperationMetadata>> UpdateBackupAsync(UpdateBackupRequest request, CancellationToken cancellationToken)

Updates the parameters of a single Backup.

Parameters
Name Description
request UpdateBackupRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationBackupOperationMetadata

A Task containing the RPC response.

Example
// Create client
SecretOperationsServiceClient secretOperationsServiceClient = await SecretOperationsServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateBackupRequest request = new UpdateBackupRequest
{
    UpdateMask = new FieldMask(),
    Backup = new Backup(),
};
// Make the request
Operation<Backup, OperationMetadata> response = await secretOperationsServiceClient.UpdateBackupAsync(request);

// Poll until the returned long-running operation is complete
Operation<Backup, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, OperationMetadata> retrievedResponse = await secretOperationsServiceClient.PollOnceUpdateBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Backup retrievedResult = retrievedResponse.Result;
}