aws-sdk-core 3.7.0 → 3.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1ad3cde66403be08858c06ff9ef1025d1ac4dba
4
- data.tar.gz: 5e08b5ae25d4263cced5bfbfa7e1332ff52e884a
3
+ metadata.gz: 12c854d67bbc671f35f596311bdd1cd4bf9553ce
4
+ data.tar.gz: 587f070d797c100eef80d0308236d022995a8946
5
5
  SHA512:
6
- metadata.gz: eb8e8c30934a0d8f7e1ffe81e71829387df0781f6d565ab29e91e7c8bd67d040c2b5f387976e8da919a76e26a92364555751e25b7b70635513ed36fc05e353f3
7
- data.tar.gz: 04e5c9997e08f217b852d8b373c50af591b95e267e7bacfddaa0f00c4ed0049bd04fb2d8f5547ad4778f0f48d69acbf87458fdadb2c251ef93e64ae257256a53
6
+ metadata.gz: 64424d650db1a84b4b03380f7b9316c26243b6f59156467b3eaa9aad7101d1a42ac730235901c93527c6bbca8137380451e6827e678d7249cada4f3b068960d5
7
+ data.tar.gz: 1bbbc9e69063dbcf434f7235ae3de7984bc9d1b3baf37f193fb38468a18bb65df01a85c622a83641100395e06da210f08e8e26721f33d29b5a775c13367570dd
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.8.0
@@ -54,6 +54,7 @@ require_relative 'aws-sdk-core/stubbing/protocols/query'
54
54
  require_relative 'aws-sdk-core/stubbing/protocols/rest'
55
55
  require_relative 'aws-sdk-core/stubbing/protocols/rest_json'
56
56
  require_relative 'aws-sdk-core/stubbing/protocols/rest_xml'
57
+ require_relative 'aws-sdk-core/stubbing/protocols/api_gateway'
57
58
 
58
59
  # protocols
59
60
 
@@ -260,11 +260,12 @@ module Aws
260
260
 
261
261
  def protocol_helper
262
262
  case config.api.metadata['protocol']
263
- when 'json' then Stubbing::Protocols::Json
264
- when 'query' then Stubbing::Protocols::Query
265
- when 'ec2' then Stubbing::Protocols::EC2
266
- when 'rest-json' then Stubbing::Protocols::RestJson
267
- when 'rest-xml' then Stubbing::Protocols::RestXml
263
+ when 'json' then Stubbing::Protocols::Json
264
+ when 'query' then Stubbing::Protocols::Query
265
+ when 'ec2' then Stubbing::Protocols::EC2
266
+ when 'rest-json' then Stubbing::Protocols::RestJson
267
+ when 'rest-xml' then Stubbing::Protocols::RestXml
268
+ when 'api-gateway' then Stubbing::Protocols::ApiGateway
268
269
  else raise "unsupported protocol"
269
270
  end.new
270
271
  end
