aws-sdk-core 2.2.37 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ module Aws
2
+ module Partitions
3
+ # @api private
4
+ class PartitionList
5
+
6
+ include Enumerable
7
+
8
+ def initialize
9
+ @partitions = {}
10
+ end
11
+
12
+ def clear
13
+ @partitions = {}
14
+ end
15
+
16
+ # @return [Enumerator<Partition>]
17
+ def each(&block)
18
+ @partitions.each_value(&block)
19
+ end
20
+
21
+ # @param [String] partition_name
22
+ # @return [Partition]
23
+ def partition(partition_name)
24
+ if @partitions.key?(partition_name)
25
+ @partitions[partition_name]
26
+ else
27
+ msg = "invalid partition name #{partition_name.inspect}; valid "
28
+ msg << "partition names include %s" % [@partitions.keys.join(', ')]
29
+ raise ArgumentError, msg
30
+ end
31
+ end
32
+
33
+ # @return [Array<Partition>]
34
+ def partitions
35
+ @partitions.values
36
+ end
37
+
38
+ # @param [Partition] partition
39
+ def add_partition(partition)
40
+ if Partition === partition
41
+ @partitions[partition.name] = partition
42
+ else
43
+ raise ArgumentError, "expected Partition, got #{partition.class}"
44
+ end
45
+ end
46
+
47
+ class << self
48
+
49
+ # @api private
50
+ def build(partitions)
51
+ partitions['partitions'].inject(PartitionList.new) do |list, partition|
52
+ list.add_partition(Partition.build(partition))
53
+ list
54
+ end
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,78 @@
1
+ require 'set'
2
+
3
+ module Aws
4
+ module Partitions
5
+ class Region
6
+
7
+ # @option options [required, String] :name
8
+ # @option options [required, String] :description
9
+ # @option options [required, String] :partition_name
10
+ # @option options [required, Set<String>] :services
11
+ # @api private
12
+ def initialize(options = {})
13
+ @name = options[:name]
14
+ @description = options[:description]
15
+ @partition_name = options[:partition_name]
16
+ @services = options[:services]
17
+ end
18
+
19
+ # @return [String] The name of this region, e.g. "us-east-1".
20
+ attr_reader :name
21
+
22
+ # @return [String] A short description of this region.
23
+ attr_reader :description
24
+
25
+ # @return [String] The partition this region exists in, e.g. "aws",
26
+ # "aws-cn", "aws-us-gov".
27
+ attr_reader :partition_name
28
+
29
+ # @return [Set<String>] The list of services available in this region.
30
+ # Service names are the module names as used by the AWS SDK
31
+ # for Ruby.
32
+ attr_reader :services
33
+
34
+ class << self
35
+
36
+ # @api private
37
+ def build(region_name, region, partition)
38
+ Region.new(
39
+ name: region_name,
40
+ description: region['description'],
41
+ partition_name: partition['partition'],
42
+ services: region_services(region_name, partition)
43
+ )
44
+ end
45
+
46
+ private
47
+
48
+ def region_services(region_name, partition)
49
+ Partitions.service_ids.inject(Set.new) do |services, (svc_name, svc_id)|
50
+ if svc = partition['services'][svc_id]
51
+ services << svc_name if service_in_region?(svc, region_name)
52
+ else
53
+ #raise "missing endpoints for #{svc_name} / #{svc_id}"
54
+ end
55
+ services
56
+ end
57
+ end
58
+
59
+ def service_in_region?(svc, region_name)
60
+ svc_endpoints_contains_region?(svc, region_name) ||
61
+ svc_partition_endpoint_matches_region?(svc, region_name)
62
+ end
63
+
64
+ def svc_endpoints_contains_region?(svc, region_name)
65
+ svc['endpoints'].key?(region_name)
66
+ end
67
+
68
+ def svc_partition_endpoint_matches_region?(svc, region_name)
69
+ if pe = svc['partitionEndpoint']
70
+ region = svc['endpoints'][pe].fetch('credentialScope', {})['region']
71
+ region == region_name
72
+ end
73
+ end
74
+
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,84 @@
1
+ require 'set'
2
+
3
+ module Aws
4
+ module Partitions
5
+ class Service
6
+
7
+ # @option options [required, String] :name
8
+ # @option options [required, String] :partition_name
9
+ # @option options [required, Set<String>] :region_name
10
+ # @option options [required, Boolean] :regionalized
11
+ # @option options [String] :partition_region
12
+ # @api private
13
+ def initialize(options = {})
14
+ @name = options[:name]
15
+ @partition_name = options[:partition_name]
16
+ @regions = options[:regions]
17
+ @regionalized = options[:regionalized]
18
+ @partition_region = options[:partition_region]
19
+ @regions << @partition_region if !@regionalized
20
+ end
21
+
22
+ # @return [String] The name of this service. The name is the module
23
+ # name as used by the AWS SDK for Ruby.
24
+ attr_reader :name
25
+
26
+ # @return [String] The partition name, e.g "aws", "aws-cn", "aws-us-gov".
27
+ attr_reader :partition_name
28
+
29
+ # @return [Set<String>] The regions this service is available in.
30
+ # Regions are scoped to the partition.
31
+ attr_reader :regions
32
+
33
+ # @return [String,nil] The global patition endpoint for this service.
34
+ # May be `nil`.
35
+ attr_reader :partition_region
36
+
37
+ # Returns `false` if the service operates with a single global
38
+ # endpoint for the current partition, returns `true` if the service
39
+ # is available in mutliple regions.
40
+ #
41
+ # Some services have both a partition endpoint and regional endpoints.
42
+ #
43
+ # @return [Boolean]
44
+ def regionalized?
45
+ @regionalized
46
+ end
47
+
48
+ class << self
49
+
50
+ # @api private
51
+ def build(service_name, service, partition)
52
+ Service.new(
53
+ name: service_name,
54
+ partition_name: partition['partition'],
55
+ regions: regions(service, partition),
56
+ regionalized: service['isRegionalized'] != false,
57
+ partition_region: partition_region(service)
58
+ )
59
+ end
60
+
61
+ private
62
+
63
+ def regions(service, partition)
64
+ names = Set.new(partition['regions'].keys & service['endpoints'].keys)
65
+ names - ["#{partition['partition']}-global"]
66
+ end
67
+
68
+ def partition_region(service)
69
+ if service['partitionEndpoint']
70
+ endpoint = service['endpoints'][service['partitionEndpoint']]
71
+ if endpoint['credentialScope']
72
+ endpoint['credentialScope']['region']
73
+ elsif service['defaults'] && service['defaults']['credentialScope']
74
+ service['defaults']['credentialScope']['region']
75
+ else
76
+ service['partitionEndpoint']
77
+ end
78
+ end
79
+ end
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,73 @@
1
+ module Aws
2
+ module Plugins
3
+
4
+ # Provides support for using `Aws::S3::Client` with Amazon S3 Transfer
5
+ # Acceleration.
6
+ #
7
+ # Go here for more information about transfer acceleration:
8
+ # [http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)
9
+ #
10
+ # @seahorse.client.option [Boolean] :use_accelerate_endpoint (false)
11
+ # When set to `true`, accelerated bucket endpoints will be used
12
+ # for all object operations. You must first enable
13
+ # accelerate for each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html).
14
+ #
15
+ class S3Accelerate < Seahorse::Client::Plugin
16
+
17
+ option(:use_accelerate_endpoint, false)
18
+
19
+ def add_handlers(handlers, config)
20
+ operations = config.api.operation_names - [
21
+ :create_bucket, :list_buckets, :delete_bucket,
22
+ ]
23
+ handlers.add(OptionHandler, step: :initialize, operations: operations)
24
+ handlers.add(AccelerateHandler, step: :build, priority: 0, operations: operations)
25
+ end
26
+
27
+ # @api private
28
+ class OptionHandler < Seahorse::Client::Handler
29
+ def call(context)
30
+ accelerate = context.params.delete(:use_accelerate_endpoint)
31
+ accelerate = context.config.use_accelerate_endpoint if accelerate.nil?
32
+ context[:use_accelerate_endpoint] = accelerate
33
+ @handler.call(context)
34
+ end
35
+ end
36
+
37
+ # @api private
38
+ class AccelerateHandler < Seahorse::Client::Handler
39
+
40
+ def call(context)
41
+ use_accelerate_endpoint(context) if context[:use_accelerate_endpoint]
42
+ @handler.call(context)
43
+ end
44
+
45
+ private
46
+
47
+ def use_accelerate_endpoint(context)
48
+ bucket_name = context.params[:bucket]
49
+ validate_bucket_name!(bucket_name)
50
+ endpoint = URI.parse(context.http_request.endpoint.to_s)
51
+ endpoint.scheme = 'https'
52
+ endpoint.port = 443
53
+ endpoint.host = "#{bucket_name}.s3-accelerate.amazonaws.com"
54
+ context.http_request.endpoint = endpoint.to_s
55
+ end
56
+
57
+ def validate_bucket_name!(bucket_name)
58
+ unless S3BucketDns.dns_compatible?(bucket_name, ssl = true)
59
+ msg = "unable to use `accelerate: true` on buckets with "
60
+ msg << "non-DNS compatible names"
61
+ raise ArgumentError, msg
62
+ end
63
+ if bucket_name.include?('.')
64
+ msg = "unable to use `accelerate: true` on buckets with dots"
65
+ msg << "in their name: #{bucket_name.inspect}"
66
+ raise ArgumentError, msg
67
+ end
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
@@ -15,7 +15,7 @@ module Aws
15
15
  option(:stub_responses, false)
