You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::MediaStore::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::MediaStore::Client
- Defined in:
- (unknown)
Overview
An API client for AWS Elemental MediaStore. To construct a client, you need to configure a :region
and :credentials
.
mediastore = Aws::MediaStore::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::MediaStore::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::MediaStore::Client
constructor
Constructs an API client.
API Operations collapse
-
#create_container(options = {}) ⇒ Types::CreateContainerOutput
Creates a storage container to hold objects.
-
#delete_container(options = {}) ⇒ Struct
Deletes the specified container.
-
#delete_container_policy(options = {}) ⇒ Struct
Deletes the access policy that is associated with the specified container.
.
-
#delete_cors_policy(options = {}) ⇒ Struct
Deletes the cross-origin resource sharing (CORS) configuration information that is set for the container.
To use this operation, you must have permission to perform the
MediaStore:DeleteCorsPolicy
action. -
#delete_lifecycle_policy(options = {}) ⇒ Struct
Removes an object lifecycle policy from a container.
-
#delete_metric_policy(options = {}) ⇒ Struct
Deletes the metric policy that is associated with the specified container.
-
#describe_container(options = {}) ⇒ Types::DescribeContainerOutput
Retrieves the properties of the requested container.
-
#get_container_policy(options = {}) ⇒ Types::GetContainerPolicyOutput
Retrieves the access policy for the specified container.
-
#get_cors_policy(options = {}) ⇒ Types::GetCorsPolicyOutput
Returns the cross-origin resource sharing (CORS) configuration information that is set for the container.
To use this operation, you must have permission to perform the
MediaStore:GetCorsPolicy
action. -
#get_lifecycle_policy(options = {}) ⇒ Types::GetLifecyclePolicyOutput
Retrieves the object lifecycle policy that is assigned to a container.
.
-
#get_metric_policy(options = {}) ⇒ Types::GetMetricPolicyOutput
Returns the metric policy for the specified container.
-
#list_containers(options = {}) ⇒ Types::ListContainersOutput
Lists the properties of all containers in AWS Elemental MediaStore.
-
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceOutput
Returns a list of the tags assigned to the specified container.
-
#put_container_policy(options = {}) ⇒ Struct
Creates an access policy for the specified container to restrict the users and clients that can access it.
-
#put_cors_policy(options = {}) ⇒ Struct
Sets the cross-origin resource sharing (CORS) configuration on a container so that the container can service cross-origin requests.
-
#put_lifecycle_policy(options = {}) ⇒ Struct
Writes an object lifecycle policy to a container.
-
#put_metric_policy(options = {}) ⇒ Struct
The metric policy that you want to add to the container.
-
#start_access_logging(options = {}) ⇒ Struct
Starts access logging on the specified container.
-
#stop_access_logging(options = {}) ⇒ Struct
Stops access logging on the specified container.
-
#tag_resource(options = {}) ⇒ Struct
Adds tags to the specified AWS Elemental MediaStore container.
-
#untag_resource(options = {}) ⇒ Struct
Removes tags from the specified container.
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::MediaStore::Client
Constructs an API client.
Instance Method Details
#create_container(options = {}) ⇒ Types::CreateContainerOutput
Creates a storage container to hold objects. A container is similar to a bucket in the Amazon S3 service.
#delete_container(options = {}) ⇒ Struct
Deletes the specified container. Before you make a DeleteContainer
request, delete any objects in the container or in any folders in the container. You can delete only empty containers.
#delete_container_policy(options = {}) ⇒ Struct
Deletes the access policy that is associated with the specified container.
#delete_cors_policy(options = {}) ⇒ Struct
Deletes the cross-origin resource sharing (CORS) configuration information that is set for the container.
To use this operation, you must have permission to perform the MediaStore:DeleteCorsPolicy
action. The container owner has this permission by default and can grant this permission to others.
#delete_lifecycle_policy(options = {}) ⇒ Struct
Removes an object lifecycle policy from a container. It takes up to 20 minutes for the change to take effect.
#delete_metric_policy(options = {}) ⇒ Struct
Deletes the metric policy that is associated with the specified container. If there is no metric policy associated with the container, MediaStore doesn't send metrics to CloudWatch.
#describe_container(options = {}) ⇒ Types::DescribeContainerOutput
Retrieves the properties of the requested container. This request is commonly used to retrieve the endpoint of a container. An endpoint is a value assigned by the service when a new container is created. A container's endpoint does not change after it has been assigned. The DescribeContainer
request returns a single Container
object based on ContainerName
. To return all Container
objects that are associated with a specified AWS account, use ListContainers.
#get_container_policy(options = {}) ⇒ Types::GetContainerPolicyOutput
Retrieves the access policy for the specified container. For information about the data that is included in an access policy, see the AWS Identity and Access Management User Guide.
#get_cors_policy(options = {}) ⇒ Types::GetCorsPolicyOutput
Returns the cross-origin resource sharing (CORS) configuration information that is set for the container.
To use this operation, you must have permission to perform the MediaStore:GetCorsPolicy
action. By default, the container owner has this permission and can grant it to others.
#get_lifecycle_policy(options = {}) ⇒ Types::GetLifecyclePolicyOutput
Retrieves the object lifecycle policy that is assigned to a container.
#get_metric_policy(options = {}) ⇒ Types::GetMetricPolicyOutput
Returns the metric policy for the specified container.
#list_containers(options = {}) ⇒ Types::ListContainersOutput
Lists the properties of all containers in AWS Elemental MediaStore.
You can query to receive all the containers in one response. Or you can include the MaxResults
parameter to receive a limited number of containers in each response. In this case, the response includes a token. To get the next set of containers, send the command again, this time with the NextToken
parameter (with the returned token as its value). The next set of responses appears, with a token if there are still more containers to receive.
See also DescribeContainer, which gets the properties of one container.
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceOutput
Returns a list of the tags assigned to the specified container.
#put_container_policy(options = {}) ⇒ Struct
Creates an access policy for the specified container to restrict the users and clients that can access it. For information about the data that is included in an access policy, see the AWS Identity and Access Management User Guide.
For this release of the REST API, you can create only one policy for a container. If you enter PutContainerPolicy
twice, the second command modifies the existing policy.
#put_cors_policy(options = {}) ⇒ Struct
Sets the cross-origin resource sharing (CORS) configuration on a container so that the container can service cross-origin requests. For example, you might want to enable a request whose origin is http://www.example.com to access your AWS Elemental MediaStore container at my.example.container.com by using the browser's XMLHttpRequest capability.
To enable CORS on a container, you attach a CORS policy to the container. In the CORS policy, you configure rules that identify origins and the HTTP methods that can be executed on your container. The policy can contain up to 398,000 characters. You can add up to 100 rules to a CORS policy. If more than one rule applies, the service uses the first applicable rule listed.
To learn more about CORS, see Cross-Origin Resource Sharing (CORS) in AWS Elemental MediaStore.
#put_lifecycle_policy(options = {}) ⇒ Struct
Writes an object lifecycle policy to a container. If the container already has an object lifecycle policy, the service replaces the existing policy with the new policy. It takes up to 20 minutes for the change to take effect.
For information about how to construct an object lifecycle policy, see Components of an Object Lifecycle Policy.
#put_metric_policy(options = {}) ⇒ Struct
The metric policy that you want to add to the container. A metric policy allows AWS Elemental MediaStore to send metrics to Amazon CloudWatch. It takes up to 20 minutes for the new policy to take effect.
#start_access_logging(options = {}) ⇒ Struct
Starts access logging on the specified container. When you enable access logging on a container, MediaStore delivers access logs for objects stored in that container to Amazon CloudWatch Logs.
#stop_access_logging(options = {}) ⇒ Struct
Stops access logging on the specified container. When you stop access logging on a container, MediaStore stops sending access logs to Amazon CloudWatch Logs. These access logs are not saved and are not retrievable.
#tag_resource(options = {}) ⇒ Struct
Adds tags to the specified AWS Elemental MediaStore container. Tags are key:value pairs that you can associate with AWS resources. For example, the tag key might be "customer" and the tag value might be "companyA." You can specify one or more tags to add to each container. You can add up to 50 tags to each container. For more information about tagging, including naming and usage conventions, see Tagging Resources in MediaStore.
#untag_resource(options = {}) ⇒ Struct
Removes tags from the specified container. You can specify one or more tags to remove.
#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: |
---|