aws-sdk-core 2.0.0.rc2 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +13 -7
  3. data/.yardopts +1 -0
  4. data/Gemfile +5 -1
  5. data/README.md +26 -0
  6. data/apis/AutoScaling-2011-01-01.json +57 -0
  7. data/apis/CloudFormation-2010-05-15.json +29 -0
  8. data/apis/CloudFront-2012-05-05.json +33 -0
  9. data/apis/CloudFront-2013-05-12.json +33 -0
  10. data/apis/CloudFront-2013-08-26.json +33 -0
  11. data/apis/CloudSearch-2011-02-01.json +1 -0
  12. data/apis/CloudWatch-2010-08-01.json +22 -0
  13. data/apis/DataPipeline-2012-10-29.json +25 -0
  14. data/apis/DirectConnect-2012-10-25.json +1 -0
  15. data/apis/DynamoDB-2011-12-05.json +29 -0
  16. data/apis/DynamoDB-2012-08-10.json +29 -0
  17. data/apis/EC2-2013-06-15.json +29 -0
  18. data/apis/EC2-2013-10-01.json +29 -0
  19. data/apis/EMR-2009-03-31.json +958 -40
  20. data/apis/ElastiCache-2012-11-15.json +72 -0
  21. data/apis/ElastiCache-2013-06-15.json +72 -0
  22. data/apis/ElasticBeanstalk-2010-12-01.json +8 -0
  23. data/apis/ElasticLoadBalancing-2012-06-01.json +8 -0
  24. data/apis/ElasticTranscoder-2012-09-25.json +16 -3
  25. data/apis/Glacier-2012-06-01.json +35 -0
  26. data/apis/IAM-2010-05-08.json +129 -0
  27. data/apis/ImportExport-2010-06-01.json +9 -0
  28. data/apis/Kinesis-2013-12-02.json +409 -0
  29. data/apis/OpsWorks-2013-02-18.json +1 -0
  30. data/apis/RDS-2013-01-10.json +106 -0
  31. data/apis/RDS-2013-02-12.json +120 -0
  32. data/apis/RDS-2013-05-15.json +120 -0
  33. data/apis/Redshift-2012-12-01.json +90 -1
  34. data/apis/Route53-2012-12-12.json +27 -0
  35. data/apis/S3-2006-03-01.json +34 -0
  36. data/apis/SDB-2009-04-15.json +16 -0
  37. data/apis/SES-2010-12-01.json +8 -0
  38. data/apis/SNS-2010-03-31.json +22 -0
  39. data/apis/SQS-2012-11-05.json +1 -0
  40. data/apis/STS-2011-06-15.json +3 -1
  41. data/apis/SWF-2012-01-25.json +52 -1
  42. data/apis/StorageGateway-2012-06-30.json +15 -0
  43. data/apis/StorageGateway-2013-06-30.json +15 -0
  44. data/apis/Support-2013-04-15.json +15 -0
  45. data/apis/configuration/endpoints.json +88 -23
  46. data/apis/source/elasticmapreduce-2009-03-31.json +1529 -126
  47. data/apis/source/elasticmapreduce-2009-03-31.paginators.json +25 -0
  48. data/apis/source/importexport-2010-06-01.paginators.json +1 -0
  49. data/apis/source/kinesis-2013-12-02.json +894 -0
  50. data/apis/source/kinesis-2013-12-02.paginators.json +18 -0
  51. data/apis/source/rds-2013-01-10.paginators.json +1 -0
  52. data/apis/source/rds-2013-02-12.paginators.json +1 -0
  53. data/apis/source/rds-2013-05-15.paginators.json +1 -0
  54. data/apis/source/redshift-2012-12-01.paginators.json +1 -0
  55. data/apis/source/s3-2006-03-01.paginators.json +1 -1
  56. data/aws-sdk-core.gemspec +1 -0
  57. data/doc-src/plugins/stability.rb +1 -0
  58. data/features/glacier/client.feature +5 -0
  59. data/features/glacier/step_definitions.rb +56 -5
  60. data/features/kinesis/client.feature +18 -0
  61. data/features/kinesis/setup.rb +6 -0
  62. data/features/s3/buckets.feature +10 -0
  63. data/features/s3/objects.feature +9 -0
  64. data/features/s3/step_definitions.rb +29 -0
  65. data/lib/aws.rb +13 -2
  66. data/lib/aws/api/pagination_translator.rb +71 -0
  67. data/lib/aws/api/service_translators/glacier.rb +0 -7
  68. data/lib/aws/api/translator.rb +10 -3
  69. data/lib/aws/error_handler.rb +1 -1
  70. data/lib/aws/json/builder.rb +4 -2
  71. data/lib/aws/pageable_response.rb +230 -0
  72. data/lib/aws/plugins/glacier_checksums.rb +10 -29
  73. data/lib/aws/plugins/response_paging.rb +18 -0
  74. data/lib/aws/plugins/retry_errors.rb +3 -1
  75. data/lib/aws/plugins/s3_complete_multipart_upload_fix.rb +1 -1
  76. data/lib/aws/plugins/s3_get_bucket_location_fix.rb +9 -3
  77. data/lib/aws/plugins/signature_v4.rb +2 -1
  78. data/lib/aws/plugins/sqs_queue_urls.rb +7 -4
  79. data/lib/aws/plugins/user_agent.rb +3 -3
  80. data/lib/aws/response_handler.rb +1 -1
  81. data/lib/aws/signers/s3.rb +1 -1
  82. data/lib/aws/tree_hash.rb +69 -0
  83. data/lib/aws/version.rb +1 -1
  84. data/spec/aws/json/builder_spec.rb +12 -0
  85. data/spec/aws/pageable_response_spec.rb +195 -0
  86. data/spec/aws/plugins/retry_errors_spec.rb +13 -0
  87. data/spec/aws/plugins/signature_v4_spec.rb +65 -0
  88. data/spec/aws/plugins/sqs_queue_urls_spec.rb +41 -0
  89. data/spec/aws_spec.rb +4 -0
  90. data/spec/fixtures/operations/glacier/get_job_output.yml +23 -0
  91. data/spec/fixtures/operations/s3/get_bucket_policy.yml +8 -0
  92. data/tasks/endpoints.rake +15 -0
  93. data/tasks/handlers.rake +1 -1
  94. data/vendor/seahorse/lib/seahorse/client.rb +1 -0
  95. data/vendor/seahorse/lib/seahorse/client/base.rb +6 -0
  96. data/vendor/seahorse/lib/seahorse/client/configuration.rb +1 -1
  97. data/vendor/seahorse/lib/seahorse/client/handler_builder.rb +3 -3
  98. data/vendor/seahorse/lib/seahorse/client/handler_list.rb +2 -2
  99. data/vendor/seahorse/lib/seahorse/client/http/error.rb +17 -0
  100. data/vendor/seahorse/lib/seahorse/client/http/plain_string_io.rb +10 -0
  101. data/vendor/seahorse/lib/seahorse/client/logging/handler.rb +1 -1
  102. data/vendor/seahorse/lib/seahorse/client/net_http/handler.rb +13 -2
  103. data/vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb +1 -1
  104. data/vendor/seahorse/lib/seahorse/client/plugins/operation_methods.rb +4 -2
  105. data/vendor/seahorse/lib/seahorse/client/plugins/restful_bindings.rb +9 -1
  106. data/vendor/seahorse/lib/seahorse/client/request.rb +14 -0
  107. data/vendor/seahorse/lib/seahorse/client/response.rb +8 -38
  108. data/vendor/seahorse/lib/seahorse/model/shapes/shape.rb +11 -3
  109. data/vendor/seahorse/spec/seahorse/client/configuration_spec.rb +13 -0
  110. data/vendor/seahorse/spec/seahorse/client/net_http/handler_spec.rb +6 -0
  111. data/vendor/seahorse/spec/seahorse/client/response_spec.rb +9 -63
  112. metadata +41 -3
