Reference documentation and code samples for the Secret Manager V1 API class Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.
REST client for the SecretOperationsService service.
Secret Operations Service
Manages backups of secrets. Implements a REST model with the following objects:
Note: SecretOperationsService is a regional service and must be called
using regional endpoints (secretmanager.{location}.rep.googleapis.com).
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::ConfigurationConfigure the SecretOperationsService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all SecretOperationsService clients ::Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::ConfigurationConfigure the SecretOperationsService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_backup
def create_backup(request, options = nil) -> ::Gapic::Operation
def create_backup(parent: nil, backup_id: nil, backup: nil) -> ::Gapic::OperationCreates a new Backup in a given project and location.
def create_backup(request, options = nil) -> ::Gapic::Operationcreate_backup via a request object, either of type
CreateBackupRequest or an equivalent Hash.
- request (::Google::Cloud::SecretManager::V1::CreateBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_backup(parent: nil, backup_id: nil, backup: nil) -> ::Gapic::Operationcreate_backup via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the location where the
Backup will be created, in the
format
projects/{project}/locations/{location}. - backup_id (::String) — Required. The ID to use for the backup, which will become the final component of the backup's resource name.
- backup (::Google::Cloud::SecretManager::V1::Backup, ::Hash) — Required. The Backup resource to create.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/secret_manager/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::SecretManager::V1::CreateBackupRequest.new # Call the create_backup method. result = client.create_backup request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#delete_backup
def delete_backup(request, options = nil) -> ::Gapic::Operation
def delete_backup(name: nil, etag: nil) -> ::Gapic::OperationDeletes a single Backup.
def delete_backup(request, options = nil) -> ::Gapic::Operationdelete_backup via a request object, either of type
DeleteBackupRequest or an equivalent Hash.
- request (::Google::Cloud::SecretManager::V1::DeleteBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_backup(name: nil, etag: nil) -> ::Gapic::Operationdelete_backup via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/secret_manager/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::SecretManager::V1::DeleteBackupRequest.new # Call the delete_backup method. result = client.delete_backup request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#get_backup
def get_backup(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Backup
def get_backup(name: nil) -> ::Google::Cloud::SecretManager::V1::BackupGets details of a single Backup.
def get_backup(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Backupget_backup via a request object, either of type
GetBackupRequest or an equivalent Hash.
- request (::Google::Cloud::SecretManager::V1::GetBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_backup(name: nil) -> ::Google::Cloud::SecretManager::V1::Backupget_backup via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the
Backup, in the format
projects/{project}/locations/{location}/backups/{backup}.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::SecretManager::V1::Backup)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/secret_manager/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::SecretManager::V1::GetBackupRequest.new # Call the get_backup method. result = client.get_backup request # The returned object is of type Google::Cloud::SecretManager::V1::Backup. p result
#initialize
def initialize() { |config| ... } -> ClientCreate a new SecretOperationsService REST client object.
- (config) — Configure the SecretOperationsService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new do |config| config.timeout = 10.0 end
#list_backups
def list_backups(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::SecretManager::V1::Backup>
def list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::SecretManager::V1::Backup>Lists Backups in a given project and location.
def list_backups(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::SecretManager::V1::Backup>list_backups via a request object, either of type
ListBackupsRequest or an equivalent Hash.
- request (::Google::Cloud::SecretManager::V1::ListBackupsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::SecretManager::V1::Backup>list_backups via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the location associated with the
Backups, in the format
projects/{project}/locations/{location}. - page_size (::Integer) — Optional. Maximum number of backups to return. The service may return fewer than this value. If unspecified, at most 50 backups will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
- page_token (::String) — Optional. A token identifying a page of results the server should return.
- filter (::String) — Optional. Filter expression to restrict the returned Backups.
- order_by (::String) — Optional. Field specification for sorting the results in the response.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::SecretManager::V1::Backup>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::SecretManager::V1::Backup>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/secret_manager/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::SecretManager::V1::ListBackupsRequest.new # Call the list_backups method. result = client.list_backups request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::SecretManager::V1::Backup. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Rest::ClientGet the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Rest::Client)
#logger
def logger() -> LoggerThe logger used for request/response debug logging.
- (Logger)
#operations_client
def operations_client() -> ::Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::OperationsGet the associated client for long-running operations.
#restore_backup
def restore_backup(request, options = nil) -> ::Gapic::Operation
def restore_backup(name: nil, destination_secret_parent: nil, destination_secret_id: nil, kms_key_name: nil) -> ::Gapic::OperationRestores a Secret from the given Backup. This creates a new Secret resource. The LRO tracks the restoration process, and the result of the LRO is the newly created Secret.
def restore_backup(request, options = nil) -> ::Gapic::Operationrestore_backup via a request object, either of type
RestoreBackupRequest or an equivalent Hash.
- request (::Google::Cloud::SecretManager::V1::RestoreBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def restore_backup(name: nil, destination_secret_parent: nil, destination_secret_id: nil, kms_key_name: nil) -> ::Gapic::Operationrestore_backup via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the
Backup to restore from. Format:
projects/{project}/locations/{location}/backups/{backup} -
destination_secret_parent (::String) —
Required. Parent of the new Secret to be created from this backup. Formats:
projects/{project}/locations/{location}(for regional secrets)projects/{project}(for global secrets)
-
destination_secret_id (::String) — Required. ID of the new 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. -
kms_key_name (::String) — Optional. The resource name of the Cloud KMS CryptoKey to be used to
encrypt the Secret.
Format:
projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/secret_manager/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::SecretManager::V1::RestoreBackupRequest.new # Call the restore_backup method. result = client.restore_backup request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#universe_domain
def universe_domain() -> StringThe effective universe domain
- (String)
#update_backup
def update_backup(request, options = nil) -> ::Gapic::Operation
def update_backup(update_mask: nil, backup: nil) -> ::Gapic::OperationUpdates the parameters of a single Backup.
def update_backup(request, options = nil) -> ::Gapic::Operationupdate_backup via a request object, either of type
UpdateBackupRequest or an equivalent Hash.
- request (::Google::Cloud::SecretManager::V1::UpdateBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_backup(update_mask: nil, backup: nil) -> ::Gapic::Operationupdate_backup via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. Field mask is used to specify the fields to be overwritten in the
Backup resource by the update.
The fields specified in the
update_maskare 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. - backup (::Google::Cloud::SecretManager::V1::Backup, ::Hash) — Required. The Backup resource with updated fields.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/secret_manager/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::SecretManager::V1::SecretOperationsService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::SecretManager::V1::UpdateBackupRequest.new # Call the update_backup method. result = client.update_backup request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end