aws-sdk-kms 1.72.0 → 1.96.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.
@@ -33,6 +33,7 @@ module Aws::KMS
33
33
  # * {CloudHsmClusterNotActiveException}
34
34
  # * {CloudHsmClusterNotFoundException}
35
35
  # * {CloudHsmClusterNotRelatedException}
36
+ # * {ConflictException}
36
37
  # * {CustomKeyStoreHasCMKsException}
37
38
  # * {CustomKeyStoreInvalidStateException}
38
39
  # * {CustomKeyStoreNameInUseException}
@@ -171,6 +172,21 @@ module Aws::KMS
171
172
  end
172
173
  end
173
174
 
175
+ class ConflictException < ServiceError
176
+
177
+ # @param [Seahorse::Client::RequestContext] context
178
+ # @param [String] message
179
+ # @param [Aws::KMS::Types::ConflictException] data
180
+ def initialize(context, message, data = Aws::EmptyStructure.new)
181
+ super(context, message, data)
182
+ end
183
+
184
+ # @return [String]
185
+ def message
186
+ @message || @data[:message]
187
+ end
188
+ end
189
+
174
190
  class CustomKeyStoreHasCMKsException < ServiceError
175
191
 
176
192
  # @param [Seahorse::Client::RequestContext] context
@@ -14,35 +14,49 @@ module Aws::KMS
14
14
  option(
15
15
  :endpoint_provider,
16
16
  doc_type: 'Aws::KMS::EndpointProvider',
17
- docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
- 'object that responds to `#resolve_endpoint(parameters)` '\
19
- 'where `parameters` is a Struct similar to '\
20
- '`Aws::KMS::EndpointParameters`'
21
- ) do |cfg|
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::KMS::EndpointParameters`.
22
+ DOCS
22
23
  Aws::KMS::EndpointProvider.new
23
24
  end
24
25
 
25
26
  # @api private
26
27
  class Handler < Seahorse::Client::Handler
27
28
  def call(context)
28
- # If endpoint was discovered, do not resolve or apply the endpoint.
29
29
  unless context[:discovered_endpoint]
30
- params = parameters_for_operation(context)
30
+ params = Aws::KMS::Endpoints.parameters_for_operation(context)
31
31
  endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
32
 
33
33
  context.http_request.endpoint = endpoint.url
34
34
  apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
35
38
  end
36
39
 
37
- context[:endpoint_params] = params
38
40
  context[:auth_scheme] =
39
41
  Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
42
 
41
- @handler.call(context)
43
+ with_metrics(context) { @handler.call(context) }
42
44
  end
43
45
 
44
46
  private
45
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
+
46
60
  def apply_endpoint_headers(context, headers)
47
61
  headers.each do |key, values|
48
62
  value = values
@@ -53,111 +67,6 @@ module Aws::KMS
53
67
  context.http_request.headers[key] = value
54
68
  end
55
69
  end
56
-
57
- def parameters_for_operation(context)
58
- case context.operation_name
59
- when :cancel_key_deletion
60
- Aws::KMS::Endpoints::CancelKeyDeletion.build(context)
61
- when :connect_custom_key_store
62
- Aws::KMS::Endpoints::ConnectCustomKeyStore.build(context)
63
- when :create_alias
64
- Aws::KMS::Endpoints::CreateAlias.build(context)
65
- when :create_custom_key_store
66
- Aws::KMS::Endpoints::CreateCustomKeyStore.build(context)
67
- when :create_grant
68
- Aws::KMS::Endpoints::CreateGrant.build(context)
69
- when :create_key
70
- Aws::KMS::Endpoints::CreateKey.build(context)
71
- when :decrypt
72
- Aws::KMS::Endpoints::Decrypt.build(context)
73
- when :delete_alias
74
- Aws::KMS::Endpoints::DeleteAlias.build(context)
75
- when :delete_custom_key_store
76
- Aws::KMS::Endpoints::DeleteCustomKeyStore.build(context)
77
- when :delete_imported_key_material
78
- Aws::KMS::Endpoints::DeleteImportedKeyMaterial.build(context)
79
- when :describe_custom_key_stores
80
- Aws::KMS::Endpoints::DescribeCustomKeyStores.build(context)
81
- when :describe_key
82
- Aws::KMS::Endpoints::DescribeKey.build(context)
83
- when :disable_key
84
- Aws::KMS::Endpoints::DisableKey.build(context)
85
- when :disable_key_rotation
86
- Aws::KMS::Endpoints::DisableKeyRotation.build(context)
87
- when :disconnect_custom_key_store
88
- Aws::KMS::Endpoints::DisconnectCustomKeyStore.build(context)
89
- when :enable_key
90
- Aws::KMS::Endpoints::EnableKey.build(context)
91
- when :enable_key_rotation
92
- Aws::KMS::Endpoints::EnableKeyRotation.build(context)
93
- when :encrypt
94
- Aws::KMS::Endpoints::Encrypt.build(context)
95
- when :generate_data_key
96
- Aws::KMS::Endpoints::GenerateDataKey.build(context)
97
- when :generate_data_key_pair
98
- Aws::KMS::Endpoints::GenerateDataKeyPair.build(context)
99
- when :generate_data_key_pair_without_plaintext
100
- Aws::KMS::Endpoints::GenerateDataKeyPairWithoutPlaintext.build(context)
101
- when :generate_data_key_without_plaintext
102
- Aws::KMS::Endpoints::GenerateDataKeyWithoutPlaintext.build(context)
103
- when :generate_mac
104
- Aws::KMS::Endpoints::GenerateMac.build(context)
105
- when :generate_random
106
- Aws::KMS::Endpoints::GenerateRandom.build(context)
107
- when :get_key_policy
108
- Aws::KMS::Endpoints::GetKeyPolicy.build(context)
109
- when :get_key_rotation_status
110
- Aws::KMS::Endpoints::GetKeyRotationStatus.build(context)
111
- when :get_parameters_for_import
112
- Aws::KMS::Endpoints::GetParametersForImport.build(context)
113
- when :get_public_key
114
- Aws::KMS::Endpoints::GetPublicKey.build(context)
115
- when :import_key_material
116
- Aws::KMS::Endpoints::ImportKeyMaterial.build(context)
117
- when :list_aliases
118
- Aws::KMS::Endpoints::ListAliases.build(context)
119
- when :list_grants
120
- Aws::KMS::Endpoints::ListGrants.build(context)
121
- when :list_key_policies
122
- Aws::KMS::Endpoints::ListKeyPolicies.build(context)
123
- when :list_keys
124
- Aws::KMS::Endpoints::ListKeys.build(context)
125
- when :list_resource_tags
126
- Aws::KMS::Endpoints::ListResourceTags.build(context)
127
- when :list_retirable_grants
128
- Aws::KMS::Endpoints::ListRetirableGrants.build(context)
129
- when :put_key_policy
130
- Aws::KMS::Endpoints::PutKeyPolicy.build(context)
131
- when :re_encrypt
132
- Aws::KMS::Endpoints::ReEncrypt.build(context)
133
- when :replicate_key
134
- Aws::KMS::Endpoints::ReplicateKey.build(context)
135
- when :retire_grant
136
- Aws::KMS::Endpoints::RetireGrant.build(context)
137
- when :revoke_grant
138
- Aws::KMS::Endpoints::RevokeGrant.build(context)
139
- when :schedule_key_deletion
140
- Aws::KMS::Endpoints::ScheduleKeyDeletion.build(context)
141
- when :sign
142
- Aws::KMS::Endpoints::Sign.build(context)
143
- when :tag_resource
144
- Aws::KMS::Endpoints::TagResource.build(context)
145
- when :untag_resource
146
- Aws::KMS::Endpoints::UntagResource.build(context)
147
- when :update_alias
148
- Aws::KMS::Endpoints::UpdateAlias.build(context)
149
- when :update_custom_key_store
150
- Aws::KMS::Endpoints::UpdateCustomKeyStore.build(context)
151
- when :update_key_description
152
- Aws::KMS::Endpoints::UpdateKeyDescription.build(context)
153
- when :update_primary_region
154
- Aws::KMS::Endpoints::UpdatePrimaryRegion.build(context)
155
- when :verify
156
- Aws::KMS::Endpoints::Verify.build(context)
157
- when :verify_mac
158
- Aws::KMS::Endpoints::VerifyMac.build(context)
159
- end
160
- end
161
70
  end
162
71
 
163
72
  def add_handlers(handlers, _config)