@@ -0,0 +1,18 @@
1
+ {
2
+ "pagination": {
3
+ "GetRecords": {
4
+ "limit_key": "Limit",
5
+ "input_token": "ShardIterator",
6
+ "output_token": "NextShardIterator",
7
+ "result_key": "Records"
8
+ },
9
+ "ListStreams": {
10
+ "limit_key": "Limit",
11
+ "input_token": "ExclusiveStartStreamName",
12
+ "output_token": "NextShardIterator",
13
+ "output_token": "StreamNames[-1].Key",
14
+ "more_results": "HasMoreStreams",
15
+ "result_key": "StreamNames"
16
+ }
17
+ }
18
+ }
@@ -50,6 +50,7 @@
50
50
  },
51
51
  "DescribeEngineDefaultParameters": {
52
52
  "input_token": "Marker",
53
+ "output_token": "EngineDefaults.Marker",
53
54
  "limit_key": "MaxRecords"
54
55
  },
55
56
  "DescribeEventSubscriptions": {
@@ -50,6 +50,7 @@
50
50
  },
51
51
  "DescribeEngineDefaultParameters": {
52
52
  "input_token": "Marker",
53
+ "output_token": "EngineDefaults.Marker",
53
54
  "limit_key": "MaxRecords"
54
55
  },
