aws-sdk-secretsmanager 1.31.0 → 1.113.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,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::SecretsManager
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint)
14
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
15
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
16
+ end
17
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
18
+ raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
19
+ end
20
+ return Aws::Endpoints::Endpoint.new(url: parameters.endpoint, headers: {}, properties: {})
21
+ end
22
+ if Aws::Endpoints::Matchers.set?(parameters.region)
23
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
24
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
25
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS")) && Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
26
+ if Aws::Endpoints::Matchers.string_equals?("aws", Aws::Endpoints::Matchers.attr(partition_result, "name"))
27
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager-fips.#{parameters.region}.amazonaws.com", headers: {}, properties: {})
28
+ end
29
+ if Aws::Endpoints::Matchers.string_equals?("aws-us-gov", Aws::Endpoints::Matchers.attr(partition_result, "name"))
30
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager-fips.#{parameters.region}.amazonaws.com", headers: {}, properties: {})
31
+ end
32
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager-fips.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
33
+ end
34
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
35
+ end
36
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
37
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
38
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager-fips.#{parameters.region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
39
+ end
40
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
41
+ end
42
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
43
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
44
+ if Aws::Endpoints::Matchers.string_equals?("aws", Aws::Endpoints::Matchers.attr(partition_result, "name"))
45
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager.#{parameters.region}.amazonaws.com", headers: {}, properties: {})
46
+ end
47
+ if Aws::Endpoints::Matchers.string_equals?("aws-cn", Aws::Endpoints::Matchers.attr(partition_result, "name"))
48
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager.#{parameters.region}.amazonaws.com.cn", headers: {}, properties: {})
49
+ end
50
+ if Aws::Endpoints::Matchers.string_equals?("aws-us-gov", Aws::Endpoints::Matchers.attr(partition_result, "name"))
51
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager.#{parameters.region}.amazonaws.com", headers: {}, properties: {})
52
+ end
53
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
54
+ end
55
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
56
+ end
57
+ return Aws::Endpoints::Endpoint.new(url: "https://secretsmanager.#{parameters.region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
58
+ end
59
+ end
60
+ raise ArgumentError, "Invalid Configuration: Missing Region"
61
+ raise ArgumentError, 'No endpoint could be resolved'
62
+
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::SecretsManager
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::SecretsManager::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -1,11 +1,47 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
8
10
  module Aws::SecretsManager
11
+
12
+ # When SecretsManager returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::SecretsManager::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all SecretsManager errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::SecretsManager::Errors::ServiceError
20
+ # # rescues all SecretsManager API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {DecryptionFailure}
31
+ # * {EncryptionFailure}
32
+ # * {InternalServiceError}
33
+ # * {InvalidNextTokenException}
34
+ # * {InvalidParameterException}
35
+ # * {InvalidRequestException}
36
+ # * {LimitExceededException}
37
+ # * {MalformedPolicyDocumentException}
38
+ # * {PreconditionNotMetException}
39
+ # * {PublicPolicyException}
40
+ # * {ResourceExistsException}
41
+ # * {ResourceNotFoundException}
42
+ #
43
+ # Additionally, error classes are dynamically generated for service errors based on the error code
44
+ # if they are not defined above.
9
45
  module Errors
10
46
 
11
47
  extend Aws::Errors::DynamicErrors
@@ -23,7 +59,6 @@ module Aws::SecretsManager
23
59
  def message
24
60
  @message || @data[:message]
25
61
  end
26
-
27
62
  end
28
63
 
29
64
  class EncryptionFailure < ServiceError
@@ -39,7 +74,6 @@ module Aws::SecretsManager
39
74
  def message
40
75
  @message || @data[:message]
41
76
  end
42
-
43
77
  end
44
78
 
45
79
  class InternalServiceError < ServiceError
@@ -55,7 +89,6 @@ module Aws::SecretsManager
55
89
  def message
56
90
  @message || @data[:message]
57
91
  end
58
-
59
92
  end
60
93
 
61
94
  class InvalidNextTokenException < ServiceError
@@ -71,7 +104,6 @@ module Aws::SecretsManager
71
104
  def message
72
105
  @message || @data[:message]
73
106
  end
74
-
75
107
  end
76
108
 
77
109
  class InvalidParameterException < ServiceError
@@ -87,7 +119,6 @@ module Aws::SecretsManager
87
119
  def message
88
120
  @message || @data[:message]
89
121
  end
90
-
91
122
  end
92
123
 
93
124
  class InvalidRequestException < ServiceError
@@ -103,7 +134,6 @@ module Aws::SecretsManager
103
134
  def message
104
135
  @message || @data[:message]
105
136
  end
106
-
107
137
  end
108
138
 
109
139
  class LimitExceededException < ServiceError
@@ -119,7 +149,6 @@ module Aws::SecretsManager
119
149
  def message
120
150
  @message || @data[:message]
121
151
  end
122
-
123
152
  end
124
153
 
125
154
  class MalformedPolicyDocumentException < ServiceError
@@ -135,7 +164,6 @@ module Aws::SecretsManager
135
164
  def message
136
165
  @message || @data[:message]
137
166
  end
138
-
139
167
  end
140
168
 
141
169
  class PreconditionNotMetException < ServiceError
@@ -151,7 +179,21 @@ module Aws::SecretsManager
151
179
  def message
152
180
  @message || @data[:message]
153
181
  end
182
+ end
183
+
184
+ class PublicPolicyException < ServiceError
185
+
186
+ # @param [Seahorse::Client::RequestContext] context
187
+ # @param [String] message
188
+ # @param [Aws::SecretsManager::Types::PublicPolicyException] data
189
+ def initialize(context, message, data = Aws::EmptyStructure.new)
190
+ super(context, message, data)
191
+ end
154
192
 
193
+ # @return [String]
194
+ def message
195
+ @message || @data[:message]
196
+ end
155
197
  end
156
198
 
157
199
  class ResourceExistsException < ServiceError
@@ -167,7 +209,6 @@ module Aws::SecretsManager
167
209
  def message
168
210
  @message || @data[:message]
169
211
  end
170
-
171
212
  end
172
213
 
173
214
  class ResourceNotFoundException < ServiceError
@@ -183,7 +224,6 @@ module Aws::SecretsManager
183
224
  def message
184
225
  @message || @data[:message]
185
226
  end
186
-
187
227
  end
188
228
 
189
229
  end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::SecretsManager
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::SecretsManager::EndpointProvider',
17
+ rbs_type: 'untyped',
18
+ docstring: <<~DOCS) do |_cfg|
19
+ The endpoint provider used to resolve endpoints. Any object that responds to
20
+ `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
21
+ `Aws::SecretsManager::EndpointParameters`.
22
+ DOCS
23
+ Aws::SecretsManager::EndpointProvider.new
24
+ end
25
+
26
+ # @api private
27
+ class Handler < Seahorse::Client::Handler
28
+ def call(context)
29
+ unless context[:discovered_endpoint]
30
+ params = Aws::SecretsManager::Endpoints.parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
38
+ end
39
+
40
+ context[:auth_scheme] =
41
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
+
43
+ with_metrics(context) { @handler.call(context) }
44
+ end
45
+
46
+ private
47
+
48
+ def with_metrics(context, &block)
49
+ metrics = []
50
+ metrics << 'ENDPOINT_OVERRIDE' unless context.config.regional_endpoint
51
+ if context[:auth_scheme] && context[:auth_scheme]['name'] == 'sigv4a'
52
+ metrics << 'SIGV4A_SIGNING'
53
+ end
54
+ if context.config.credentials&.credentials&.account_id
55
+ metrics << 'RESOLVED_ACCOUNT_ID'
56
+ end
57
+ Aws::Plugins::UserAgent.metric(*metrics, &block)
58
+ end
59
+
60
+ def apply_endpoint_headers(context, headers)
61
+ headers.each do |key, values|
62
+ value = values
63
+ .compact
64
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
65
+ .join(',')
66
+
67
+ context.http_request.headers[key] = value
68
+ end
69
+ end
70
+ end
71
+
72
+ def add_handlers(handlers, _config)
73
+ handlers.add(Handler, step: :build, priority: 75)
74
+ end
75
+ end
76
+ end
77
+ end
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
8
10
  module Aws::SecretsManager
11
+
9
12
  class Resource
10
13
 
11
14
  # @param options ({})