@@ -0,0 +1,55 @@
1
+ module Aws
2
+ module Plugins
3
+
4
+ # Provide support for `api_key` parameter for `api-gateway` protocol
5
+ # specific `api-gateway` protocol gems' user-agent
6
+ class ApiKey < Seahorse::Client::Plugin
7
+
8
+ option(:api_key,
9
+ default: nil,
10
+ doc_type: 'String',
11
+ docstring: <<-DOCS)
12
+ When provided, `x-api-key` header will be injected with the value provided.
13
+ DOCS
14
+
15
+ def add_handlers(handlers, config)
16
+ handlers.add(OptionHandler, step: :initialize)
17
+ handlers.add(ApiKeyHandler, step: :build, priority: 0)
18
+ end
19
+
20
+ # @api private
21
+ class OptionHandler < Seahorse::Client::Handler
22
+ def call(context)
23
+ # apply APIG user-agent by default
24
+ context.config.user_agent_suffix ||= 'aws-apig-ruby'
25
+
26
+ if context.operation.require_apikey
27
+ api_key = context.params.delete(:api_key)
28
+ api_key = context.config.api_key if api_key.nil?
29
+ context[:api_key] = api_key
30
+ end
31
+
32
+ @handler.call(context)
33
+ end
34
+
35
+ end
36
+
37
+ # @api private
38
+ class ApiKeyHandler < Seahorse::Client::Handler
39
+
40
+ def call(context)
41
+ if context[:api_key]
42
+ apply_api_key(context)
43
+ end
44
+ @handler.call(context)
45
+ end
46
+
47
+ private
48
+
49
+ def apply_api_key(context)
50
+ context.http_request.headers['x-api-key'] = context[:api_key]
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,30 @@
1
+ module Aws
2
+ module Plugins
3
+
4
+ # apply APIG custom authorizer token to
5
+ # operations with 'authtype' of 'custom' only
6
+ class APIGAuthorizerToken < Seahorse::Client::Plugin
7
+
8
+ option(:authorizer_token, default: nil)
9
+
10
+ def add_handlers(handlers, config)
11
+ handlers.add(AuthTokenHandler, step: :sign)
12
+ end
13
+
14
+ # @api private
15
+ class AuthTokenHandler < Seahorse::Client::Handler
16
+
17
+ def call(context)
18
+ if context.operation['authtype'] == 'custom' &&
19
+ context.config.authorizer_token &&
20
+ context.authorizer.placement[:location] == 'header'
21
+
22
+ header = context.authorizer.placement[:name]
23
+ context.http_request.headers[header] = context.config.authorizer_token
24
+ end
25
+ @handler.call(context)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ module Aws
2
+ # @api private
3
+ module Plugins
4
+ # @api private
5
+ # Used for APIGateway generated SDKs credentials config
6
+ class APIGCredentialsConfiguration < Seahorse::Client::Plugin
7
+
8
+ option(:access_key_id, doc_type: String, docstring: '')
9
+
10
+ option(:secret_access_key, doc_type: String, docstring: '')
11
+
12
+ option(:session_token, doc_type: String, docstring: '')
13
+
14
+ option(:profile, doc_type: String, docstring: '')
15
+
16
+ option(:credentials,
17
+ required: false,
18
+ doc_type: 'Aws::CredentialProvider',
19
+ docstring: <<-DOCS
20
+ AWS Credentials options is only required when your API uses
21
+ [AWS Signature Version 4](http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html),
22
+ more AWS Credentials Configuration Options are available [here](https://github.com/aws/aws-sdk-ruby#configuration).
23
+ DOCS
24
+ ) do |config|
25
+ CredentialProviderChain.new(config).resolve
26
+ end
27
+
28
+ option(:instance_profile_credentials_retries, 0)
29
+
30
+ option(:instance_profile_credentials_timeout, 1)
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ module Aws
2
+ module Plugins
3
+ module Protocols
4
+ class ApiGateway < Seahorse::Client::Plugin
5
+ handler(Rest::Handler)
6
+ handler(Json::ErrorHandler, step: :sign)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -41,10 +41,12 @@ module Aws
41
41
 
42
42
  option(:unsigned_operations) do |cfg|
43
43
  cfg.api.operation_names.inject([]) do |unsigned, operation_name|
44
- if cfg.api.operation(operation_name)['authtype'] != 'none'
45
- unsigned
46
- else
44
+ if cfg.api.operation(operation_name)['authtype'] == 'none' ||
45
+ cfg.api.operation(operation_name)['authtype'] == 'custom'
46
+ # Unsign requests that has custom apigateway authorizer as well
47
47
  unsigned << operation_name
48
+ else
49
+ unsigned
48
50
  end
49
51
  end
50
52
  end
@@ -31,7 +31,7 @@ module Aws
31
31
  def populate_body(context)
32
32
  Body.new(
33
33
  serializer_class(context),
34
- context.operation.input,
34
+ context.operation.input
35
35
  ).apply(context.http_request, context.params)
36
36
  end
37
37
 
@@ -40,6 +40,7 @@ module Aws
40
40
  case protocol
41
41
  when 'rest-xml' then Xml::Builder
42
42
  when 'rest-json' then Json::Builder
43
+ when 'api-gateway' then Json::Builder
43
44
  else raise "unsupported protocol #{protocol}"
44
45
  end
45
46
  end
@@ -37,6 +37,7 @@ module Aws
37
37
  case protocol
38
38
  when 'rest-xml' then Xml::Parser
39
39
  when 'rest-json' then Json::Parser
40
+ when 'api-gateway' then Json::Parser
40
41
  else raise "unsupported protocol #{protocol}"
41
42
  end
42
43
  end
@@ -0,0 +1,8 @@
1
+ module Aws
2
+ module Stubbing
3
+ module Protocols
4
+ class ApiGateway < RestJson
5
+ end
6
+ end
7
+ end
8
+ end
@@ -45,6 +45,7 @@ require_relative 'seahorse/client/plugins/response_target'
45
45
 
46
46
  require_relative 'seahorse/model/api'
47
47
  require_relative 'seahorse/model/operation'
48
+ require_relative 'seahorse/model/authorizer'
48
49
  require_relative 'seahorse/model/shapes'
49
50
 
50
51
  require_relative 'seahorse/client/base'
@@ -6,6 +6,7 @@ module Seahorse
6
6
 
7
7
  # @option options [required,Symbol] :operation_name (nil)
8
8
  # @option options [required,Model::Operation] :operation (nil)
9
+ # @option options [Model::Authorizer] :authorizer (nil)
9
10
  # @option options [Hash] :params ({})
10
11
  # @option options [Configuration] :config (nil)
11
12
  # @option options [Http::Request] :http_request (Http::Request.new)
@@ -14,6 +15,7 @@ module Seahorse
14
15
  def initialize(options = {})
15
16
  @operation_name = options[:operation_name]
16
17
  @operation = options[:operation]
18
+ @authorizer = options[:authorizer]
17
19
  @client = options[:client]
18
20
  @params = options[:params] || {}
19
21
  @config = options[:config]
@@ -29,6 +31,9 @@ module Seahorse
29
31
  # @return [Model::Operation]
30
32
  attr_accessor :operation
31
33
 
34
+ # @return [Model::Authorizer] APIG SDKs only
35
+ attr_accessor :authorizer
36
+
32
37
  # @return [Seahorse::Client::Base]
33
38
  attr_accessor :client
34
39
 
@@ -5,6 +5,7 @@ module Seahorse
5
5
  def initialize
6
6
  @metadata = {}
7
7
  @operations = {}
8
+ @authorizers = {}
8
9
  end
9
10
 
10
11
  # @return [String, nil]
@@ -37,6 +38,30 @@ module Seahorse
37
38
  @operations[name.to_sym] = operation
38
39
  end
39
40
 
41
+ def authorizers(&block)
42
+ if block_given?
43
+ @authorizers.each(&block)
44
+ else
45
+ @authorizers.enum_for(:each)
46
+ end
47
+ end
48
+
49
+ def authorizer(name)
50
+ if @authorizers.key?(name.to_sym)
51
+ @authorizers[name.to_sym]
52
+ else
53
+ raise ArgumentError, "unknown authorizer #{name.inspect}"
54
+ end
55
+ end
56
+
57
+ def authorizer_names
58
+ @authorizers.keys
59
+ end
60
+
61
+ def add_authorizer(name, authorizer)
62
+ @authorizers[name.to_sym] = authorizer
63
+ end
64
+
40
65
  def inspect(*args)
41
66
  "#<#{self.class.name}>"
42
67
  end
@@ -0,0 +1,21 @@
1
+ module Seahorse
2
+ module Model
3
+ class Authorizer
4
+
5
+ def initialize
6
+ @type = 'provided'
7
+ @placement = {}
8
+ end
9
+
10
+ # @return [String]
11
+ attr_accessor :name
12
+
13
+ # @return [String]
14
+ attr_accessor :type
15
+
16
+ # @return [Hash]
17
+ attr_accessor :placement
18
+
19
+ end
20
+ end
21
+ end
@@ -25,6 +25,9 @@ module Seahorse
25
25
  # @return [String, nil]
26
26
  attr_accessor :documentation
27
27
 
28
+ # @return [String, nil]
29
+ attr_accessor :authorizer
30
+
28
31
  # @return [ShapeRef, nil]
29
32
  attr_accessor :input
30
33
 
@@ -34,6 +37,10 @@ module Seahorse
34
37
  # @return [Array<ShapeRef>]
35
38
  attr_accessor :errors
36
39
 
40
+ # APIG only
41
+ # @return [Boolean]
42
+ attr_accessor :require_apikey
43
+
37
44
  def [](key)
38
45
  @metadata[key.to_s]
39
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath
@@ -88,6 +88,9 @@ files:
88
88
  - lib/aws-sdk-core/pager.rb
89
89
  - lib/aws-sdk-core/param_converter.rb
90
90
  - lib/aws-sdk-core/param_validator.rb
91
+ - lib/aws-sdk-core/plugins/api_key.rb
92
+ - lib/aws-sdk-core/plugins/apig_authorizer_token.rb
93
+ - lib/aws-sdk-core/plugins/apig_credentials_configuration.rb
91
94
  - lib/aws-sdk-core/plugins/credentials_configuration.rb
92
95
  - lib/aws-sdk-core/plugins/global_configuration.rb
93
96
  - lib/aws-sdk-core/plugins/helpful_socket_errors.rb
@@ -96,6 +99,7 @@ files:
96
99
  - lib/aws-sdk-core/plugins/logging.rb
97
100
  - lib/aws-sdk-core/plugins/param_converter.rb
98
101
  - lib/aws-sdk-core/plugins/param_validator.rb
102
+ - lib/aws-sdk-core/plugins/protocols/api_gateway.rb
99
103
  - lib/aws-sdk-core/plugins/protocols/ec2.rb
100
104
  - lib/aws-sdk-core/plugins/protocols/json_rpc.rb
101
105
  - lib/aws-sdk-core/plugins/protocols/query.rb
@@ -132,6 +136,7 @@ files:
132
136
  - lib/aws-sdk-core/structure.rb
133
137
  - lib/aws-sdk-core/stubbing/data_applicator.rb
134
138
  - lib/aws-sdk-core/stubbing/empty_stub.rb
139
+ - lib/aws-sdk-core/stubbing/protocols/api_gateway.rb
135
140
  - lib/aws-sdk-core/stubbing/protocols/ec2.rb
136
141
  - lib/aws-sdk-core/stubbing/protocols/json.rb
137
142
  - lib/aws-sdk-core/stubbing/protocols/query.rb
@@ -200,6 +205,7 @@ files:
200
205
  - lib/seahorse/client/request_context.rb
201
206
  - lib/seahorse/client/response.rb
202
207
  - lib/seahorse/model/api.rb
208
+ - lib/seahorse/model/authorizer.rb
203
209
  - lib/seahorse/model/operation.rb
204
210
  - lib/seahorse/model/shapes.rb
205
211
  - lib/seahorse/util.rb