You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::Backup::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::Backup::Client
- Defined in:
- (unknown)
Overview
An API client for AWS Backup. To construct a client, you need to configure a :region
and :credentials
.
backup = Aws::Backup::Client.new(
region: region_name,
credentials: credentials,
# ...
)
See #initialize for a full list of supported configuration options.
Region
You can configure a default region in the following locations:
ENV['AWS_REGION']
Aws.config[:region]
Go here for a list of supported regions.
Credentials
Default credentials are loaded automatically from the following locations:
ENV['AWS_ACCESS_KEY_ID']
andENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
- The shared credentials ini file at
~/.aws/credentials
(more information) - From an instance profile when running on EC2
You can also construct a credentials object from one of the following classes:
Alternatively, you configure credentials with :access_key_id
and
:secret_access_key
:
# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))
Aws::Backup::Client.new(
access_key_id: creds['access_key_id'],
secret_access_key: creds['secret_access_key']
)
Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
Constructor collapse
-
#initialize(options = {}) ⇒ Aws::Backup::Client
constructor
Constructs an API client.
API Operations collapse
-
#create_backup_plan(options = {}) ⇒ Types::CreateBackupPlanOutput
Creates a backup plan using a backup plan name and backup rules.
-
#create_backup_selection(options = {}) ⇒ Types::CreateBackupSelectionOutput
Creates a JSON document that specifies a set of resources to assign to a backup plan.
-
#create_backup_vault(options = {}) ⇒ Types::CreateBackupVaultOutput
Creates a logical container where backups are stored.
-
#delete_backup_plan(options = {}) ⇒ Types::DeleteBackupPlanOutput
Deletes a backup plan.
-
#delete_backup_selection(options = {}) ⇒ Struct
Deletes the resource selection associated with a backup plan that is specified by the
SelectionId
..
-
#delete_backup_vault(options = {}) ⇒ Struct
Deletes the backup vault identified by its name.
-
#delete_backup_vault_access_policy(options = {}) ⇒ Struct
Deletes the policy document that manages permissions on a backup vault.
.
-
#delete_backup_vault_notifications(options = {}) ⇒ Struct
Deletes event notifications for the specified backup vault.
.
-
#delete_recovery_point(options = {}) ⇒ Struct
Deletes the recovery point specified by a recovery point ID.
.
-
#describe_backup_job(options = {}) ⇒ Types::DescribeBackupJobOutput
Returns backup job details for the specified
BackupJobId
..
-
#describe_backup_vault(options = {}) ⇒ Types::DescribeBackupVaultOutput
Returns metadata about a backup vault specified by its name.
.
-
#describe_copy_job(options = {}) ⇒ Types::DescribeCopyJobOutput
Returns metadata associated with creating a copy of a resource.
.
-
#describe_global_settings(options = {}) ⇒ Types::DescribeGlobalSettingsOutput
The current feature settings for the AWS Account.
.
-
#describe_protected_resource(options = {}) ⇒ Types::DescribeProtectedResourceOutput
Returns information about a saved resource, including the last time it was backed up, its Amazon Resource Name (ARN), and the AWS service type of the saved resource.
.
-
#describe_recovery_point(options = {}) ⇒ Types::DescribeRecoveryPointOutput
Returns metadata associated with a recovery point, including ID, status, encryption, and lifecycle.
.
-
#describe_region_settings(options = {}) ⇒ Types::DescribeRegionSettingsOutput
Returns the current service opt-in settings for the Region.
-
#describe_restore_job(options = {}) ⇒ Types::DescribeRestoreJobOutput
Returns metadata associated with a restore job that is specified by a job ID.
.
-
#export_backup_plan_template(options = {}) ⇒ Types::ExportBackupPlanTemplateOutput
Returns the backup plan that is specified by the plan ID as a backup template.
.
-
#get_backup_plan(options = {}) ⇒ Types::GetBackupPlanOutput
Returns
BackupPlan
details for the specifiedBackupPlanId
. -
#get_backup_plan_from_json(options = {}) ⇒ Types::GetBackupPlanFromJSONOutput
Returns a valid JSON document specifying a backup plan or an error.
.
-
#get_backup_plan_from_template(options = {}) ⇒ Types::GetBackupPlanFromTemplateOutput
Returns the template specified by its
templateId
as a backup plan..
-
#get_backup_selection(options = {}) ⇒ Types::GetBackupSelectionOutput
Returns selection metadata and a document in JSON format that specifies a list of resources that are associated with a backup plan.
.
-
#get_backup_vault_access_policy(options = {}) ⇒ Types::GetBackupVaultAccessPolicyOutput
Returns the access policy document that is associated with the named backup vault.
.
-
#get_backup_vault_notifications(options = {}) ⇒ Types::GetBackupVaultNotificationsOutput
Returns event notifications for the specified backup vault.
.
-
#get_recovery_point_restore_metadata(options = {}) ⇒ Types::GetRecoveryPointRestoreMetadataOutput
Returns a set of metadata key-value pairs that were used to create the backup.
.
-
#get_supported_resource_types(options = {}) ⇒ Types::GetSupportedResourceTypesOutput
Returns the AWS resource types supported by AWS Backup.
.
-
#list_backup_jobs(options = {}) ⇒ Types::ListBackupJobsOutput
Returns a list of existing backup jobs for an authenticated account.
.
-
#list_backup_plan_templates(options = {}) ⇒ Types::ListBackupPlanTemplatesOutput
Returns metadata of your saved backup plan templates, including the template ID, name, and the creation and deletion dates.
.
-
#list_backup_plan_versions(options = {}) ⇒ Types::ListBackupPlanVersionsOutput
Returns version metadata of your backup plans, including Amazon Resource Names (ARNs), backup plan IDs, creation and deletion dates, plan names, and version IDs.
.
-
#list_backup_plans(options = {}) ⇒ Types::ListBackupPlansOutput
Returns a list of existing backup plans for an authenticated account.
-
#list_backup_selections(options = {}) ⇒ Types::ListBackupSelectionsOutput
Returns an array containing metadata of the resources associated with the target backup plan.
.
-
#list_backup_vaults(options = {}) ⇒ Types::ListBackupVaultsOutput
Returns a list of recovery point storage containers along with information about them.
.
-
#list_copy_jobs(options = {}) ⇒ Types::ListCopyJobsOutput
Returns metadata about your copy jobs.
.
-
#list_protected_resources(options = {}) ⇒ Types::ListProtectedResourcesOutput
Returns an array of resources successfully backed up by AWS Backup, including the time the resource was saved, an Amazon Resource Name (ARN) of the resource, and a resource type.
.
-
#list_recovery_points_by_backup_vault(options = {}) ⇒ Types::ListRecoveryPointsByBackupVaultOutput
Returns detailed information about the recovery points stored in a backup vault.
.
-
#list_recovery_points_by_resource(options = {}) ⇒ Types::ListRecoveryPointsByResourceOutput
Returns detailed information about recovery points of the type specified by a resource Amazon Resource Name (ARN).
.
-
#list_restore_jobs(options = {}) ⇒ Types::ListRestoreJobsOutput
Returns a list of jobs that AWS Backup initiated to restore a saved resource, including metadata about the recovery process.
.
-
#list_tags(options = {}) ⇒ Types::ListTagsOutput
Returns a list of key-value pairs assigned to a target recovery point, backup plan, or backup vault.
ListTags
are currently only supported with Amazon EFS backups. -
#put_backup_vault_access_policy(options = {}) ⇒ Struct
Sets a resource-based policy that is used to manage access permissions on the target backup vault.
-
#put_backup_vault_notifications(options = {}) ⇒ Struct
Turns on notifications on a backup vault for the specified topic and events.
.
-
#start_backup_job(options = {}) ⇒ Types::StartBackupJobOutput
Starts an on-demand backup job for the specified resource.
.
-
#start_copy_job(options = {}) ⇒ Types::StartCopyJobOutput
Starts a job to create a one-time copy of the specified resource.
.
-
#start_restore_job(options = {}) ⇒ Types::StartRestoreJobOutput
Recovers the saved resource identified by an Amazon Resource Name (ARN).
-
#stop_backup_job(options = {}) ⇒ Struct
Attempts to cancel a job to create a one-time backup of a resource.
.
-
#tag_resource(options = {}) ⇒ Struct
Assigns a set of key-value pairs to a recovery point, backup plan, or backup vault identified by an Amazon Resource Name (ARN).
.
-
#untag_resource(options = {}) ⇒ Struct
Removes a set of key-value pairs from a recovery point, backup plan, or backup vault identified by an Amazon Resource Name (ARN)
.
-
#update_backup_plan(options = {}) ⇒ Types::UpdateBackupPlanOutput
Updates an existing backup plan identified by its
backupPlanId
with the input document in JSON format. -
#update_global_settings(options = {}) ⇒ Struct
Updates the current global settings for the AWS Account.
-
#update_recovery_point_lifecycle(options = {}) ⇒ Types::UpdateRecoveryPointLifecycleOutput
Sets the transition lifecycle of a recovery point.
The lifecycle defines when a protected resource is transitioned to cold storage and when it expires.
-
#update_region_settings(options = {}) ⇒ Struct
Updates the current service opt-in settings for the Region.
Instance Method Summary collapse
-
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
-
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters.
Methods inherited from Seahorse::Client::Base
add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options = {}) ⇒ Aws::Backup::Client
Constructs an API client.
Instance Method Details
#create_backup_plan(options = {}) ⇒ Types::CreateBackupPlanOutput
Creates a backup plan using a backup plan name and backup rules. A backup plan is a document that contains information that AWS Backup uses to schedule tasks that create recovery points for resources.
If you call CreateBackupPlan
with a plan that already exists, an AlreadyExistsException
is returned.
#create_backup_selection(options = {}) ⇒ Types::CreateBackupSelectionOutput
Creates a JSON document that specifies a set of resources to assign to a backup plan. Resources can be included by specifying patterns for a ListOfTags
and selected Resources
.
For example, consider the following patterns:
-
Resources: "arn:aws:ec2:region:account-id:volume/volume-id"
-
ConditionKey:"department"
ConditionValue:"finance"
ConditionType:"StringEquals"
-
ConditionKey:"importance"
ConditionValue:"critical"
ConditionType:"StringEquals"
Using these patterns would back up all Amazon Elastic Block Store (Amazon EBS) volumes that are tagged as "department=finance"
, "importance=critical"
, in addition to an EBS volume with the specified volume ID.
Resources and conditions are additive in that all resources that match the pattern are selected. This shouldn't be confused with a logical AND, where all conditions must match. The matching patterns are logically put together using the OR operator. In other words, all patterns that match are selected for backup.
#create_backup_vault(options = {}) ⇒ Types::CreateBackupVaultOutput
Creates a logical container where backups are stored. A CreateBackupVault
request includes a name, optionally one or more resource tags, an encryption key, and a request ID.
Sensitive data, such as passport numbers, should not be included the name of a backup vault.
#delete_backup_plan(options = {}) ⇒ Types::DeleteBackupPlanOutput
Deletes a backup plan. A backup plan can only be deleted after all associated selections of resources have been deleted. Deleting a backup plan deletes the current version of a backup plan. Previous versions, if any, will still exist.
#delete_backup_selection(options = {}) ⇒ Struct
Deletes the resource selection associated with a backup plan that is specified by the SelectionId
.
#delete_backup_vault(options = {}) ⇒ Struct
Deletes the backup vault identified by its name. A vault can be deleted only if it is empty.
#delete_backup_vault_access_policy(options = {}) ⇒ Struct
Deletes the policy document that manages permissions on a backup vault.
#delete_backup_vault_notifications(options = {}) ⇒ Struct
Deletes event notifications for the specified backup vault.
#delete_recovery_point(options = {}) ⇒ Struct
Deletes the recovery point specified by a recovery point ID.
#describe_backup_job(options = {}) ⇒ Types::DescribeBackupJobOutput
Returns backup job details for the specified BackupJobId
.
#describe_backup_vault(options = {}) ⇒ Types::DescribeBackupVaultOutput
Returns metadata about a backup vault specified by its name.
#describe_copy_job(options = {}) ⇒ Types::DescribeCopyJobOutput
Returns metadata associated with creating a copy of a resource.
#describe_global_settings(options = {}) ⇒ Types::DescribeGlobalSettingsOutput
The current feature settings for the AWS Account.
#describe_protected_resource(options = {}) ⇒ Types::DescribeProtectedResourceOutput
Returns information about a saved resource, including the last time it was backed up, its Amazon Resource Name (ARN), and the AWS service type of the saved resource.
#describe_recovery_point(options = {}) ⇒ Types::DescribeRecoveryPointOutput
Returns metadata associated with a recovery point, including ID, status, encryption, and lifecycle.
#describe_region_settings(options = {}) ⇒ Types::DescribeRegionSettingsOutput
Returns the current service opt-in settings for the Region. If service-opt-in is enabled for a service, AWS Backup tries to protect that service's resources in this Region, when the resource is included in an on-demand backup or scheduled backup plan. Otherwise, AWS Backup does not try to protect that service's resources in this Region, AWS Backup does not try to protect that service's resources in this Region.
#describe_restore_job(options = {}) ⇒ Types::DescribeRestoreJobOutput
Returns metadata associated with a restore job that is specified by a job ID.
#export_backup_plan_template(options = {}) ⇒ Types::ExportBackupPlanTemplateOutput
Returns the backup plan that is specified by the plan ID as a backup template.
#get_backup_plan(options = {}) ⇒ Types::GetBackupPlanOutput
Returns BackupPlan
details for the specified BackupPlanId
. Returns the body of a backup plan in JSON format, in addition to plan metadata.
#get_backup_plan_from_json(options = {}) ⇒ Types::GetBackupPlanFromJSONOutput
Returns a valid JSON document specifying a backup plan or an error.
#get_backup_plan_from_template(options = {}) ⇒ Types::GetBackupPlanFromTemplateOutput
Returns the template specified by its templateId
as a backup plan.
#get_backup_selection(options = {}) ⇒ Types::GetBackupSelectionOutput
Returns selection metadata and a document in JSON format that specifies a list of resources that are associated with a backup plan.
#get_backup_vault_access_policy(options = {}) ⇒ Types::GetBackupVaultAccessPolicyOutput
Returns the access policy document that is associated with the named backup vault.
#get_backup_vault_notifications(options = {}) ⇒ Types::GetBackupVaultNotificationsOutput
Returns event notifications for the specified backup vault.
#get_recovery_point_restore_metadata(options = {}) ⇒ Types::GetRecoveryPointRestoreMetadataOutput
Returns a set of metadata key-value pairs that were used to create the backup.
#get_supported_resource_types(options = {}) ⇒ Types::GetSupportedResourceTypesOutput
Returns the AWS resource types supported by AWS Backup.
#list_backup_jobs(options = {}) ⇒ Types::ListBackupJobsOutput
Returns a list of existing backup jobs for an authenticated account.
#list_backup_plan_templates(options = {}) ⇒ Types::ListBackupPlanTemplatesOutput
Returns metadata of your saved backup plan templates, including the template ID, name, and the creation and deletion dates.
#list_backup_plan_versions(options = {}) ⇒ Types::ListBackupPlanVersionsOutput
Returns version metadata of your backup plans, including Amazon Resource Names (ARNs), backup plan IDs, creation and deletion dates, plan names, and version IDs.
#list_backup_plans(options = {}) ⇒ Types::ListBackupPlansOutput
Returns a list of existing backup plans for an authenticated account. The list is populated only if the advanced option is set for the backup plan. The list contains information such as Amazon Resource Names (ARNs), plan IDs, creation and deletion dates, version IDs, plan names, and creator request IDs.
#list_backup_selections(options = {}) ⇒ Types::ListBackupSelectionsOutput
Returns an array containing metadata of the resources associated with the target backup plan.
#list_backup_vaults(options = {}) ⇒ Types::ListBackupVaultsOutput
Returns a list of recovery point storage containers along with information about them.
#list_copy_jobs(options = {}) ⇒ Types::ListCopyJobsOutput
Returns metadata about your copy jobs.
#list_protected_resources(options = {}) ⇒ Types::ListProtectedResourcesOutput
Returns an array of resources successfully backed up by AWS Backup, including the time the resource was saved, an Amazon Resource Name (ARN) of the resource, and a resource type.
#list_recovery_points_by_backup_vault(options = {}) ⇒ Types::ListRecoveryPointsByBackupVaultOutput
Returns detailed information about the recovery points stored in a backup vault.
#list_recovery_points_by_resource(options = {}) ⇒ Types::ListRecoveryPointsByResourceOutput
Returns detailed information about recovery points of the type specified by a resource Amazon Resource Name (ARN).
#list_restore_jobs(options = {}) ⇒ Types::ListRestoreJobsOutput
Returns a list of jobs that AWS Backup initiated to restore a saved resource, including metadata about the recovery process.
#list_tags(options = {}) ⇒ Types::ListTagsOutput
Returns a list of key-value pairs assigned to a target recovery point, backup plan, or backup vault.
ListTags
are currently only supported with Amazon EFS backups.
#put_backup_vault_access_policy(options = {}) ⇒ Struct
Sets a resource-based policy that is used to manage access permissions on the target backup vault. Requires a backup vault name and an access policy document in JSON format.
#put_backup_vault_notifications(options = {}) ⇒ Struct
Turns on notifications on a backup vault for the specified topic and events.
#start_backup_job(options = {}) ⇒ Types::StartBackupJobOutput
Starts an on-demand backup job for the specified resource.
#start_copy_job(options = {}) ⇒ Types::StartCopyJobOutput
Starts a job to create a one-time copy of the specified resource.
#start_restore_job(options = {}) ⇒ Types::StartRestoreJobOutput
Recovers the saved resource identified by an Amazon Resource Name (ARN).
#stop_backup_job(options = {}) ⇒ Struct
Attempts to cancel a job to create a one-time backup of a resource.
#tag_resource(options = {}) ⇒ Struct
Assigns a set of key-value pairs to a recovery point, backup plan, or backup vault identified by an Amazon Resource Name (ARN).
#untag_resource(options = {}) ⇒ Struct
Removes a set of key-value pairs from a recovery point, backup plan, or backup vault identified by an Amazon Resource Name (ARN)
#update_backup_plan(options = {}) ⇒ Types::UpdateBackupPlanOutput
Updates an existing backup plan identified by its backupPlanId
with the input document in JSON format. The new version is uniquely identified by a VersionId
.
#update_global_settings(options = {}) ⇒ Struct
Updates the current global settings for the AWS Account. Use the DescribeGlobalSettings
API to determine the current settings.
#update_recovery_point_lifecycle(options = {}) ⇒ Types::UpdateRecoveryPointLifecycleOutput
Sets the transition lifecycle of a recovery point.
The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. AWS Backup transitions and expires backups automatically according to the lifecycle that you define.
Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. Therefore, the “expire after days” setting must be 90 days greater than the “transition to cold after days” setting. The “transition to cold after days” setting cannot be changed after a backup has been transitioned to cold.
#update_region_settings(options = {}) ⇒ Struct
Updates the current service opt-in settings for the Region. If service-opt-in is enabled for a service, AWS Backup tries to protect that service's resources in this Region, when the resource is included in an on-demand backup or scheduled backup plan. Otherwise, AWS Backup does not try to protect that service's resources in this Region. Use the DescribeRegionSettings
API to determine the resource types that are supported.
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
Basic Usage
Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:
# poll for ~25 seconds
client.wait_until(...) do |w|
w.max_attempts = 5
w.delay = 5
end
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success
or :failure
from these callbacks,
it will terminate the waiter.
started_at = Time.now
client.wait_until(...) do |w|
# disable max attempts
w.max_attempts = nil
# poll for 1 hour, instead of a number of attempts
w.before_wait do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
end
Handling Errors
When a waiter is successful, it returns true
. When a waiter
fails, it raises an error. All errors raised extend from
Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:
Waiter Name | Client Method | Default Delay: | Default Max Attempts: |
---|