Class: Aws::CloudFront::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::CloudFront::Client
- Includes:
- Aws::ClientStubs
- Defined in:
- lib/aws-sdk-cloudfront/client.rb
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#create_cloud_front_origin_access_identity(params = {}) ⇒ Types::CreateCloudFrontOriginAccessIdentityResult
Creates a new origin access identity.
-
#create_distribution(params = {}) ⇒ Types::CreateDistributionResult
Creates a new web distribution.
-
#create_distribution_with_tags(params = {}) ⇒ Types::CreateDistributionWithTagsResult
Create a new distribution with tags.
-
#create_invalidation(params = {}) ⇒ Types::CreateInvalidationResult
Create a new invalidation.
-
#create_streaming_distribution(params = {}) ⇒ Types::CreateStreamingDistributionResult
Creates a new RMTP distribution.
-
#create_streaming_distribution_with_tags(params = {}) ⇒ Types::CreateStreamingDistributionWithTagsResult
Create a new streaming distribution with tags.
-
#delete_cloud_front_origin_access_identity(params = {}) ⇒ Struct
Delete an origin access identity.
-
#delete_distribution(params = {}) ⇒ Struct
Delete a distribution.
-
#delete_streaming_distribution(params = {}) ⇒ Struct
Delete a streaming distribution.
-
#get_cloud_front_origin_access_identity(params = {}) ⇒ Types::GetCloudFrontOriginAccessIdentityResult
Get the information about an origin access identity.
-
#get_cloud_front_origin_access_identity_config(params = {}) ⇒ Types::GetCloudFrontOriginAccessIdentityConfigResult
Get the configuration information about an origin access identity.
-
#get_distribution(params = {}) ⇒ Types::GetDistributionResult
Get the information about a distribution.
-
#get_distribution_config(params = {}) ⇒ Types::GetDistributionConfigResult
Get the configuration information about a distribution.
-
#get_invalidation(params = {}) ⇒ Types::GetInvalidationResult
Get the information about an invalidation.
-
#get_streaming_distribution(params = {}) ⇒ Types::GetStreamingDistributionResult
Gets information about a specified RTMP distribution, including the distribution configuration.
-
#get_streaming_distribution_config(params = {}) ⇒ Types::GetStreamingDistributionConfigResult
Get the configuration information about a streaming distribution.
-
#list_cloud_front_origin_access_identities(params = {}) ⇒ Types::ListCloudFrontOriginAccessIdentitiesResult
Lists origin access identities.
-
#list_distributions(params = {}) ⇒ Types::ListDistributionsResult
List distributions.
-
#list_distributions_by_web_acl_id(params = {}) ⇒ Types::ListDistributionsByWebACLIdResult
List the distributions that are associated with a specified AWS WAF web ACL.
-
#list_invalidations(params = {}) ⇒ Types::ListInvalidationsResult
Lists invalidation batches.
-
#list_streaming_distributions(params = {}) ⇒ Types::ListStreamingDistributionsResult
List streaming distributions.
-
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResult
List tags for a CloudFront resource.
-
#tag_resource(params = {}) ⇒ Struct
Add tags to a CloudFront resource.
-
#untag_resource(params = {}) ⇒ Struct
Remove tags from a CloudFront resource.
-
#update_cloud_front_origin_access_identity(params = {}) ⇒ Types::UpdateCloudFrontOriginAccessIdentityResult
Update an origin access identity.
-
#update_distribution(params = {}) ⇒ Types::UpdateDistributionResult
Updates the configuration for a web distribution.
-
#update_streaming_distribution(params = {}) ⇒ Types::UpdateStreamingDistributionResult
Update a streaming distribution.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(*args) ⇒ Client
constructor
A new instance of Client.
-
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
- #waiter_names ⇒ Object deprecated private Deprecated.
Constructor Details
#initialize(*args) ⇒ Client
Returns a new instance of Client.
142 143 144 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 142 def initialize(*args) super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
3039 3040 3041 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 3039 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
3042 3043 3044 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 3042 def errors_module Errors end |
Instance Method Details
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2900 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config) context[:gem_name] = 'aws-sdk-cloudfront' context[:gem_version] = '1.0.0' Seahorse::Client::Request.new(handlers, context) end |
#create_cloud_front_origin_access_identity(params = {}) ⇒ Types::CreateCloudFrontOriginAccessIdentityResult
Creates a new origin access identity. If you’re using Amazon S3 for your origin, you can use an origin access identity to require users to access your content using a CloudFront URL instead of the Amazon S3 URL. For more information about how to use origin access identities, see [Serving Private Content through CloudFront] in the *Amazon CloudFront Developer Guide*.
[1]: docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
190 191 192 193 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 190 def create_cloud_front_origin_access_identity(params = {}, = {}) req = build_request(:create_cloud_front_origin_access_identity, params) req.send_request() end |
#create_distribution(params = {}) ⇒ Types::CreateDistributionResult
Creates a new web distribution. Send a ‘POST` request to the `/CloudFront API version/distribution`/`distribution ID` resource.
535 536 537 538 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 535 def create_distribution(params = {}, = {}) req = build_request(:create_distribution, params) req.send_request() end |
#create_distribution_with_tags(params = {}) ⇒ Types::CreateDistributionWithTagsResult
Create a new distribution with tags.
889 890 891 892 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 889 def (params = {}, = {}) req = build_request(:create_distribution_with_tags, params) req.send_request() end |
#create_invalidation(params = {}) ⇒ Types::CreateInvalidationResult
Create a new invalidation.
935 936 937 938 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 935 def create_invalidation(params = {}, = {}) req = build_request(:create_invalidation, params) req.send_request() end |
#create_streaming_distribution(params = {}) ⇒ Types::CreateStreamingDistributionResult
Creates a new RMTP distribution. An RTMP distribution is similar to a web distribution, but an RTMP distribution streams media files using the Adobe Real-Time Messaging Protocol (RTMP) instead of serving files using HTTP.
To create a new web distribution, submit a ‘POST` request to the *CloudFront API version*/distribution resource. The request body must include a document with a StreamingDistributionConfig element. The response echoes the `StreamingDistributionConfig` element and returns other information about the RTMP distribution.
To get the status of your request, use the *GET StreamingDistribution* API action. When the value of ‘Enabled` is `true` and the value of `Status` is `Deployed`, your distribution is ready. A distribution usually deploys in less than 15 minutes.
For more information about web distributions, see [Working with RTMP Distributions] in the *Amazon CloudFront Developer Guide*.
Beginning with the 2012-05-05 version of the CloudFront API, we made substantial changes to the format of the XML document that you include in the request body when you create or update a web distribution or an RTMP distribution, and when you invalidate objects. With previous versions of the API, we discovered that it was too easy to accidentally delete one or more values for an element that accepts multiple values, for example, CNAMEs and trusted signers. Our changes for the 2012-05-05 release are intended to prevent these accidental deletions and to notify you when there’s a mismatch between the number of values you say you’re specifying in the ‘Quantity` element and the number of values specified.
[1]: docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-rtmp.html
1050 1051 1052 1053 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1050 def create_streaming_distribution(params = {}, = {}) req = build_request(:create_streaming_distribution, params) req.send_request() end |
#create_streaming_distribution_with_tags(params = {}) ⇒ Types::CreateStreamingDistributionWithTagsResult
Create a new streaming distribution with tags.
1142 1143 1144 1145 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1142 def (params = {}, = {}) req = build_request(:create_streaming_distribution_with_tags, params) req.send_request() end |
#delete_cloud_front_origin_access_identity(params = {}) ⇒ Struct
Delete an origin access identity.
1169 1170 1171 1172 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1169 def delete_cloud_front_origin_access_identity(params = {}, = {}) req = build_request(:delete_cloud_front_origin_access_identity, params) req.send_request() end |
#delete_distribution(params = {}) ⇒ Struct
Delete a distribution.
1196 1197 1198 1199 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1196 def delete_distribution(params = {}, = {}) req = build_request(:delete_distribution, params) req.send_request() end |
#delete_streaming_distribution(params = {}) ⇒ Struct
Delete a streaming distribution. To delete an RTMP distribution using the CloudFront API, perform the following steps.
**To delete an RTMP distribution using the CloudFront API**:
-
Disable the RTMP distribution.
-
Submit a ‘GET Streaming Distribution Config` request to get the current configuration and the `Etag` header for the distribution.
-
Update the XML document that was returned in the response to your ‘GET Streaming Distribution Config` request to change the value of `Enabled` to `false`.
-
Submit a ‘PUT Streaming Distribution Config` request to update the configuration for your distribution. In the request body, include the XML document that you updated in Step 3. Then set the value of the HTTP `If-Match` header to the value of the `ETag` header that CloudFront returned when you submitted the `GET Streaming Distribution Config` request in Step 2.
-
Review the response to the ‘PUT Streaming Distribution Config` request to confirm that the distribution was successfully disabled.
-
Submit a ‘GET Streaming Distribution Config` request to confirm that your changes have propagated. When propagation is complete, the value of `Status` is `Deployed`.
-
Submit a ‘DELETE Streaming Distribution` request. Set the value of the HTTP `If-Match` header to the value of the `ETag` header that CloudFront returned when you submitted the `GET Streaming Distribution Config` request in Step 2.
-
Review the response to your ‘DELETE Streaming Distribution` request to confirm that the distribution was successfully deleted.
For information about deleting a distribution using the CloudFront console, see [Deleting a Distribution] in the *Amazon CloudFront Developer Guide*.
[1]: docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HowToDeleteDistribution.html
1266 1267 1268 1269 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1266 def delete_streaming_distribution(params = {}, = {}) req = build_request(:delete_streaming_distribution, params) req.send_request() end |
#get_cloud_front_origin_access_identity(params = {}) ⇒ Types::GetCloudFrontOriginAccessIdentityResult
Get the information about an origin access identity.
1299 1300 1301 1302 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1299 def get_cloud_front_origin_access_identity(params = {}, = {}) req = build_request(:get_cloud_front_origin_access_identity, params) req.send_request() end |
#get_cloud_front_origin_access_identity_config(params = {}) ⇒ Types::GetCloudFrontOriginAccessIdentityConfigResult
Get the configuration information about an origin access identity.
1330 1331 1332 1333 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1330 def get_cloud_front_origin_access_identity_config(params = {}, = {}) req = build_request(:get_cloud_front_origin_access_identity_config, params) req.send_request() end |
#get_distribution(params = {}) ⇒ Types::GetDistributionResult
Get the information about a distribution.
1489 1490 1491 1492 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1489 def get_distribution(params = {}, = {}) req = build_request(:get_distribution, params) req.send_request() end |
#get_distribution_config(params = {}) ⇒ Types::GetDistributionConfigResult
Get the configuration information about a distribution.
1635 1636 1637 1638 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1635 def get_distribution_config(params = {}, = {}) req = build_request(:get_distribution_config, params) req.send_request() end |
#get_invalidation(params = {}) ⇒ Types::GetInvalidationResult
Get the information about an invalidation.
1674 1675 1676 1677 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1674 def get_invalidation(params = {}, = {}) req = build_request(:get_invalidation, params) req.send_request() end |
#get_streaming_distribution(params = {}) ⇒ Types::GetStreamingDistributionResult
Gets information about a specified RTMP distribution, including the distribution configuration.
1732 1733 1734 1735 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1732 def get_streaming_distribution(params = {}, = {}) req = build_request(:get_streaming_distribution, params) req.send_request() end |
#get_streaming_distribution_config(params = {}) ⇒ Types::GetStreamingDistributionConfigResult
Get the configuration information about a streaming distribution.
1777 1778 1779 1780 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1777 def get_streaming_distribution_config(params = {}, = {}) req = build_request(:get_streaming_distribution_config, params) req.send_request() end |
#list_cloud_front_origin_access_identities(params = {}) ⇒ Types::ListCloudFrontOriginAccessIdentitiesResult
Lists origin access identities.
1823 1824 1825 1826 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1823 def list_cloud_front_origin_access_identities(params = {}, = {}) req = build_request(:list_cloud_front_origin_access_identities, params) req.send_request() end |
#list_distributions(params = {}) ⇒ Types::ListDistributionsResult
List distributions.
1980 1981 1982 1983 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 1980 def list_distributions(params = {}, = {}) req = build_request(:list_distributions, params) req.send_request() end |
#list_distributions_by_web_acl_id(params = {}) ⇒ Types::ListDistributionsByWebACLIdResult
List the distributions that are associated with a specified AWS WAF web ACL.
2146 2147 2148 2149 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2146 def list_distributions_by_web_acl_id(params = {}, = {}) req = build_request(:list_distributions_by_web_acl_id, params) req.send_request() end |
#list_invalidations(params = {}) ⇒ Types::ListInvalidationsResult
Lists invalidation batches.
2198 2199 2200 2201 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2198 def list_invalidations(params = {}, = {}) req = build_request(:list_invalidations, params) req.send_request() end |
#list_streaming_distributions(params = {}) ⇒ Types::ListStreamingDistributionsResult
List streaming distributions.
2252 2253 2254 2255 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2252 def list_streaming_distributions(params = {}, = {}) req = build_request(:list_streaming_distributions, params) req.send_request() end |
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResult
List tags for a CloudFront resource.
2282 2283 2284 2285 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2282 def (params = {}, = {}) req = build_request(:list_tags_for_resource, params) req.send_request() end |
#tag_resource(params = {}) ⇒ Struct
Add tags to a CloudFront resource.
2315 2316 2317 2318 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2315 def tag_resource(params = {}, = {}) req = build_request(:tag_resource, params) req.send_request() end |
#untag_resource(params = {}) ⇒ Struct
Remove tags from a CloudFront resource.
2343 2344 2345 2346 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2343 def untag_resource(params = {}, = {}) req = build_request(:untag_resource, params) req.send_request() end |
#update_cloud_front_origin_access_identity(params = {}) ⇒ Types::UpdateCloudFrontOriginAccessIdentityResult
Update an origin access identity.
2388 2389 2390 2391 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2388 def update_cloud_front_origin_access_identity(params = {}, = {}) req = build_request(:update_cloud_front_origin_access_identity, params) req.send_request() end |
#update_distribution(params = {}) ⇒ Types::UpdateDistributionResult
Updates the configuration for a web distribution. Perform the following steps.
For information about updating a distribution using the CloudFront console, see [Creating or Updating a Web Distribution Using the CloudFront Console ][1] in the *Amazon CloudFront Developer Guide*.
**To update a web distribution using the CloudFront API**
-
Submit a GetDistributionConfig request to get the current configuration and an ‘Etag` header for the distribution.
<note markdown=“1”> If you update the distribution again, you need to get a new ‘Etag` header.
</note>
-
Update the XML document that was returned in the response to your ‘GetDistributionConfig` request to include the desired changes. You can’t change the value of ‘CallerReference`. If you try to change this value, CloudFront returns an `IllegalUpdate` error.
The new configuration replaces the existing configuration; the values that you specify in an ‘UpdateDistribution` request are not merged into the existing configuration. When you add, delete, or replace values in an element that allows multiple values (for example, `CNAME`), you must specify all of the values that you want to appear in the updated distribution. In addition, you must update the corresponding `Quantity` element.
-
Submit an ‘UpdateDistribution` request to update the configuration for your distribution:
-
In the request body, include the XML document that you updated in Step 2. The request body must include an XML document with a ‘DistributionConfig` element.
-
Set the value of the HTTP ‘If-Match` header to the value of the `ETag` header that CloudFront returned when you submitted the `GetDistributionConfig` request in Step 1.
-
-
Review the response to the ‘UpdateDistribution` request to confirm that the configuration was successfully updated.
-
Optional: Submit a GetDistribution request to confirm that your changes have propagated. When propagation is complete, the value of ‘Status` is `Deployed`.
Beginning with the 2012-05-05 version of the CloudFront API, we made substantial changes to the format of the XML document that you include in the request body when you create or update a distribution. With previous versions of the API, we discovered that it was too easy to accidentally delete one or more values for an element that accepts multiple values, for example, CNAMEs and trusted signers. Our changes for the 2012-05-05 release are intended to prevent these accidental deletions and to notify you when there’s a mismatch between the number of values you say you’re specifying in the ‘Quantity` element and the number of values you’re actually specifying.
[1]: docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-creating-console.html
2801 2802 2803 2804 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2801 def update_distribution(params = {}, = {}) req = build_request(:update_distribution, params) req.send_request() end |
#update_streaming_distribution(params = {}) ⇒ Types::UpdateStreamingDistributionResult
Update a streaming distribution.
2891 2892 2893 2894 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 2891 def update_streaming_distribution(params = {}, = {}) req = build_request(:update_streaming_distribution, params) req.send_request() end |
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
## Basic Usage
A waiter will call an API operation until:
-
It is successful
-
It enters a terminal state
-
It makes the maximum number of attempts
In between attempts, the waiter will sleep.
# 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 can pass configuration as the final arguments hash.
# poll for ~25 seconds
client.wait_until(waiter_name, params, {
max_attempts: 5,
delay: 5,
})
## 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(waiter_name, params, {
# disable max attempts
max_attempts: nil,
# poll for 1 hour, instead of a number of attempts
before_wait: -> (attempts, response) do
throw :failure if Time.now - started_at > 3600
end
})
## Handling Errors
When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
## Valid Waiters
The following table lists the valid waiter names, the operations they call, and the default ‘:delay` and `:max_attempts` values.
| waiter_name | params | :delay | :max_attempts | | ——————————- | —————————– | ——– | ————- | | distribution_deployed | #get_distribution | 60 | 25 | | invalidation_completed | #get_invalidation | 20 | 30 | | streaming_distribution_deployed | #get_streaming_distribution | 60 | 25 |
3003 3004 3005 3006 3007 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 3003 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |
#waiter_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
3011 3012 3013 |
# File 'lib/aws-sdk-cloudfront/client.rb', line 3011 def waiter_names waiters.keys end |