55
56
  "DescribeEventSubscriptions": {
@@ -50,6 +50,7 @@
50
50
  },
51
51
  "DescribeEngineDefaultParameters": {
52
52
  "input_token": "Marker",
53
+ "output_token": "EngineDefaults.Marker",
53
54
  "limit_key": "MaxRecords"
54
55
  },
55
56
  "DescribeEventSubscriptions": {
@@ -44,6 +44,7 @@
44
44
  },
45
45
  "DescribeDefaultClusterParameters": {
46
46
  "input_token": "Marker",
47
+ "output_token": "Marker",
47
48
  "limit_key": "MaxRecords"
48
49
  },
49
50
  "DescribeEvents": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "ListParts": {
40
40
  "limit_key": "IsTruncated",
41
- "output_tokens": "NextPartNumberMarker",
41
+ "output_token": "NextPartNumberMarker",
42
42
  "input_token": "PartNumberMarker",
43
43
  "result_key": "Parts"
44
44
  }
@@ -18,4 +18,5 @@ Gem::Specification.new do |spec|
18
18
  spec.add_dependency('multi_json', '~> 1.0')
19
19
  spec.add_dependency('multi_xml', '~> 0.5')
20
20
  spec.add_dependency('builder', '~> 3.0')
21
+ spec.add_dependency('jamespath')
21
22
  end
@@ -0,0 +1 @@
1
+ YARD::Tags::Library.define_tag('STABILITY', :stability)
@@ -20,6 +20,11 @@ Feature: Amazon Glacier
20
20
  When I upload an archive from a 5.5MB large file
21
21
  Then I should be able to delete the archive
22
22
 
23
+ @multipart @upload @slow
24
+ Scenario: Using multipart upload interface
25
+ When I multipart-upload a 15.5MB file in 1048576 byte chunks
26
+ Then I should be able to delete the archive
27
+
23
28
  # There was an issue where the client would fail attempting to compute
24
29
  # a checksum of an empty body, this step ensures that the checksum
25
30
  # computation does not hang.
@@ -6,15 +6,66 @@ def upload_glacier_archive(contents)
6
6
  @archive_id = resp.data.archive_id if resp.data
7
7
  end
8
8
 
9
+ def create_file(size_in_mb)
10
+ file = Tempfile.new('aws-sdk-core-glacier-sample')
11
+ file.write('.' * bytes(size_in_mb.to_f))
12
+ file.rewind
13
+ file
14
+ end
15
+
16
+ def bytes(megabytes)
17
+ megabytes.to_f * 1024 * 1024
18
+ end
19
+
9
20
  When(/^I upload an archive with the contents "(.*?)"$/) do |contents|
10
21
  upload_glacier_archive(contents)
11
22
  end
12
23
 
13
- When(/^I upload an archive from a (\d+\.\d+)MB large file$/) do |size|
14
- file = Tempfile.new('aws-sdk-core-glacier-sample')
15
- file.write('.' * (1024 * 1024 * size.to_f).to_i)
16
- file.rewind
17
- upload_glacier_archive(file)
24
+ When(/^I upload an archive from a ([0-9\.]+)MB large file$/) do |size_in_mb|
25
+ upload_glacier_archive(create_file(size_in_mb))
26
+ end
27
+
28
+ When(/^I multipart\-upload a ([0-9\.]+)MB file in ([0-9\.]+) byte chunks$/) do |size_in_mb, part_size|
29
+
30
+ file = create_file(size_in_mb)
31
+ part_size = part_size.to_i
32
+
33
+ # start the multipart upload
34
+ resp = @glacier.initiate_multipart_upload(
35
+ vault_name: @vault_name,
36
+ part_size: part_size
37
+ )
38
+ @upload_id = resp.data.upload_id
39
+
40
+ # Keep a rolling tree hash of the entire file, required to complete the
41
+ # multipart upload at the end
42
+ tree_hash = Aws::TreeHash.new
43
+
44
+ # Upload the file in chunks and extract from each response the tree hash
45
+ # for that chunk. This eliminates the need to compute the total tree hash
46
+ # of the object in a second pass.
47
+ offset = 0
48
+ until file.eof?
49
+ chunk = file.read(part_size)
50
+ resp = @glacier.upload_multipart_part(
51
+ vault_name: @vault_name,
52
+ upload_id: @upload_id,
53
+ body: chunk,
54
+ range: "bytes #{offset}-#{offset+chunk.bytesize-1}/*"
55
+ )
56
+ tree_hash.hashes.concat(resp.context[:tree_hash].hashes)
57
+ offset += chunk.bytesize
58
+ end
59
+
60
+ # complete the multipart upload
61
+ resp = @glacier.complete_multipart_upload(
62
+ vault_name: @vault_name,
63
+ upload_id: @upload_id,
64
+ archive_size: file.size,
65
+ checksum: tree_hash.digest
66
+ )
67
+ @archive_id = resp.archive_id
68
+
18
69
  end
