aws-sdk-kms 1.88.0 → 1.105.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.
@@ -15,11 +15,11 @@ module Aws::KMS
15
15
  :endpoint_provider,
16
16
  doc_type: 'Aws::KMS::EndpointProvider',
17
17
  rbs_type: 'untyped',
18
- docstring: 'The endpoint provider used to resolve endpoints. Any '\
19
- 'object that responds to `#resolve_endpoint(parameters)` '\
20
- 'where `parameters` is a Struct similar to '\
21
- '`Aws::KMS::EndpointParameters`'
22
- ) do |cfg|
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
23
23
  Aws::KMS::EndpointProvider.new
24
24
  end
25
25
 
@@ -27,7 +27,7 @@ module Aws::KMS
27
27
  class Handler < Seahorse::Client::Handler
28
28
  def call(context)
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
@@ -40,11 +40,23 @@ module Aws::KMS
40
40
  context[:auth_scheme] =
41
41
  Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
42
 
43
- @handler.call(context)
43
+ with_metrics(context) { @handler.call(context) }
44
44
  end
45
45
 
46
46
  private
47
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
+
48
60
  def apply_endpoint_headers(context, headers)
49
61
  headers.each do |key, values|
50
62
  value = values
@@ -55,117 +67,6 @@ module Aws::KMS
55
67
  context.http_request.headers[key] = value
56
68
  end
57
69
  end
58
-
59
- def parameters_for_operation(context)
60
- case context.operation_name
61
- when :cancel_key_deletion
62
- Aws::KMS::Endpoints::CancelKeyDeletion.build(context)
63
- when :connect_custom_key_store
64
- Aws::KMS::Endpoints::ConnectCustomKeyStore.build(context)
65
- when :create_alias
66
- Aws::KMS::Endpoints::CreateAlias.build(context)
67
- when :create_custom_key_store
68
- Aws::KMS::Endpoints::CreateCustomKeyStore.build(context)
69
- when :create_grant
70
- Aws::KMS::Endpoints::CreateGrant.build(context)
71
- when :create_key
72
- Aws::KMS::Endpoints::CreateKey.build(context)
73
- when :decrypt
74
- Aws::KMS::Endpoints::Decrypt.build(context)
75
- when :delete_alias
76
- Aws::KMS::Endpoints::DeleteAlias.build(context)
77
- when :delete_custom_key_store
78
- Aws::KMS::Endpoints::DeleteCustomKeyStore.build(context)
79
- when :delete_imported_key_material
80
- Aws::KMS::Endpoints::DeleteImportedKeyMaterial.build(context)
81
- when :derive_shared_secret
82
- Aws::KMS::Endpoints::DeriveSharedSecret.build(context)
83
- when :describe_custom_key_stores
84
- Aws::KMS::Endpoints::DescribeCustomKeyStores.build(context)
85
- when :describe_key
86
- Aws::KMS::Endpoints::DescribeKey.build(context)
87
- when :disable_key
88
- Aws::KMS::Endpoints::DisableKey.build(context)
89
- when :disable_key_rotation
90
- Aws::KMS::Endpoints::DisableKeyRotation.build(context)
91
- when :disconnect_custom_key_store
92
- Aws::KMS::Endpoints::DisconnectCustomKeyStore.build(context)
93
- when :enable_key
94
- Aws::KMS::Endpoints::EnableKey.build(context)
95
- when :enable_key_rotation
96
- Aws::KMS::Endpoints::EnableKeyRotation.build(context)
97
- when :encrypt
98
- Aws::KMS::Endpoints::Encrypt.build(context)
99
- when :generate_data_key
100
- Aws::KMS::Endpoints::GenerateDataKey.build(context)
101
- when :generate_data_key_pair
102
- Aws::KMS::Endpoints::GenerateDataKeyPair.build(context)
103
- when :generate_data_key_pair_without_plaintext
104
- Aws::KMS::Endpoints::GenerateDataKeyPairWithoutPlaintext.build(context)
105
- when :generate_data_key_without_plaintext
106
- Aws::KMS::Endpoints::GenerateDataKeyWithoutPlaintext.build(context)
107
- when :generate_mac
108
- Aws::KMS::Endpoints::GenerateMac.build(context)
109
- when :generate_random
110
- Aws::KMS::Endpoints::GenerateRandom.build(context)
111
- when :get_key_policy
112
- Aws::KMS::Endpoints::GetKeyPolicy.build(context)
113
- when :get_key_rotation_status
114
- Aws::KMS::Endpoints::GetKeyRotationStatus.build(context)
115
- when :get_parameters_for_import
116
- Aws::KMS::Endpoints::GetParametersForImport.build(context)
117
- when :get_public_key
118
- Aws::KMS::Endpoints::GetPublicKey.build(context)
119
- when :import_key_material
120
- Aws::KMS::Endpoints::ImportKeyMaterial.build(context)
121
- when :list_aliases
122
- Aws::KMS::Endpoints::ListAliases.build(context)
123
- when :list_grants
124
- Aws::KMS::Endpoints::ListGrants.build(context)
125
- when :list_key_policies
126
- Aws::KMS::Endpoints::ListKeyPolicies.build(context)
127
- when :list_key_rotations
128
- Aws::KMS::Endpoints::ListKeyRotations.build(context)
129
- when :list_keys
130
- Aws::KMS::Endpoints::ListKeys.build(context)
131
- when :list_resource_tags
132
- Aws::KMS::Endpoints::ListResourceTags.build(context)
133
- when :list_retirable_grants
134
- Aws::KMS::Endpoints::ListRetirableGrants.build(context)
135
- when :put_key_policy
136
- Aws::KMS::Endpoints::PutKeyPolicy.build(context)
137
- when :re_encrypt
138
- Aws::KMS::Endpoints::ReEncrypt.build(context)
139
- when :replicate_key
140
- Aws::KMS::Endpoints::ReplicateKey.build(context)
141
- when :retire_grant
142
- Aws::KMS::Endpoints::RetireGrant.build(context)
143
- when :revoke_grant
144
- Aws::KMS::Endpoints::RevokeGrant.build(context)
145
- when :rotate_key_on_demand
146
- Aws::KMS::Endpoints::RotateKeyOnDemand.build(context)
147
- when :schedule_key_deletion
148
- Aws::KMS::Endpoints::ScheduleKeyDeletion.build(context)
149
- when :sign
150
- Aws::KMS::Endpoints::Sign.build(context)
151
- when :tag_resource
152
- Aws::KMS::Endpoints::TagResource.build(context)
153
- when :untag_resource
154
- Aws::KMS::Endpoints::UntagResource.build(context)
155
- when :update_alias
156
- Aws::KMS::Endpoints::UpdateAlias.build(context)
157
- when :update_custom_key_store
158
- Aws::KMS::Endpoints::UpdateCustomKeyStore.build(context)
159
- when :update_key_description
160
- Aws::KMS::Endpoints::UpdateKeyDescription.build(context)
161
- when :update_primary_region
162
- Aws::KMS::Endpoints::UpdatePrimaryRegion.build(context)
163
- when :verify
164
- Aws::KMS::Endpoints::Verify.build(context)
165
- when :verify_mac
166
- Aws::KMS::Endpoints::VerifyMac.build(context)
167
- end
168
- end
169
70
  end
170
71
 
171
72
  def add_handlers(handlers, _config)