16
16
 
17
17
  option(:region) do |config|
18
- 'stubbed-region' if config.stub_responses
18
+ 'us-stubbed-1' if config.stub_responses
19
19
  end
20
20
 
21
21
  option(:credentials) do |config|
@@ -12,6 +12,7 @@ module Aws
12
12
  acl delete cors lifecycle location logging notification partNumber
13
13
  policy requestPayment restore tagging torrent uploadId uploads
14
14
  versionId versioning versions website replication requestPayment
15
+ accelerate
15
16
 
16
17
  response-content-type response-content-language
17
18
  response-expires response-cache-control
@@ -42,7 +42,7 @@ module Aws
42
42
  def initialize(credentials, service_name, region)
43
43
  @service_name = service_name
44
44
  @credentials = credentials.credentials
45
- @region = region
45
+ @region = EndpointProvider.signing_region(region, service_name)
46
46
  end
47
47
 
48
48
  # @param [Seahorse::Client::Http::Request] req
@@ -1,3 +1,3 @@
1
1
  module Aws
2
- VERSION = '2.2.37'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -0,0 +1,273 @@
1
+ {
2
+ "ACM": {
3
+ "models": "acm/2015-12-08",
4
+ "endpoint": "acm"
5
+ },
6
+ "APIGateway": {
7
+ "models": "apigateway/2015-07-09",
8
+ "endpoint": "apigateway"
9
+ },
10
+ "AutoScaling": {
11
+ "models": "autoscaling/2011-01-01",
12
+ "endpoint": "autoscaling"
13
+ },
14
+ "CloudFormation": {
15
+ "models": "cloudformation/2010-05-15",
16
+ "endpoint": "cloudformation"
17
+ },
18
+ "CloudFront": {
19
+ "models": "cloudfront/2016-01-28",
20
+ "endpoint": "cloudfront"
21
+ },
22
+ "CloudHSM": {
23
+ "models": "cloudhsm/2014-05-30",
24
+ "endpoint": "cloudhsm"
25
+ },
26
+ "CloudSearch": {
27
+ "models": "cloudsearch/2013-01-01",
28
+ "endpoint": "cloudsearch"
29
+ },
30
+ "CloudSearchDomain": {
31
+ "models": "cloudsearchdomain/2013-01-01"
32
+ },
33
+ "CloudTrail": {
34
+ "models": "cloudtrail/2013-11-01",
35
+ "endpoint": "cloudtrail"
36
+ },
37
+ "CloudWatch": {
38
+ "models": "monitoring/2010-08-01",
39
+ "endpoint": "monitoring"
40
+ },
41
+ "CloudWatchEvents": {
42
+ "models": "events/2015-10-07",
43
+ "endpoint": "events"
44
+ },
45
+ "CloudWatchLogs": {
46
+ "models": "logs/2014-03-28",
47
+ "endpoint": "logs"
48
+ },
49
+ "CodeCommit": {
50
+ "models": "codecommit/2015-04-13",
51
+ "endpoint": "codecommit"
52
+ },
53
+ "CodeDeploy": {
54
+ "models": "codedeploy/2014-10-06",
55
+ "endpoint": "codedeploy"
56
+ },
57
+ "CodePipeline": {
58
+ "models": "codepipeline/2015-07-09",
59
+ "endpoint": "codepipeline"
60
+ },
61
+ "CognitoIdentity": {
62
+ "models": "cognito-identity/2014-06-30",
63
+ "endpoint": "cognito-identity"
64
+ },
65
+ "CognitoIdentityProvider": {
66
+ "models": "cognito-idp/2016-04-18",
67
+ "endpoint": "cognito-idp"
68
+ },
69
+ "CognitoSync": {
70
+ "models": "cognito-sync/2014-06-30",
71
+ "endpoint": "cognito-sync"
72
+ },
73
+ "ConfigService": {
74
+ "models": "config/2014-11-12",
75
+ "endpoint": "config"
76
+ },
77
+ "DatabaseMigrationService": {
78
+ "models": "dms/2016-01-01",
79
+ "endpoint": "dms"
80
+ },
81
+ "DataPipeline": {
82
+ "models": "datapipeline/2012-10-29",
83
+ "endpoint": "datapipeline"
84
+ },
85
+ "DeviceFarm": {
86
+ "models": "devicefarm/2015-06-23",
87
+ "endpoint": "devicefarm"
88
+ },
89
+ "DirectConnect": {
90
+ "models": "directconnect/2012-10-25",
91
+ "endpoint": "directconnect"
92
+ },
93
+ "DirectoryService": {
94
+ "models": "ds/2015-04-16",
95
+ "endpoint": "ds"
96
+ },
97
+ "DynamoDB": {
98
+ "models": "dynamodb/2012-08-10",
99
+ "endpoint": "dynamodb"
100
+ },
101
+ "DynamoDBStreams": {
102
+ "models": "streams.dynamodb/2012-08-10",
103
+ "endpoint": "streams.dynamodb"
104
+ },
105
+ "EC2": {
106
+ "models": "ec2/2015-10-01",
107
+ "endpoint": "ec2"
108
+ },
109
+ "ECR": {
110
+ "models": "ecr/2015-09-21",
111
+ "endpoint": "ecr"
112
+ },
113
+ "ECS": {
114
+ "models": "ecs/2014-11-13",
115
+ "endpoint": "ecs"
116
+ },
117
+ "EFS": {
118
+ "models": "elasticfilesystem/2015-02-01",
119
+ "endpoint": "elasticfilesystem"
120
+ },
121
+ "ElastiCache": {
122
+ "models": "elasticache/2015-02-02",
123
+ "endpoint": "elasticache"
124
+ },
125
+ "ElasticBeanstalk": {
126
+ "models": "elasticbeanstalk/2010-12-01",
127
+ "endpoint": "elasticbeanstalk"
128
+ },
129
+ "ElasticLoadBalancing": {
130
+ "models": "elasticloadbalancing/2012-06-01",
131
+ "endpoint": "elasticloadbalancing"
132
+ },
133
+ "ElasticsearchService": {
134
+ "models": "es/2015-01-01",
135
+ "endpoint": "es"
136
+ },
137
+ "ElasticTranscoder": {
138
+ "models": "elastictranscoder/2012-09-25",
139
+ "endpoint": "elastictranscoder"
140
+ },
141
+ "EMR": {
142
+ "models": "elasticmapreduce/2009-03-31",
143
+ "endpoint": "elasticmapreduce"
144
+ },
145
+ "Firehose": {
146
+ "models": "firehose/2015-08-04",
147
+ "endpoint": "firehose"
148
+ },
149
+ "GameLift": {
150
+ "models": "gamelift/2015-10-01",
151
+ "endpoint": "gamelift"
152
+ },
153
+ "Glacier": {
154
+ "models": "glacier/2012-06-01",
155
+ "endpoint": "glacier"
156
+ },
157
+ "IAM": {
158
+ "models": "iam/2010-05-08",
159
+ "endpoint": "iam"
160
+ },
161
+ "ImportExport": {
162
+ "models": "importexport/2010-06-01",
163
+ "endpoint": "importexport"
164
+ },
165
+ "Inspector": {
166
+ "models": "inspector/2016-02-16",
167
+ "endpoint": "inspector"
168
+ },
169
+ "IoT": {
170
+ "models": "iot/2015-05-28",
171
+ "endpoint": "iot"
172
+ },
173
+ "IoTDataPlane": {
174
+ "models": "iot-data/2015-05-28",
175
+ "endpoint": "data.iot"
176
+ },
177
+ "Kinesis": {
178
+ "models": "kinesis/2013-12-02",
179
+ "endpoint": "kinesis"
180
+ },
181
+ "KMS": {
182
+ "models": "kms/2014-11-01",
183
+ "endpoint": "kms"
184
+ },
185
+ "Lambda": {
186
+ "models": "lambda/2015-03-31",
187
+ "endpoint": "lambda"
188
+ },
189
+ "LambdaPreview": {
190
+ "models": "lambda/2014-11-11",
191
+ "endpoint": "lambda"
192
+ },
193
+ "MachineLearning": {
194
+ "models": "machinelearning/2014-12-12",
195
+ "endpoint": "machinelearning"
196
+ },
197
+ "MarketplaceCommerceAnalytics": {
198
+ "models": "marketplacecommerceanalytics/2015-07-01",
199
+ "endpoint": "marketplacecommerceanalytics"
200
+ },
201
+ "MarketplaceMetering": {
202
+ "models": "meteringmarketplace/2016-01-14",
203
+ "endpoint": "metering.marketplace"
204
+ },
205
+ "OpsWorks": {
206
+ "models": "opsworks/2013-02-18",
207
+ "endpoint": "opsworks"
208
+ },
209
+ "RDS": {
210
+ "models": "rds/2014-10-31",
211
+ "endpoint": "rds"
212
+ },
213
+ "Redshift": {
214
+ "models": "redshift/2012-12-01",
215
+ "endpoint": "redshift"
216
+ },
217
+ "Route53": {
218
+ "models": "route53/2013-04-01",
219
+ "endpoint": "route53"
220
+ },
221
+ "Route53Domains": {
222
+ "models": "route53domains/2014-05-15",
223
+ "endpoint": "route53domains"
224
+ },
225
+ "S3": {
226
+ "models": "s3/2006-03-01",
227
+ "endpoint": "s3"
228
+ },
229
+ "SES": {
230
+ "models": "email/2010-12-01",
231
+ "endpoint": "email"
232
+ },
233
+ "SimpleDB": {
234
+ "models": "sdb/2009-04-15",
235
+ "endpoint": "sdb"
236
+ },
237
+ "SNS": {
238
+ "models": "sns/2010-03-31",
239
+ "endpoint": "sns"
240
+ },
241
+ "SQS": {
242
+ "models": "sqs/2012-11-05",
243
+ "endpoint": "sqs"
244
+ },
245
+ "SSM": {
246
+ "models": "ssm/2014-11-06",
247
+ "endpoint": "ssm"
248
+ },
249
+ "StorageGateway": {
250
+ "models": "storagegateway/2013-06-30",
251
+ "endpoint": "storagegateway"
252
+ },
253
+ "STS": {
254
+ "models": "sts/2011-06-15",
255
+ "endpoint": "sts"
256
+ },
257
+ "Support": {
258
+ "models": "support/2013-04-15",
259
+ "endpoint": "support"
260
+ },
261
+ "SWF": {
262
+ "models": "swf/2012-01-25",
263
+ "endpoint": "swf"
264
+ },
265
+ "WAF": {
266
+ "models": "waf/2015-08-24",
267
+ "endpoint": "waf"
268
+ },
269
+ "WorkSpaces": {
270
+ "models": "workspaces/2015-04-08",
271
+ "endpoint": "workspaces"
272
+ }
273
+ }