19
70
 
20
71
  Then(/^I should be able to delete the archive$/) do
@@ -0,0 +1,18 @@
1
+ # language: en
2
+ @kinesis @client
3
+ Feature: AWS Kinesis
4
+
5
+ Scenario: Making a basic request
6
+ When I call "list_streams" on "kinesis"
7
+ Then the response "stream_names" should be an array
8
+
9
+ Scenario: Error handling
10
+ Given I call "describe_stream" on "kinesis" with:
11
+ """
12
+ { stream_name: 'bogus-stream-name' }
13
+ """
14
+ Then I expect the response error code to be "ResourceNotFoundException"
15
+ And I expect the response error message to include:
16
+ """
17
+ Stream bogus-stream-name under account
18
+ """
@@ -0,0 +1,6 @@
1
+ Before("@kinesis") do
2
+ @kinesis = Aws.kinesis
3
+ end
4
+
5
+ After("@kinesis") do
6
+ end
@@ -20,3 +20,13 @@ Feature: S3 Buckets
20
20
  Given I am using the S3 "us-east-1" region
21
21
  When I create a bucket with the location constraint "EU"
22
22
  Then the bucket should have a location constraint of "EU"
23
+
24
+ Scenario: Working with bucket names that contain '.'
25
+ Given I am using the S3 "https://s3.amazonaws.com" endpoint
26
+ When I create a bucket with a DNS compatible name that contains a dot
27
+ Then I should be able to delete the bucket
28
+
29
+ Scenario: Working with bucket names that contain '.'
30
+ Given I am using the S3 "http://s3.amazonaws.com" endpoint
31
+ When I create a bucket with a DNS compatible name that contains a dot
32
+ Then I should be able to delete the bucket
@@ -16,3 +16,12 @@ Feature: S3 Objects
16
16
  Scenario: Putting a file to an object
17
17
  When I put the test png to the key "img"
18
18
  Then the object with the key "img" should have a content length of 976
19
+
20
+ @paging
21
+ Scenario: Paging responses
22
+ Given I put nothing to the key "photos/camping/cascades.jpg"
23
+ Given I put nothing to the key "photos/skiing/stevens.jpg"
24
+ And I put nothing to the key "photos/family.jpg"
25
+ And I put nothing to the key "photos/friends.jpg"
26
+ When I page s3 objects prefixed "photos/" delimited "/" limit 1
27
+ Then I should have received 4 responses
@@ -63,3 +63,32 @@ Then(/^the object with the key "(.*?)" should have a content length of (\d+)$/)
63
63
  resp = @s3.head_object(bucket: @bucket_name, key: key)
64
64
  expect(resp.data.content_length).to eq(size.to_i)
65
65
  end
66
+
67
+ When(/^I page s3 objects prefixed "(.*?)" delimited "(.*?)" limit (\d+)$/) do |prefix, delimiter, max_keys|
68
+ @responses = []
69
+ @s3.list_objects(
70
+ bucket: @bucket_name,
71
+ prefix: prefix,
72
+ delimiter: delimiter,
73
+ max_keys: max_keys
74
+ ).each do |resp|
75
+ @responses << resp
76
+ end
77
+ end
78
+
79
+ Then(/^I should have received (\d+) responses$/) do |count|
80
+ expect(@responses.size).to eq(count.to_i)
81
+ end
82
+
83
+ Given(/^I am using the S3 "(.*?)" endpoint$/) do |endpoint|
84
+ @s3 = Aws.s3(endpoint: endpoint)
85
+ end
86
+
87
+ When(/^I create a bucket with a DNS compatible name that contains a dot$/) do
88
+ @bucket_name = "aws.#{Time.now.to_i}.sdk"
89
+ @s3.create_bucket(bucket: @bucket_name)
90
+ end
91
+
92
+ Then(/^I should be able to delete the bucket$/) do
93
+ @s3.delete_bucket(bucket: @bucket_name)
94
+ end
data/lib/aws.rb CHANGED
@@ -12,11 +12,13 @@ module Aws
12
12
  autoload :Errors, "#{SRC}/errors"
