You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::WorkDocs::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::WorkDocs::Client
- Defined in:
- (unknown)
Overview
An API client for Amazon WorkDocs. To construct a client, you need to configure a :region
and :credentials
.
workdocs = Aws::WorkDocs::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::WorkDocs::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::WorkDocs::Client
constructor
Constructs an API client.
API Operations collapse
-
#abort_document_version_upload(options = {}) ⇒ Struct
Aborts the upload of the specified document version that was previously initiated by InitiateDocumentVersionUpload.
-
#activate_user(options = {}) ⇒ Types::ActivateUserResponse
Activates the specified user.
-
#add_resource_permissions(options = {}) ⇒ Types::AddResourcePermissionsResponse
Creates a set of permissions for the specified folder or document.
-
#create_comment(options = {}) ⇒ Types::CreateCommentResponse
Adds a new comment to the specified document version.
.
-
#create_custom_metadata(options = {}) ⇒ Struct
Adds one or more custom properties to the specified resource (a folder, document, or version).
.
-
#create_folder(options = {}) ⇒ Types::CreateFolderResponse
Creates a folder with the specified name and parent folder.
.
-
#create_labels(options = {}) ⇒ Struct
Adds the specified list of labels to the given resource (a document or folder)
.
-
#create_notification_subscription(options = {}) ⇒ Types::CreateNotificationSubscriptionResponse
Configure Amazon WorkDocs to use Amazon SNS notifications.
-
#create_user(options = {}) ⇒ Types::CreateUserResponse
Creates a user in a Simple AD or Microsoft AD directory.
-
#deactivate_user(options = {}) ⇒ Struct
Deactivates the specified user, which revokes the user's access to Amazon WorkDocs.
.
-
#delete_comment(options = {}) ⇒ Struct
Deletes the specified comment from the document version.
.
-
#delete_custom_metadata(options = {}) ⇒ Struct
Deletes custom metadata from the specified resource.
.
-
#delete_document(options = {}) ⇒ Struct
Permanently deletes the specified document and its associated metadata.
.
-
#delete_folder(options = {}) ⇒ Struct
Permanently deletes the specified folder and its contents.
.
-
#delete_folder_contents(options = {}) ⇒ Struct
Deletes the contents of the specified folder.
.
-
#delete_labels(options = {}) ⇒ Struct
Deletes the specified list of labels from a resource.
.
-
#delete_notification_subscription(options = {}) ⇒ Struct
Deletes the specified subscription from the specified organization.
.
-
#delete_user(options = {}) ⇒ Struct
Deletes the specified user from a Simple AD or Microsoft AD directory.
.
-
#describe_activities(options = {}) ⇒ Types::DescribeActivitiesResponse
Describes the user activities in a specified time period.
.
-
#describe_comments(options = {}) ⇒ Types::DescribeCommentsResponse
List all the comments for the specified document version.
.
-
#describe_document_versions(options = {}) ⇒ Types::DescribeDocumentVersionsResponse
Retrieves the document versions for the specified document.
By default, only active versions are returned.
. -
#describe_folder_contents(options = {}) ⇒ Types::DescribeFolderContentsResponse
Describes the contents of the specified folder, including its documents and subfolders.
By default, Amazon WorkDocs returns the first 100 active document and folder metadata items.
-
#describe_groups(options = {}) ⇒ Types::DescribeGroupsResponse
Describes the groups specified by the query.
-
#describe_notification_subscriptions(options = {}) ⇒ Types::DescribeNotificationSubscriptionsResponse
Lists the specified notification subscriptions.
.
-
#describe_resource_permissions(options = {}) ⇒ Types::DescribeResourcePermissionsResponse
Describes the permissions of a specified resource.
.
-
#describe_root_folders(options = {}) ⇒ Types::DescribeRootFoldersResponse
Describes the current user's special folders; the
RootFolder
and theRecycleBin
. -
#describe_users(options = {}) ⇒ Types::DescribeUsersResponse
Describes the specified users.
-
#get_current_user(options = {}) ⇒ Types::GetCurrentUserResponse
Retrieves details of the current user for whom the authentication token was generated.
-
#get_document(options = {}) ⇒ Types::GetDocumentResponse
Retrieves details of a document.
.
-
#get_document_path(options = {}) ⇒ Types::GetDocumentPathResponse
Retrieves the path information (the hierarchy from the root folder) for the requested document.
By default, Amazon WorkDocs returns a maximum of 100 levels upwards from the requested document and only includes the IDs of the parent folders in the path.
-
#get_document_version(options = {}) ⇒ Types::GetDocumentVersionResponse
Retrieves version metadata for the specified document.
.
-
#get_folder(options = {}) ⇒ Types::GetFolderResponse
Retrieves the metadata of the specified folder.
.
-
#get_folder_path(options = {}) ⇒ Types::GetFolderPathResponse
Retrieves the path information (the hierarchy from the root folder) for the specified folder.
By default, Amazon WorkDocs returns a maximum of 100 levels upwards from the requested folder and only includes the IDs of the parent folders in the path.
-
#get_resources(options = {}) ⇒ Types::GetResourcesResponse
Retrieves a collection of resources, including folders and documents.
-
#initiate_document_version_upload(options = {}) ⇒ Types::InitiateDocumentVersionUploadResponse
Creates a new document object and version object.
The client specifies the parent folder ID and name of the document to upload.
-
#remove_all_resource_permissions(options = {}) ⇒ Struct
Removes all the permissions from the specified resource.
.
-
#remove_resource_permission(options = {}) ⇒ Struct
Removes the permission for the specified principal from the specified resource.
.
-
#update_document(options = {}) ⇒ Struct
Updates the specified attributes of a document.
-
#update_document_version(options = {}) ⇒ Struct
Changes the status of the document version to ACTIVE.
-
#update_folder(options = {}) ⇒ Struct
Updates the specified attributes of the specified folder.
-
#update_user(options = {}) ⇒ Types::UpdateUserResponse
Updates the specified attributes of the specified user, and grants or revokes administrative privileges to the Amazon WorkDocs site.
.
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::WorkDocs::Client
Constructs an API client.
Instance Method Details
#abort_document_version_upload(options = {}) ⇒ Struct
Aborts the upload of the specified document version that was previously initiated by InitiateDocumentVersionUpload. The client should make this call only when it no longer intends to upload the document version, or fails to do so.
#activate_user(options = {}) ⇒ Types::ActivateUserResponse
Activates the specified user. Only active users can access Amazon WorkDocs.
#add_resource_permissions(options = {}) ⇒ Types::AddResourcePermissionsResponse
Creates a set of permissions for the specified folder or document. The resource permissions are overwritten if the principals already have different permissions.
#create_comment(options = {}) ⇒ Types::CreateCommentResponse
Adds a new comment to the specified document version.
#create_custom_metadata(options = {}) ⇒ Struct
Adds one or more custom properties to the specified resource (a folder, document, or version).
#create_folder(options = {}) ⇒ Types::CreateFolderResponse
Creates a folder with the specified name and parent folder.
#create_labels(options = {}) ⇒ Struct
Adds the specified list of labels to the given resource (a document or folder)
#create_notification_subscription(options = {}) ⇒ Types::CreateNotificationSubscriptionResponse
Configure Amazon WorkDocs to use Amazon SNS notifications. The endpoint receives a confirmation message, and must confirm the subscription.
For more information, see Subscribe to Notifications in the Amazon WorkDocs Developer Guide.
#create_user(options = {}) ⇒ Types::CreateUserResponse
Creates a user in a Simple AD or Microsoft AD directory. The status of a newly created user is "ACTIVE". New users can access Amazon WorkDocs.
#deactivate_user(options = {}) ⇒ Struct
Deactivates the specified user, which revokes the user's access to Amazon WorkDocs.
#delete_comment(options = {}) ⇒ Struct
Deletes the specified comment from the document version.
#delete_custom_metadata(options = {}) ⇒ Struct
Deletes custom metadata from the specified resource.
#delete_document(options = {}) ⇒ Struct
Permanently deletes the specified document and its associated metadata.
#delete_folder(options = {}) ⇒ Struct
Permanently deletes the specified folder and its contents.
#delete_folder_contents(options = {}) ⇒ Struct
Deletes the contents of the specified folder.
#delete_labels(options = {}) ⇒ Struct
Deletes the specified list of labels from a resource.
#delete_notification_subscription(options = {}) ⇒ Struct
Deletes the specified subscription from the specified organization.
#delete_user(options = {}) ⇒ Struct
Deletes the specified user from a Simple AD or Microsoft AD directory.
#describe_activities(options = {}) ⇒ Types::DescribeActivitiesResponse
Describes the user activities in a specified time period.
#describe_comments(options = {}) ⇒ Types::DescribeCommentsResponse
List all the comments for the specified document version.
#describe_document_versions(options = {}) ⇒ Types::DescribeDocumentVersionsResponse
Retrieves the document versions for the specified document.
By default, only active versions are returned.
#describe_folder_contents(options = {}) ⇒ Types::DescribeFolderContentsResponse
Describes the contents of the specified folder, including its documents and subfolders.
By default, Amazon WorkDocs returns the first 100 active document and folder metadata items. If there are more results, the response includes a marker that you can use to request the next set of results. You can also request initialized documents.
#describe_groups(options = {}) ⇒ Types::DescribeGroupsResponse
Describes the groups specified by the query. Groups are defined by the underlying Active Directory.
#describe_notification_subscriptions(options = {}) ⇒ Types::DescribeNotificationSubscriptionsResponse
Lists the specified notification subscriptions.
#describe_resource_permissions(options = {}) ⇒ Types::DescribeResourcePermissionsResponse
Describes the permissions of a specified resource.
#describe_root_folders(options = {}) ⇒ Types::DescribeRootFoldersResponse
Describes the current user's special folders; the RootFolder
and the RecycleBin
. RootFolder
is the root of user's files and folders and RecycleBin
is the root of recycled items. This is not a valid action for SigV4 (administrative API) clients.
This action requires an authentication token. To get an authentication token, register an application with Amazon WorkDocs. For more information, see Authentication and Access Control for User Applications in the Amazon WorkDocs Developer Guide.
#describe_users(options = {}) ⇒ Types::DescribeUsersResponse
Describes the specified users. You can describe all users or filter the results (for example, by status or organization).
By default, Amazon WorkDocs returns the first 24 active or pending users. If there are more results, the response includes a marker that you can use to request the next set of results.
#get_current_user(options = {}) ⇒ Types::GetCurrentUserResponse
Retrieves details of the current user for whom the authentication token was generated. This is not a valid action for SigV4 (administrative API) clients.
This action requires an authentication token. To get an authentication token, register an application with Amazon WorkDocs. For more information, see Authentication and Access Control for User Applications in the Amazon WorkDocs Developer Guide.
#get_document(options = {}) ⇒ Types::GetDocumentResponse
Retrieves details of a document.
#get_document_path(options = {}) ⇒ Types::GetDocumentPathResponse
Retrieves the path information (the hierarchy from the root folder) for the requested document.
By default, Amazon WorkDocs returns a maximum of 100 levels upwards from the requested document and only includes the IDs of the parent folders in the path. You can limit the maximum number of levels. You can also request the names of the parent folders.
#get_document_version(options = {}) ⇒ Types::GetDocumentVersionResponse
Retrieves version metadata for the specified document.
#get_folder(options = {}) ⇒ Types::GetFolderResponse
Retrieves the metadata of the specified folder.
#get_folder_path(options = {}) ⇒ Types::GetFolderPathResponse
Retrieves the path information (the hierarchy from the root folder) for the specified folder.
By default, Amazon WorkDocs returns a maximum of 100 levels upwards from the requested folder and only includes the IDs of the parent folders in the path. You can limit the maximum number of levels. You can also request the parent folder names.
#get_resources(options = {}) ⇒ Types::GetResourcesResponse
Retrieves a collection of resources, including folders and documents. The only CollectionType
supported is SHARED_WITH_ME
.
#initiate_document_version_upload(options = {}) ⇒ Types::InitiateDocumentVersionUploadResponse
Creates a new document object and version object.
The client specifies the parent folder ID and name of the document to upload. The ID is optionally specified when creating a new version of an existing document. This is the first step to upload a document. Next, upload the document to the URL returned from the call, and then call UpdateDocumentVersion.
To cancel the document upload, call AbortDocumentVersionUpload.
#remove_all_resource_permissions(options = {}) ⇒ Struct
Removes all the permissions from the specified resource.
#remove_resource_permission(options = {}) ⇒ Struct
Removes the permission for the specified principal from the specified resource.
#update_document(options = {}) ⇒ Struct
Updates the specified attributes of a document. The user must have access to both the document and its parent folder, if applicable.
#update_document_version(options = {}) ⇒ Struct
Changes the status of the document version to ACTIVE.
Amazon WorkDocs also sets its document container to ACTIVE. This is the last step in a document upload, after the client uploads the document to an S3-presigned URL returned by InitiateDocumentVersionUpload.
#update_folder(options = {}) ⇒ Struct
Updates the specified attributes of the specified folder. The user must have access to both the folder and its parent folder, if applicable.
#update_user(options = {}) ⇒ Types::UpdateUserResponse
Updates the specified attributes of the specified user, and grants or revokes administrative privileges to the Amazon WorkDocs site.
#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
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: |
---|