Table of Contents
WorkSpaces.Client¶A low-level client representing Amazon WorkSpaces:
client = session.create_client('workspaces')
These are the available methods:
can_paginate()create_tags()create_workspaces()delete_tags()describe_tags()describe_workspace_bundles()describe_workspace_directories()describe_workspaces()describe_workspaces_connection_status()generate_presigned_url()get_paginator()get_waiter()modify_workspace_properties()reboot_workspaces()rebuild_workspaces()start_workspaces()stop_workspaces()terminate_workspaces()can_paginate(operation_name)¶Check if an operation can be paginated.
| Parameters: | operation_name (string) – The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you’d normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo"). |
|---|---|
| Returns: | True if the operation can be paginated,
False otherwise. |
Creates tags for a WorkSpace.
See also: AWS API Documentation
Request Syntax
response = client.create_tags(
ResourceId='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
create_workspaces(**kwargs)¶Creates one or more WorkSpaces.
Note
This operation is asynchronous and returns before the WorkSpaces are created.
See also: AWS API Documentation
Request Syntax
response = client.create_workspaces(
Workspaces=[
{
'DirectoryId': 'string',
'UserName': 'string',
'BundleId': 'string',
'VolumeEncryptionKey': 'string',
'UserVolumeEncryptionEnabled': True|False,
'RootVolumeEncryptionEnabled': True|False,
'WorkspaceProperties': {
'RunningMode': 'AUTO_STOP'|'ALWAYS_ON',
'RunningModeAutoStopTimeoutInMinutes': 123
},
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
)
| Parameters: | Workspaces (list) – [REQUIRED] An array of structures that specify the WorkSpaces to create.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'FailedRequests': [
{
'WorkspaceRequest': {
'DirectoryId': 'string',
'UserName': 'string',
'BundleId': 'string',
'VolumeEncryptionKey': 'string',
'UserVolumeEncryptionEnabled': True|False,
'RootVolumeEncryptionEnabled': True|False,
'WorkspaceProperties': {
'RunningMode': 'AUTO_STOP'|'ALWAYS_ON',
'RunningModeAutoStopTimeoutInMinutes': 123
},
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
],
'PendingRequests': [
{
'WorkspaceId': 'string',
'DirectoryId': 'string',
'UserName': 'string',
'IpAddress': 'string',
'State': 'PENDING'|'AVAILABLE'|'IMPAIRED'|'UNHEALTHY'|'REBOOTING'|'STARTING'|'REBUILDING'|'MAINTENANCE'|'TERMINATING'|'TERMINATED'|'SUSPENDED'|'STOPPING'|'STOPPED'|'ERROR',
'BundleId': 'string',
'SubnetId': 'string',
'ErrorMessage': 'string',
'ErrorCode': 'string',
'ComputerName': 'string',
'VolumeEncryptionKey': 'string',
'UserVolumeEncryptionEnabled': True|False,
'RootVolumeEncryptionEnabled': True|False,
'WorkspaceProperties': {
'RunningMode': 'AUTO_STOP'|'ALWAYS_ON',
'RunningModeAutoStopTimeoutInMinutes': 123
}
},
]
}
Response Structure
|
Deletes tags from a WorkSpace.
See also: AWS API Documentation
Request Syntax
response = client.delete_tags(
ResourceId='string',
TagKeys=[
'string',
]
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
Describes tags for a WorkSpace.
See also: AWS API Documentation
Request Syntax
response = client.describe_tags(
ResourceId='string'
)
| Parameters: | ResourceId (string) – [REQUIRED] The resource ID of the request. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'TagList': [
{
'Key': 'string',
'Value': 'string'
},
]
}
Response Structure
|
describe_workspace_bundles(**kwargs)¶Obtains information about the WorkSpace bundles that are available to your account in the specified region.
You can filter the results with either the BundleIds parameter, or the Owner parameter, but not both.
This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the NextToken response member contains a token that you pass in the next call to this operation to retrieve the next set of items.
See also: AWS API Documentation
Request Syntax
response = client.describe_workspace_bundles(
BundleIds=[
'string',
],
Owner='string',
NextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'Bundles': [
{
'BundleId': 'string',
'Name': 'string',
'Owner': 'string',
'Description': 'string',
'UserStorage': {
'Capacity': 'string'
},
'ComputeType': {
'Name': 'VALUE'|'STANDARD'|'PERFORMANCE'
}
},
],
'NextToken': 'string'
}
Response Structure
|
describe_workspace_directories(**kwargs)¶Retrieves information about the AWS Directory Service directories in the region that are registered with Amazon WorkSpaces and are available to your account.
This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the NextToken response member contains a token that you pass in the next call to this operation to retrieve the next set of items.
See also: AWS API Documentation
Request Syntax
response = client.describe_workspace_directories(
DirectoryIds=[
'string',
],
NextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'Directories': [
{
'DirectoryId': 'string',
'Alias': 'string',
'DirectoryName': 'string',
'RegistrationCode': 'string',
'SubnetIds': [
'string',
],
'DnsIpAddresses': [
'string',
],
'CustomerUserName': 'string',
'IamRoleId': 'string',
'DirectoryType': 'SIMPLE_AD'|'AD_CONNECTOR',
'WorkspaceSecurityGroupId': 'string',
'State': 'REGISTERING'|'REGISTERED'|'DEREGISTERING'|'DEREGISTERED'|'ERROR',
'WorkspaceCreationProperties': {
'EnableWorkDocs': True|False,
'EnableInternetAccess': True|False,
'DefaultOu': 'string',
'CustomSecurityGroupId': 'string',
'UserEnabledAsLocalAdministrator': True|False
}
},
],
'NextToken': 'string'
}
Response Structure
|
describe_workspaces(**kwargs)¶Obtains information about the specified WorkSpaces.
Only one of the filter parameters, such as BundleId , DirectoryId , or WorkspaceIds , can be specified at a time.
This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the NextToken response member contains a token that you pass in the next call to this operation to retrieve the next set of items.
See also: AWS API Documentation
Request Syntax
response = client.describe_workspaces(
WorkspaceIds=[
'string',
],
DirectoryId='string',
UserName='string',
BundleId='string',
Limit=123,
NextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'Workspaces': [
{
'WorkspaceId': 'string',
'DirectoryId': 'string',
'UserName': 'string',
'IpAddress': 'string',
'State': 'PENDING'|'AVAILABLE'|'IMPAIRED'|'UNHEALTHY'|'REBOOTING'|'STARTING'|'REBUILDING'|'MAINTENANCE'|'TERMINATING'|'TERMINATED'|'SUSPENDED'|'STOPPING'|'STOPPED'|'ERROR',
'BundleId': 'string',
'SubnetId': 'string',
'ErrorMessage': 'string',
'ErrorCode': 'string',
'ComputerName': 'string',
'VolumeEncryptionKey': 'string',
'UserVolumeEncryptionEnabled': True|False,
'RootVolumeEncryptionEnabled': True|False,
'WorkspaceProperties': {
'RunningMode': 'AUTO_STOP'|'ALWAYS_ON',
'RunningModeAutoStopTimeoutInMinutes': 123
}
},
],
'NextToken': 'string'
}
Response Structure
|
describe_workspaces_connection_status(**kwargs)¶Describes the connection status of a specified WorkSpace.
See also: AWS API Documentation
Request Syntax
response = client.describe_workspaces_connection_status(
WorkspaceIds=[
'string',
],
NextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'WorkspacesConnectionStatus': [
{
'WorkspaceId': 'string',
'ConnectionState': 'CONNECTED'|'DISCONNECTED'|'UNKNOWN',
'ConnectionStateCheckTimestamp': datetime(2015, 1, 1),
'LastKnownUserConnectionTimestamp': datetime(2015, 1, 1)
},
],
'NextToken': 'string'
}
Response Structure
|
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
| Parameters: |
|
|---|---|
| Returns: | The presigned url |
get_paginator(operation_name)¶Create a paginator for an operation.
| Parameters: | operation_name (string) – The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you’d normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo"). |
|---|---|
| Raises: | OperationNotPageableError – Raised if the operation is not
pageable. You can use the client.can_paginate method to
check if an operation is pageable. |
| Return type: | L{botocore.paginate.Paginator} |
| Returns: | A paginator object. |
get_waiter(waiter_name)¶modify_workspace_properties(**kwargs)¶Modifies the WorkSpace properties, including the running mode and AutoStop time.
See also: AWS API Documentation
Request Syntax
response = client.modify_workspace_properties(
WorkspaceId='string',
WorkspaceProperties={
'RunningMode': 'AUTO_STOP'|'ALWAYS_ON',
'RunningModeAutoStopTimeoutInMinutes': 123
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
reboot_workspaces(**kwargs)¶Reboots the specified WorkSpaces.
To be able to reboot a WorkSpace, the WorkSpace must have a State of AVAILABLE , IMPAIRED , or INOPERABLE .
Note
This operation is asynchronous and returns before the WorkSpaces have rebooted.
See also: AWS API Documentation
Request Syntax
response = client.reboot_workspaces(
RebootWorkspaceRequests=[
{
'WorkspaceId': 'string'
},
]
)
| Parameters: | RebootWorkspaceRequests (list) – [REQUIRED] An array of structures that specify the WorkSpaces to reboot.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'FailedRequests': [
{
'WorkspaceId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
|
rebuild_workspaces(**kwargs)¶Rebuilds the specified WorkSpaces.
Rebuilding a WorkSpace is a potentially destructive action that can result in the loss of data. Rebuilding a WorkSpace causes the following to occur:
To be able to rebuild a WorkSpace, the WorkSpace must have a State of AVAILABLE or ERROR .
Note
This operation is asynchronous and returns before the WorkSpaces have been completely rebuilt.
See also: AWS API Documentation
Request Syntax
response = client.rebuild_workspaces(
RebuildWorkspaceRequests=[
{
'WorkspaceId': 'string'
},
]
)
| Parameters: | RebuildWorkspaceRequests (list) – [REQUIRED] An array of structures that specify the WorkSpaces to rebuild.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'FailedRequests': [
{
'WorkspaceId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
|
start_workspaces(**kwargs)¶Starts the specified WorkSpaces. The WorkSpaces must have a running mode of AutoStop and a state of STOPPED.
See also: AWS API Documentation
Request Syntax
response = client.start_workspaces(
StartWorkspaceRequests=[
{
'WorkspaceId': 'string'
},
]
)
| Parameters: | StartWorkspaceRequests (list) – [REQUIRED] The requests.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'FailedRequests': [
{
'WorkspaceId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
|
stop_workspaces(**kwargs)¶Stops the specified WorkSpaces. The WorkSpaces must have a running mode of AutoStop and a state of AVAILABLE, IMPAIRED, UNHEALTHY, or ERROR.
See also: AWS API Documentation
Request Syntax
response = client.stop_workspaces(
StopWorkspaceRequests=[
{
'WorkspaceId': 'string'
},
]
)
| Parameters: | StopWorkspaceRequests (list) – [REQUIRED] The requests.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'FailedRequests': [
{
'WorkspaceId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
|
terminate_workspaces(**kwargs)¶Terminates the specified WorkSpaces.
Terminating a WorkSpace is a permanent action and cannot be undone. The user’s data is not maintained and will be destroyed. If you need to archive any user data, contact Amazon Web Services before terminating the WorkSpace.
You can terminate a WorkSpace that is in any state except SUSPENDED .
Note
This operation is asynchronous and returns before the WorkSpaces have been completely terminated.
See also: AWS API Documentation
Request Syntax
response = client.terminate_workspaces(
TerminateWorkspaceRequests=[
{
'WorkspaceId': 'string'
},
]
)
| Parameters: | TerminateWorkspaceRequests (list) – [REQUIRED] An array of structures that specify the WorkSpaces to terminate.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'FailedRequests': [
{
'WorkspaceId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
|
The available paginators are:
WorkSpaces.Paginator.DescribeWorkspaceBundlesWorkSpaces.Paginator.DescribeWorkspaceDirectoriesWorkSpaces.Paginator.DescribeWorkspacesWorkSpaces.Paginator.DescribeWorkspaceBundles¶paginator = client.get_paginator('describe_workspace_bundles')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from WorkSpaces.Client.describe_workspace_bundles().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
BundleIds=[
'string',
],
Owner='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'Bundles': [
{
'BundleId': 'string',
'Name': 'string',
'Owner': 'string',
'Description': 'string',
'UserStorage': {
'Capacity': 'string'
},
'ComputeType': {
'Name': 'VALUE'|'STANDARD'|'PERFORMANCE'
}
},
],
}
Response Structure
|
WorkSpaces.Paginator.DescribeWorkspaceDirectories¶paginator = client.get_paginator('describe_workspace_directories')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from WorkSpaces.Client.describe_workspace_directories().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
DirectoryIds=[
'string',
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'Directories': [
{
'DirectoryId': 'string',
'Alias': 'string',
'DirectoryName': 'string',
'RegistrationCode': 'string',
'SubnetIds': [
'string',
],
'DnsIpAddresses': [
'string',
],
'CustomerUserName': 'string',
'IamRoleId': 'string',
'DirectoryType': 'SIMPLE_AD'|'AD_CONNECTOR',
'WorkspaceSecurityGroupId': 'string',
'State': 'REGISTERING'|'REGISTERED'|'DEREGISTERING'|'DEREGISTERED'|'ERROR',
'WorkspaceCreationProperties': {
'EnableWorkDocs': True|False,
'EnableInternetAccess': True|False,
'DefaultOu': 'string',
'CustomSecurityGroupId': 'string',
'UserEnabledAsLocalAdministrator': True|False
}
},
],
}
Response Structure
|
WorkSpaces.Paginator.DescribeWorkspaces¶paginator = client.get_paginator('describe_workspaces')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from WorkSpaces.Client.describe_workspaces().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
WorkspaceIds=[
'string',
],
DirectoryId='string',
UserName='string',
BundleId='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'Workspaces': [
{
'WorkspaceId': 'string',
'DirectoryId': 'string',
'UserName': 'string',
'IpAddress': 'string',
'State': 'PENDING'|'AVAILABLE'|'IMPAIRED'|'UNHEALTHY'|'REBOOTING'|'STARTING'|'REBUILDING'|'MAINTENANCE'|'TERMINATING'|'TERMINATED'|'SUSPENDED'|'STOPPING'|'STOPPED'|'ERROR',
'BundleId': 'string',
'SubnetId': 'string',
'ErrorMessage': 'string',
'ErrorCode': 'string',
'ComputerName': 'string',
'VolumeEncryptionKey': 'string',
'UserVolumeEncryptionEnabled': True|False,
'RootVolumeEncryptionEnabled': True|False,
'WorkspaceProperties': {
'RunningMode': 'AUTO_STOP'|'ALWAYS_ON',
'RunningModeAutoStopTimeoutInMinutes': 123
}
},
],
}
Response Structure
|