13
13
  autoload :ErrorHandler, "#{SRC}/error_handler"
14
14
  autoload :InstanceProfileCredentials, "#{SRC}/instance_profile_credentials"
15
+ autoload :PageableResponse, "#{SRC}/pageable_response"
15
16
  autoload :RequestHandler, "#{SRC}/request_handler"
16
17
  autoload :ResponseHandler, "#{SRC}/response_handler"
17
18
  autoload :Service, "#{SRC}/service"
18
19
  autoload :Structure, "#{SRC}/structure"
19
20
  autoload :TimestampFormatter, "#{SRC}/timestamp_formatter"
21
+ autoload :TreeHash, "#{SRC}/tree_hash"
20
22
  autoload :Util, "#{SRC}/util"
21
23
  autoload :VERSION, "#{SRC}/version"
22
24
 
@@ -28,6 +30,7 @@ module Aws
28
30
  autoload :InputShapeTranslator, "#{SRC}/api/shape_translator"
29
31
  autoload :OperationTranslator, "#{SRC}/api/operation_translator"
30
32
  autoload :OutputShapeTranslator, "#{SRC}/api/shape_translator"
33
+ autoload :PaginationTranslator, "#{SRC}/api/pagination_translator"
31
34
  autoload :ServiceNamer, "#{SRC}/api/service_namer"
32
35
  autoload :ShapeTranslator, "#{SRC}/api/shape_translator"
33
36
  autoload :Translator, "#{SRC}/api/translator"
@@ -66,6 +69,7 @@ module Aws
66
69
  autoload :JsonRpcHeaders, "#{SRC}/plugins/json_rpc_headers"
67
70
  autoload :QueryProtocol, "#{SRC}/plugins/query_protocol"
68
71
  autoload :RegionalEndpoint, "#{SRC}/plugins/regional_endpoint"
72
+ autoload :ResponsePaging, "#{SRC}/plugins/response_paging"
69
73
  autoload :RetryErrors, "#{SRC}/plugins/retry_errors"
70
74
  autoload :S3BucketDns, "#{SRC}/plugins/s3_bucket_dns"
71
75
  autoload :S3CompleteMultipartUploadFix, "#{SRC}/plugins/s3_complete_multipart_upload_fix"
@@ -112,7 +116,14 @@ module Aws
112
116
 
113
117
  # @return [Hash] Returns a hash of default configuration options shared
114
118
  # by all constructed clients.
115
- attr_accessor :config
119
+ attr_reader :config
120
+
121
+ def config=(config)
122
+ unless Hash === config
123
+ raise ArgumentError, 'configuration object must be a hash'
124
+ end
125
+ @config = config
126
+ end
116
127
 
117
128
  # Adds a plugin to every AWS client class. This registers the plugin
118
129
  # with each versioned client for each service.
@@ -144,7 +155,7 @@ module Aws
144
155
  # (class name) for the new service class and a list of client API
145
156
  # versions.
146
157
  #
147
- # Aws.add_servcie(:S3, ['apis/S3-2006-03-01.json'])
158
+ # Aws.add_service(:S3, ['apis/S3-2006-03-01.json'])
148
159
  #
149
160
  # This method is called for each service defined in the apis directory of
150
161
  # this project.
