You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::DataSync::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::DataSync::Client
- Defined in:
- (unknown)
Overview
An API client for AWS DataSync. To construct a client, you need to configure a :region
and :credentials
.
datasync = Aws::DataSync::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::DataSync::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::DataSync::Client
constructor
Constructs an API client.
API Operations collapse
-
#cancel_task_execution(options = {}) ⇒ Struct
Cancels execution of a task.
-
#create_agent(options = {}) ⇒ Types::CreateAgentResponse
Activates an AWS DataSync agent that you have deployed on your host.
-
#create_location_efs(options = {}) ⇒ Types::CreateLocationEfsResponse
Creates an endpoint for an Amazon EFS file system.
.
-
#create_location_fsx_windows(options = {}) ⇒ Types::CreateLocationFsxWindowsResponse
Creates an endpoint for an Amazon FSx for Windows file system.
.
-
#create_location_nfs(options = {}) ⇒ Types::CreateLocationNfsResponse
Defines a file system on a Network File System (NFS) server that can be read from or written to.
.
-
#create_location_object_storage(options = {}) ⇒ Types::CreateLocationObjectStorageResponse
Creates an endpoint for a self-managed object storage bucket.
-
#create_location_s3(options = {}) ⇒ Types::CreateLocationS3Response
Creates an endpoint for an Amazon S3 bucket.
For more information, see https://docs.aws.amazon.com/datasync/latest/userguide/create-locations-cli.html#create-location-s3-cli in the AWS DataSync User Guide.
. -
#create_location_smb(options = {}) ⇒ Types::CreateLocationSmbResponse
Defines a file system on a Server Message Block (SMB) server that can be read from or written to.
.
-
#create_task(options = {}) ⇒ Types::CreateTaskResponse
Creates a task.
-
#delete_agent(options = {}) ⇒ Struct
Deletes an agent.
-
#delete_location(options = {}) ⇒ Struct
Deletes the configuration of a location used by AWS DataSync.
-
#delete_task(options = {}) ⇒ Struct
Deletes a task.
.
-
#describe_agent(options = {}) ⇒ Types::DescribeAgentResponse
Returns metadata such as the name, the network interfaces, and the status (that is, whether the agent is running or not) for an agent.
-
#describe_location_efs(options = {}) ⇒ Types::DescribeLocationEfsResponse
Returns metadata, such as the path information about an Amazon EFS location.
.
-
#describe_location_fsx_windows(options = {}) ⇒ Types::DescribeLocationFsxWindowsResponse
Returns metadata, such as the path information about an Amazon FSx for Windows location.
.
-
#describe_location_nfs(options = {}) ⇒ Types::DescribeLocationNfsResponse
Returns metadata, such as the path information, about an NFS location.
.
-
#describe_location_object_storage(options = {}) ⇒ Types::DescribeLocationObjectStorageResponse
Returns metadata about a self-managed object storage server location.
-
#describe_location_s3(options = {}) ⇒ Types::DescribeLocationS3Response
Returns metadata, such as bucket name, about an Amazon S3 bucket location.
.
-
#describe_location_smb(options = {}) ⇒ Types::DescribeLocationSmbResponse
Returns metadata, such as the path and user information about an SMB location.
.
-
#describe_task(options = {}) ⇒ Types::DescribeTaskResponse
Returns metadata about a task.
.
-
#describe_task_execution(options = {}) ⇒ Types::DescribeTaskExecutionResponse
Returns detailed metadata about a task that is being executed.
.
-
#list_agents(options = {}) ⇒ Types::ListAgentsResponse
Returns a list of agents owned by an AWS account in the AWS Region specified in the request.
-
#list_locations(options = {}) ⇒ Types::ListLocationsResponse
Returns a list of source and destination locations.
If you have more locations than are returned in a response (that is, the response returns only a truncated list of your agents), the response contains a token that you can specify in your next request to fetch the next page of locations.
. -
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Returns all the tags associated with a specified resource.
-
#list_task_executions(options = {}) ⇒ Types::ListTaskExecutionsResponse
Returns a list of executed tasks.
.
-
#list_tasks(options = {}) ⇒ Types::ListTasksResponse
Returns a list of all the tasks.
.
-
#start_task_execution(options = {}) ⇒ Types::StartTaskExecutionResponse
Starts a specific invocation of a task.
-
#tag_resource(options = {}) ⇒ Struct
Applies a key-value pair to an AWS resource.
.
-
#untag_resource(options = {}) ⇒ Struct
Removes a tag from an AWS resource.
.
-
#update_agent(options = {}) ⇒ Struct
Updates the name of an agent.
.
-
#update_task(options = {}) ⇒ Struct
Updates the metadata associated with a task.
.
-
#update_task_execution(options = {}) ⇒ Struct
Updates execution of a task.
You can modify bandwidth throttling for a task execution that is running or queued.
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::DataSync::Client
Constructs an API client.
Instance Method Details
#cancel_task_execution(options = {}) ⇒ Struct
Cancels execution of a task.
When you cancel a task execution, the transfer of some files is abruptly interrupted. The contents of files that are transferred to the destination might be incomplete or inconsistent with the source files. However, if you start a new task execution on the same task and you allow the task execution to complete, file content on the destination is complete and consistent. This applies to other unexpected failures that interrupt a task execution. In all of these cases, AWS DataSync successfully complete the transfer when you start the next task execution.
#create_agent(options = {}) ⇒ Types::CreateAgentResponse
Activates an AWS DataSync agent that you have deployed on your host. The activation process associates your agent with your account. In the activation process, you specify information such as the AWS Region that you want to activate the agent in. You activate the agent in the AWS Region where your target locations (in Amazon S3 or Amazon EFS) reside. Your tasks are created in this AWS Region.
You can activate the agent in a VPC (virtual private cloud) or provide the agent access to a VPC endpoint so you can run tasks without going over the public internet.
You can use an agent for more than one location. If a task uses multiple agents, all of them need to have status AVAILABLE for the task to run. If you use multiple agents for a source location, the status of all the agents must be AVAILABLE for the task to run.
Agents are automatically updated by AWS on a regular basis, using a mechanism that ensures minimal interruption to your tasks.
#create_location_efs(options = {}) ⇒ Types::CreateLocationEfsResponse
Creates an endpoint for an Amazon EFS file system.
#create_location_fsx_windows(options = {}) ⇒ Types::CreateLocationFsxWindowsResponse
Creates an endpoint for an Amazon FSx for Windows file system.
#create_location_nfs(options = {}) ⇒ Types::CreateLocationNfsResponse
Defines a file system on a Network File System (NFS) server that can be read from or written to.
#create_location_object_storage(options = {}) ⇒ Types::CreateLocationObjectStorageResponse
Creates an endpoint for a self-managed object storage bucket. For more information about self-managed object storage locations, see create-object-location.
#create_location_s3(options = {}) ⇒ Types::CreateLocationS3Response
Creates an endpoint for an Amazon S3 bucket.
For more information, see https://docs.aws.amazon.com/datasync/latest/userguide/create-locations-cli.html#create-location-s3-cli in the AWS DataSync User Guide.
#create_location_smb(options = {}) ⇒ Types::CreateLocationSmbResponse
Defines a file system on a Server Message Block (SMB) server that can be read from or written to.
#create_task(options = {}) ⇒ Types::CreateTaskResponse
Creates a task. A task is a set of two locations (source and destination) and a set of Options that you use to control the behavior of a task. If you don't specify Options when you create a task, AWS DataSync populates them with service defaults.
When you create a task, it first enters the CREATING state. During CREATING AWS DataSync attempts to mount the on-premises Network File System (NFS) location. The task transitions to the AVAILABLE state without waiting for the AWS location to become mounted. If required, AWS DataSync mounts the AWS location before each task execution.
If an agent that is associated with a source (NFS) location goes offline, the task transitions to the UNAVAILABLE status. If the status of the task remains in the CREATING status for more than a few minutes, it means that your agent might be having trouble mounting the source NFS file system. Check the task's ErrorCode and ErrorDetail. Mount issues are often caused by either a misconfigured firewall or a mistyped NFS server hostname.
#delete_agent(options = {}) ⇒ Struct
Deletes an agent. To specify which agent to delete, use the Amazon Resource Name (ARN) of the agent in your request. The operation disassociates the agent from your AWS account. However, it doesn't delete the agent virtual machine (VM) from your on-premises environment.
#delete_location(options = {}) ⇒ Struct
Deletes the configuration of a location used by AWS DataSync.
#delete_task(options = {}) ⇒ Struct
Deletes a task.
#describe_agent(options = {}) ⇒ Types::DescribeAgentResponse
Returns metadata such as the name, the network interfaces, and the status (that is, whether the agent is running or not) for an agent. To specify which agent to describe, use the Amazon Resource Name (ARN) of the agent in your request.
#describe_location_efs(options = {}) ⇒ Types::DescribeLocationEfsResponse
Returns metadata, such as the path information about an Amazon EFS location.
#describe_location_fsx_windows(options = {}) ⇒ Types::DescribeLocationFsxWindowsResponse
Returns metadata, such as the path information about an Amazon FSx for Windows location.
#describe_location_nfs(options = {}) ⇒ Types::DescribeLocationNfsResponse
Returns metadata, such as the path information, about an NFS location.
#describe_location_object_storage(options = {}) ⇒ Types::DescribeLocationObjectStorageResponse
Returns metadata about a self-managed object storage server location. For more information about self-managed object storage locations, see create-object-location.
#describe_location_s3(options = {}) ⇒ Types::DescribeLocationS3Response
Returns metadata, such as bucket name, about an Amazon S3 bucket location.
#describe_location_smb(options = {}) ⇒ Types::DescribeLocationSmbResponse
Returns metadata, such as the path and user information about an SMB location.
#describe_task(options = {}) ⇒ Types::DescribeTaskResponse
Returns metadata about a task.
#describe_task_execution(options = {}) ⇒ Types::DescribeTaskExecutionResponse
Returns detailed metadata about a task that is being executed.
#list_agents(options = {}) ⇒ Types::ListAgentsResponse
Returns a list of agents owned by an AWS account in the AWS Region specified in the request. The returned list is ordered by agent Amazon Resource Name (ARN).
By default, this operation returns a maximum of 100 agents. This operation supports pagination that enables you to optionally reduce the number of agents returned in a response.
If you have more agents than are returned in a response (that is, the response returns only a truncated list of your agents), the response contains a marker that you can specify in your next request to fetch the next page of agents.
#list_locations(options = {}) ⇒ Types::ListLocationsResponse
Returns a list of source and destination locations.
If you have more locations than are returned in a response (that is, the response returns only a truncated list of your agents), the response contains a token that you can specify in your next request to fetch the next page of locations.
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Returns all the tags associated with a specified resource.
#list_task_executions(options = {}) ⇒ Types::ListTaskExecutionsResponse
Returns a list of executed tasks.
#list_tasks(options = {}) ⇒ Types::ListTasksResponse
Returns a list of all the tasks.
#start_task_execution(options = {}) ⇒ Types::StartTaskExecutionResponse
Starts a specific invocation of a task. A TaskExecution
value represents an individual run of a task. Each task can have at most one TaskExecution
at a time.
TaskExecution
has the following transition phases: INITIALIZING | PREPARING | TRANSFERRING | VERIFYING | SUCCESS/FAILURE.
For detailed information, see the Task Execution section in the Components and Terminology topic in the AWS DataSync User Guide.
#tag_resource(options = {}) ⇒ Struct
Applies a key-value pair to an AWS resource.
#untag_resource(options = {}) ⇒ Struct
Removes a tag from an AWS resource.
#update_agent(options = {}) ⇒ Struct
Updates the name of an agent.
#update_task(options = {}) ⇒ Struct
Updates the metadata associated with a task.
#update_task_execution(options = {}) ⇒ Struct
Updates execution of a task.
You can modify bandwidth throttling for a task execution that is running or queued. For more information, see Adjusting Bandwidth Throttling for a Task Execution.
The only Option
that can be modified by UpdateTaskExecution
is BytesPerSecond
.
#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: |
---|