You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::WorkSpaces::Client OverviewAn API client for Amazon WorkSpaces. To construct a client, you need to configure a :region
and :credentials
.
workspaces = Aws::WorkSpaces::Client.new(
region: region_name,
credentials: credentials,
)
See #initialize for a full list of supported configuration options.
RegionYou can configure a default region in the following locations:
ENV['AWS_REGION']
Aws.config[:region]
Go here for a list of supported regions.
CredentialsDefault credentials are loaded automatically from the following locations:
ENV['AWS_ACCESS_KEY_ID']
and ENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
~/.aws/credentials
(more information)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
:
creds = YAML.load(File.read('/path/to/secrets'))
Aws::WorkSpaces::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.
Attribute Summary collapseConstructs an API client.
Associates the specified connection alias with the specified directory to enable cross-Region redirection.
Associates the specified IP access control group with the specified directory.
.
Adds one or more rules to the specified IP access control group.
This action gives users permission to access their WorkSpaces from the CIDR address ranges specified in the rules.
.
Copies the specified image from the specified Region to the current Region.
Creates the specified connection alias for use with cross-Region redirection.
Creates an IP access control group.
An IP access control group provides you with the ability to control the IP addresses from which users are allowed to access their WorkSpaces.
Creates the specified tags for the specified WorkSpaces resource.
.
Creates one or more WorkSpaces.
This operation is asynchronous and returns before the WorkSpaces are created.
.
Deletes the specified connection alias.
Deletes the specified IP access control group.
You cannot delete an IP access control group that is associated with a directory.
.
Deletes the specified tags from the specified WorkSpaces resource.
.
Deletes the specified image from your account.
Deregisters the specified directory.
Retrieves a list that describes the configuration of Bring Your Own License (BYOL) for the specified account.
.
Retrieves a list that describes modifications to the configuration of Bring Your Own License (BYOL) for the specified account.
.
Retrieves a list that describes one or more specified Amazon WorkSpaces clients.
.
Describes the permissions that the owner of a connection alias has granted to another AWS account for the specified connection alias.
Retrieves a list that describes the connection aliases used for cross-Region redirection.
Describes one or more of your IP access control groups.
.
Describes the specified tags for the specified WorkSpaces resource.
.
Retrieves a list that describes the available WorkSpace bundles.
You can filter the results using either bundle ID or owner, but not both.
.
Describes the available directories that are registered with Amazon WorkSpaces.
.
Describes the permissions that the owner of an image has granted to other AWS accounts for an image.
.
Retrieves a list that describes one or more specified images, if the image identifiers are provided.
Describes the snapshots for the specified WorkSpace.
.
Describes the specified WorkSpaces.
You can filter the results by using the bundle identifier, directory identifier, or owner, but you can specify only one filter at a time.
.
Describes the connection status of the specified WorkSpaces.
.
Disassociates a connection alias from a directory.
Disassociates the specified IP access control group from the specified directory.
.
Imports the specified Windows 10 Bring Your Own License (BYOL) image into Amazon WorkSpaces.
Retrieves a list of IP address ranges, specified as IPv4 CIDR blocks, that you can use for the network management interface when you enable Bring Your Own License (BYOL).
Migrates a WorkSpace from one operating system or bundle type to another, while retaining the data on the user volume.
The migration process recreates the WorkSpace by using a new root volume from the target bundle image and the user volume from the last available snapshot of the original WorkSpace.
Modifies the configuration of Bring Your Own License (BYOL) for the specified account.
.
Modifies the properties of the specified Amazon WorkSpaces clients.
.
Modifies the self-service WorkSpace management capabilities for your users.
Specifies which devices and operating systems users can use to access their WorkSpaces.
Modify the default properties used to create WorkSpaces.
.
Modifies the specified WorkSpace properties.
Sets the state of the specified WorkSpace.
To maintain a WorkSpace without being interrupted, set the WorkSpace state to ADMIN_MAINTENANCE
.
Reboots the specified WorkSpaces.
You cannot reboot a WorkSpace unless its state is AVAILABLE
or UNHEALTHY
.
This operation is asynchronous and returns before the WorkSpaces have rebooted.
.
Rebuilds the specified WorkSpace.
You cannot rebuild a WorkSpace unless its state is AVAILABLE
, ERROR
, UNHEALTHY
, STOPPED
, or REBOOTING
.
Rebuilding a WorkSpace is a potentially destructive action that can result in the loss of data.
Registers the specified directory.
Restores the specified WorkSpace to its last known healthy state.
You cannot restore a WorkSpace unless its state is AVAILABLE
, ERROR
, UNHEALTHY
, or STOPPED
.
Restoring a WorkSpace is a potentially destructive action that can result in the loss of data.
Removes one or more rules from the specified IP access control group.
.
Starts the specified WorkSpaces.
You cannot start a WorkSpace unless it has a running mode of AutoStop
and a state of STOPPED
.
.
Stops the specified WorkSpaces.
You cannot stop a WorkSpace unless it has a running mode of AutoStop
and a state of AVAILABLE
, IMPAIRED
, UNHEALTHY
, or ERROR
.
.
Terminates the specified WorkSpaces.
Terminating a WorkSpace is a permanent action and cannot be undone.
Shares or unshares a connection alias with one account by specifying whether that account has permission to associate the connection alias with a directory.
Replaces the current rules of the specified IP access control group with the specified rules.
.
Shares or unshares an image with one account by specifying whether that account has permission to copy the image.
Waiters polls an API operation until a resource enters a desired state.
Returns the list of supported waiters.
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
Instance Method Details #associate_ip_groups(options = {}) ⇒ StructAssociates the specified IP access control group with the specified directory.
Adds one or more rules to the specified IP access control group.
This action gives users permission to access their WorkSpaces from the CIDR address ranges specified in the rules.
#create_ip_group(options = {}) ⇒ Types::CreateIpGroupResultCreates an IP access control group.
An IP access control group provides you with the ability to control the IP addresses from which users are allowed to access their WorkSpaces. To specify the CIDR address ranges, add rules to your IP access control group and then associate the group with your directory. You can add rules when you create the group or at any time using AuthorizeIpRules.
There is a default IP access control group associated with your directory. If you don't associate an IP access control group with your directory, the default group is used. The default group includes a default rule that allows users to access their WorkSpaces from anywhere. You cannot modify the default IP access control group for your directory.
#create_tags(options = {}) ⇒ StructCreates the specified tags for the specified WorkSpaces resource.
#create_workspaces(options = {}) ⇒ Types::CreateWorkspacesResultCreates one or more WorkSpaces.
This operation is asynchronous and returns before the WorkSpaces are created.
#delete_connection_alias(options = {}) ⇒ StructDeletes the specified connection alias. For more information, see Cross-Region Redirection for Amazon WorkSpaces.
If you will no longer be using a fully qualified domain name (FQDN) as the registration code for your WorkSpaces users, you must take certain precautions to prevent potential security issues. For more information, see Security Considerations if You Stop Using Cross-Region Redirection.
To delete a connection alias that has been shared, the shared account must first disassociate the connection alias from any directories it has been associated with. Then you must unshare the connection alias from the account it has been shared with. You can delete a connection alias only after it is no longer shared with any accounts or associated with any directories.
#delete_ip_group(options = {}) ⇒ StructDeletes the specified IP access control group.
You cannot delete an IP access control group that is associated with a directory.
#delete_tags(options = {}) ⇒ StructDeletes the specified tags from the specified WorkSpaces resource.
#delete_workspace_image(options = {}) ⇒ StructDeletes the specified image from your account. To delete an image, you must first delete any bundles that are associated with the image and unshare the image if it is shared with other accounts.
#deregister_workspace_directory(options = {}) ⇒ StructDeregisters the specified directory. This operation is asynchronous and returns before the WorkSpace directory is deregistered. If any WorkSpaces are registered to this directory, you must remove them before you can deregister the directory.
#describe_account(options = {}) ⇒ Types::DescribeAccountResultRetrieves a list that describes the configuration of Bring Your Own License (BYOL) for the specified account.
#describe_account_modifications(options = {}) ⇒ Types::DescribeAccountModificationsResultRetrieves a list that describes modifications to the configuration of Bring Your Own License (BYOL) for the specified account.
#describe_workspace_bundles(options = {}) ⇒ Types::DescribeWorkspaceBundlesResultRetrieves a list that describes the available WorkSpace bundles.
You can filter the results using either bundle ID or owner, but not both.
#describe_workspace_images(options = {}) ⇒ Types::DescribeWorkspaceImagesResultRetrieves a list that describes one or more specified images, if the image identifiers are provided. Otherwise, all images in the account are described.
#describe_workspaces(options = {}) ⇒ Types::DescribeWorkspacesResultDescribes the specified WorkSpaces.
You can filter the results by using the bundle identifier, directory identifier, or owner, but you can specify only one filter at a time.
#disassociate_connection_alias(options = {}) ⇒ StructDisassociates a connection alias from a directory. Disassociating a connection alias disables cross-Region redirection between two directories in different AWS Regions. For more information, see Cross-Region Redirection for Amazon WorkSpaces.
Before performing this operation, call DescribeConnectionAliases to make sure that the current state of the connection alias is CREATED
.
Disassociates the specified IP access control group from the specified directory.
#import_workspace_image(options = {}) ⇒ Types::ImportWorkspaceImageResultImports the specified Windows 10 Bring Your Own License (BYOL) image into Amazon WorkSpaces. The image must be an already licensed Amazon EC2 image that is in your AWS account, and you must own the image. For more information about creating BYOL images, see Bring Your Own Windows Desktop Licenses.
#list_available_management_cidr_ranges(options = {}) ⇒ Types::ListAvailableManagementCidrRangesResultRetrieves a list of IP address ranges, specified as IPv4 CIDR blocks, that you can use for the network management interface when you enable Bring Your Own License (BYOL).
This operation can be run only by AWS accounts that are enabled for BYOL. If your account isn't enabled for BYOL, you'll receive an AccessDeniedException
error.
The management network interface is connected to a secure Amazon WorkSpaces management network. It is used for interactive streaming of the WorkSpace desktop to Amazon WorkSpaces clients, and to allow Amazon WorkSpaces to manage the WorkSpace.
#migrate_workspace(options = {}) ⇒ Types::MigrateWorkspaceResultMigrates a WorkSpace from one operating system or bundle type to another, while retaining the data on the user volume.
The migration process recreates the WorkSpace by using a new root volume from the target bundle image and the user volume from the last available snapshot of the original WorkSpace. During migration, the original D:\Users\%USERNAME%
user profile folder is renamed to D:\Users\%USERNAME%MMddyyTHHmmss%.NotMigrated
. A new D:\Users\%USERNAME%\
folder is generated by the new OS. Certain files in the old user profile are moved to the new user profile.
For available migration scenarios, details about what happens during migration, and best practices, see Migrate a WorkSpace.
#modify_account(options = {}) ⇒ StructModifies the configuration of Bring Your Own License (BYOL) for the specified account.
#modify_client_properties(options = {}) ⇒ StructModifies the properties of the specified Amazon WorkSpaces clients.
#modify_selfservice_permissions(options = {}) ⇒ Struct #modify_workspace_access_properties(options = {}) ⇒ StructSpecifies which devices and operating systems users can use to access their WorkSpaces. For more information, see Control Device Access.
#modify_workspace_creation_properties(options = {}) ⇒ StructModify the default properties used to create WorkSpaces.
#modify_workspace_properties(options = {}) ⇒ StructModifies the specified WorkSpace properties. For important information about how to modify the size of the root and user volumes, see Modify a WorkSpace.
#modify_workspace_state(options = {}) ⇒ StructSets the state of the specified WorkSpace.
To maintain a WorkSpace without being interrupted, set the WorkSpace state to ADMIN_MAINTENANCE
. WorkSpaces in this state do not respond to requests to reboot, stop, start, rebuild, or restore. An AutoStop WorkSpace in this state is not stopped. Users cannot log into a WorkSpace in the ADMIN_MAINTENANCE
state.
Reboots the specified WorkSpaces.
You cannot reboot a WorkSpace unless its state is AVAILABLE
or UNHEALTHY
.
This operation is asynchronous and returns before the WorkSpaces have rebooted.
#rebuild_workspaces(options = {}) ⇒ Types::RebuildWorkspacesResultRebuilds the specified WorkSpace.
You cannot rebuild a WorkSpace unless its state is AVAILABLE
, ERROR
, UNHEALTHY
, STOPPED
, or REBOOTING
.
Rebuilding a WorkSpace is a potentially destructive action that can result in the loss of data. For more information, see Rebuild a WorkSpace.
This operation is asynchronous and returns before the WorkSpaces have been completely rebuilt.
#register_workspace_directory(options = {}) ⇒ StructRegisters the specified directory. This operation is asynchronous and returns before the WorkSpace directory is registered. If this is the first time you are registering a directory, you will need to create the workspaces_DefaultRole role before you can register a directory. For more information, see Creating the workspaces_DefaultRole Role.
#restore_workspace(options = {}) ⇒ StructRestores the specified WorkSpace to its last known healthy state.
You cannot restore a WorkSpace unless its state is AVAILABLE
, ERROR
, UNHEALTHY
, or STOPPED
.
Restoring a WorkSpace is a potentially destructive action that can result in the loss of data. For more information, see Restore a WorkSpace.
This operation is asynchronous and returns before the WorkSpace is completely restored.
#revoke_ip_rules(options = {}) ⇒ StructRemoves one or more rules from the specified IP access control group.
#start_workspaces(options = {}) ⇒ Types::StartWorkspacesResultStarts the specified WorkSpaces.
You cannot start a WorkSpace unless it has a running mode of AutoStop
and a state of STOPPED
.
Stops the specified WorkSpaces.
You cannot stop a WorkSpace unless it has a running mode of AutoStop
and a state of AVAILABLE
, IMPAIRED
, UNHEALTHY
, or ERROR
.
Terminates the specified WorkSpaces.
Terminating a WorkSpace is a permanent action and cannot be undone. The user's data is destroyed. If you need to archive any user data, contact AWS Support before terminating the WorkSpace.
You can terminate a WorkSpace that is in any state except SUSPENDED
.
This operation is asynchronous and returns before the WorkSpaces have been completely terminated. After a WorkSpace is terminated, the TERMINATED
state is returned only briefly before the WorkSpace directory metadata is cleaned up, so this state is rarely returned. To confirm that a WorkSpace is terminated, check for the WorkSpace ID by using DescribeWorkSpaces. If the WorkSpace ID isn't returned, then the WorkSpace has been successfully terminated.
Shares or unshares a connection alias with one account by specifying whether that account has permission to associate the connection alias with a directory. If the association permission is granted, the connection alias is shared with that account. If the association permission is revoked, the connection alias is unshared with the account. For more information, see Cross-Region Redirection for Amazon WorkSpaces.
Before performing this operation, call DescribeConnectionAliases to make sure that the current state of the connection alias is CREATED
.
To delete a connection alias that has been shared, the shared account must first disassociate the connection alias from any directories it has been associated with. Then you must unshare the connection alias from the account it has been shared with. You can delete a connection alias only after it is no longer shared with any accounts or associated with any directories.
Replaces the current rules of the specified IP access control group with the specified rules.
#update_workspace_image_permission(options = {}) ⇒ StructShares or unshares an image with one account by specifying whether that account has permission to copy the image. If the copy image permission is granted, the image is shared with that account. If the copy image permission is revoked, the image is unshared with the account. For more information about sharing images, see Share or Unshare a Custom WorkSpaces Image.
To delete an image that has been shared, you must unshare the image before you delete it.
Sharing Bring Your Own License (BYOL) images across AWS accounts isn't supported at this time in the AWS GovCloud (US-West) Region. To share BYOL images across accounts in the AWS GovCloud (US-West) Region, contact AWS Support.
Waiters polls an API operation until a resource enters a desired state.
Basic UsageWaiters 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)
ConfigurationYou 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 Aws::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:RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4