@@ -0,0 +1,71 @@
1
+ require 'multi_json'
2
+
3
+ module Aws
4
+ module Api
5
+ class PaginationTranslator
6
+
7
+ include Util
8
+
9
+ def initialize(api)
10
+ @api = api
11
+ end
12
+
13
+ def apply(pagination)
14
+ pagination.each_pair do |operation_name, config|
15
+ if operation = @api.operations[underscore(operation_name)]
16
+ apply_paging(operation, config)
17
+ end
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def apply_paging(operation, config)
24
+ if config && config['input_token']
25
+ paging = {}
26
+ apply_tokens(paging, config)
27
+ apply_truncated(paging, config)
28
+ operation.metadata['paging'] = paging
29
+ end
30
+ end
31
+
32
+ def apply_tokens(paging, config)
33
+ paging['tokens'] = extract_tokens(config)
34
+ end
35
+
36
+ def apply_truncated(paging, config)
37
+ if truncated_if = config['more_results']
38
+ paging['truncated_if'] = underscore(truncated_if)
39
+ end
40
+ end
41
+
42
+ def extract_tokens(config)
43
+ input = Array(config['input_token'])
44
+ output = Array(config['output_token'])
45
+ (0..(input.size-1)).inject({}) do |tokens, n|
46
+ tokens[underscore(input[n])] = underscore_jamespath(output[n])
47
+ tokens
48
+ end
49
+ end
50
+
51
+ def underscore_jamespath(expression)
52
+ expression.gsub(/\w+/) { |w| underscore(w) }.gsub(/or/, '||')
53
+ end
54
+
55
+ class << self
56
+
57
+ def translate(api)
58
+ filename = api.metadata['endpoint_prefix']
59
+ filename += "-#{api.version}.paginators.json"
60
+ path = File.join(Aws::GEM_ROOT, 'apis', 'source',filename)
61
+ if File.exists?(path)
62
+ new(api).apply(MultiJson.load(File.read(path))['pagination'])
63
+ else
64
+ puts "Missing pagination config for #{path}"
65
+ end
66
+ end
67
+
68
+ end
69
+ end
70
+ end
71
+ end
@@ -6,7 +6,6 @@ module Aws::Api::ServiceTranslators::Glacier
6
6
 
7
7
  def translate(api)
8
8
  apply_plugins(api)
9
- remove_checksum(api)
10
9
  convert_types(api)
11
10
  end
12
11
 
@@ -16,12 +15,6 @@ module Aws::Api::ServiceTranslators::Glacier
16
15
  api.plugins << "Aws::Plugins::GlacierChecksums"
17
16
  end
18
17
 
19
- # this checksum parameter - it must be calculated on xml that is not user
20
- # supplied, so the sdk has to compute the checksum after building the xml
21
- def remove_checksum(api)
22
- api.operations[:complete_multipart_upload].input.members.delete(:checksum)
23
- end
24
-
25
18
  # Shapes that are bound to headers and the request URI are all typed as
26
19
  # strings, even when they *should* be integers or dates, crawling the
27
20
  # api to correct these
@@ -13,6 +13,7 @@ module Aws
13
13
  Aws::Plugins::GlobalConfiguration
14
14
  Aws::Plugins::RegionalEndpoint
15
15
  Aws::Plugins::InstanceProfileCredentials
16
+ Aws::Plugins::ResponsePaging
16
17
  Aws::Plugins::Credentials
17
18
  )
18
19
 
@@ -26,6 +27,7 @@ module Aws
26
27
  apply_xml_namespaces(api)
27
28
  set_service_names(api)
28
29
  apply_service_customizations(api)
30
+ apply_paging_metadata(api)
29
31
  sort_metadata_keys(api)
30
32
  end
31
33
  end
@@ -77,6 +79,10 @@ module Aws
77
79
  end
78
80
  end
79
81
 
82
+ def apply_paging_metadata(api)
83
+ PaginationTranslator.translate(api)
84
+ end
85
+
80
86
  def service_namer(api)
81
87
  args = []
82
88
  args << api.metadata['endpoint_prefix']
@@ -100,6 +106,7 @@ module Aws
100
106
  metadata :xmlnamespace
101
107
 
102
108
  ignore :global_endpoint
109
+ metadata :regional_endpoints
103
110
 
104
111
  def set_type(type)
105
112
  plugins = @properties['plugins'] ||= []
@@ -135,15 +142,15 @@ module Aws
135
142
  end
136
143
 
137
144
  def set_endpoint_prefix(prefix)
138
- data = MultiJson.load(File.read('apis/configuration/endpoints.json'))
139
- region_names = data['services'][prefix]
145
+ data = MultiJson.load(File.read(File.join(GEM_ROOT, 'apis', 'configuration', 'endpoints.json')))
146
+ region_names = data['services'][prefix] || []
140
147
  regions = {}
141
148
  region_names.each do |region|
142
149
  regions[region] = data['regions'][region][prefix]['hostname']
143
150
  end
144
151
  @properties['metadata'] ||= {}
145
152
  @properties['metadata']['endpoint_prefix'] = prefix
146
- @properties['metadata']['regional_endpoints'] = regions
153
+ @properties['metadata']['regional_endpoints'] = regions unless regions.empty?
147
154
  end
148
155
 
149
156
  def set_operations(operations)