aws-sdk-credentialbroker 1.0.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,227 @@
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::CredentialBroker
12
+ # @api private
13
+ module ClientApi
14
+
15
+ include Seahorse::Model
16
+
17
+ AccessDeniedException = Shapes::StructureShape.new(name: 'AccessDeniedException')
18
+ AccessDeniedReason = Shapes::StringShape.new(name: 'AccessDeniedReason')
19
+ AccessToken = Shapes::StringShape.new(name: 'AccessToken')
20
+ ApiKey = Shapes::StringShape.new(name: 'ApiKey')
21
+ AudienceValue = Shapes::StringShape.new(name: 'AudienceValue')
22
+ Audiences = Shapes::ListShape.new(name: 'Audiences')
23
+ AuthorizationUrl = Shapes::StringShape.new(name: 'AuthorizationUrl')
24
+ Boolean = Shapes::BooleanShape.new(name: 'Boolean')
25
+ CompleteOAuthSessionBindingRequest = Shapes::StructureShape.new(name: 'CompleteOAuthSessionBindingRequest')
26
+ CompleteOAuthSessionBindingResponse = Shapes::StructureShape.new(name: 'CompleteOAuthSessionBindingResponse')
27
+ ConflictException = Shapes::StructureShape.new(name: 'ConflictException')
28
+ ConflictExceptionReason = Shapes::StringShape.new(name: 'ConflictExceptionReason')
29
+ CredentialProviderArn = Shapes::StringShape.new(name: 'CredentialProviderArn')
30
+ CustomParameterKey = Shapes::StringShape.new(name: 'CustomParameterKey')
31
+ CustomParameterValue = Shapes::StringShape.new(name: 'CustomParameterValue')
32
+ CustomParameters = Shapes::MapShape.new(name: 'CustomParameters')
33
+ CustomState = Shapes::StringShape.new(name: 'CustomState')
34
+ GetApiKeyRequest = Shapes::StructureShape.new(name: 'GetApiKeyRequest')
35
+ GetApiKeyResponse = Shapes::StructureShape.new(name: 'GetApiKeyResponse')
36
+ GetOAuthTokenRequest = Shapes::StructureShape.new(name: 'GetOAuthTokenRequest')
37
+ GetOAuthTokenResponse = Shapes::StructureShape.new(name: 'GetOAuthTokenResponse')
38
+ GrantType = Shapes::StringShape.new(name: 'GrantType')
39
+ Integer = Shapes::IntegerShape.new(name: 'Integer')
40
+ InternalServerException = Shapes::StructureShape.new(name: 'InternalServerException')
41
+ ResourceNotFoundException = Shapes::StructureShape.new(name: 'ResourceNotFoundException')
42
+ ResourceValue = Shapes::StringShape.new(name: 'ResourceValue')
43
+ Resources = Shapes::ListShape.new(name: 'Resources')
44
+ ScopeValue = Shapes::StringShape.new(name: 'ScopeValue')
45
+ Scopes = Shapes::ListShape.new(name: 'Scopes')
46
+ ServiceQuotaExceededException = Shapes::StructureShape.new(name: 'ServiceQuotaExceededException')
47
+ ServiceUnavailableException = Shapes::StructureShape.new(name: 'ServiceUnavailableException')
48
+ SessionBindingUrl = Shapes::StringShape.new(name: 'SessionBindingUrl')
49
+ SessionStatus = Shapes::StringShape.new(name: 'SessionStatus')
50
+ SessionUri = Shapes::StringShape.new(name: 'SessionUri')
51
+ StartOAuthSessionRequest = Shapes::StructureShape.new(name: 'StartOAuthSessionRequest')
52
+ StartOAuthSessionResponse = Shapes::StructureShape.new(name: 'StartOAuthSessionResponse')
53
+ String = Shapes::StringShape.new(name: 'String')
54
+ ThrottlingException = Shapes::StructureShape.new(name: 'ThrottlingException')
55
+ Timestamp = Shapes::TimestampShape.new(name: 'Timestamp')
56
+ ValidationException = Shapes::StructureShape.new(name: 'ValidationException')
57
+ ValidationExceptionReason = Shapes::StringShape.new(name: 'ValidationExceptionReason')
58
+
59
+ AccessDeniedException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
60
+ AccessDeniedException.add_member(:reason, Shapes::ShapeRef.new(shape: AccessDeniedReason, location_name: "reason"))
61
+ AccessDeniedException.struct_class = Types::AccessDeniedException
62
+
63
+ Audiences.member = Shapes::ShapeRef.new(shape: AudienceValue)
64
+
65
+ CompleteOAuthSessionBindingRequest.add_member(:session_uri, Shapes::ShapeRef.new(shape: SessionUri, required: true, location_name: "sessionUri"))
66
+ CompleteOAuthSessionBindingRequest.struct_class = Types::CompleteOAuthSessionBindingRequest
67
+
68
+ CompleteOAuthSessionBindingResponse.add_member(:session_uri, Shapes::ShapeRef.new(shape: SessionUri, required: true, location_name: "sessionUri"))
69
+ CompleteOAuthSessionBindingResponse.struct_class = Types::CompleteOAuthSessionBindingResponse
70
+
71
+ ConflictException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
72
+ ConflictException.add_member(:resource_id, Shapes::ShapeRef.new(shape: String, location_name: "resourceId"))
73
+ ConflictException.add_member(:resource_type, Shapes::ShapeRef.new(shape: String, location_name: "resourceType"))
74
+ ConflictException.add_member(:reason, Shapes::ShapeRef.new(shape: ConflictExceptionReason, required: true, location_name: "reason"))
75
+ ConflictException.struct_class = Types::ConflictException
76
+
77
+ CustomParameters.key = Shapes::ShapeRef.new(shape: CustomParameterKey)
78
+ CustomParameters.value = Shapes::ShapeRef.new(shape: CustomParameterValue)
79
+
80
+ GetApiKeyRequest.add_member(:credential_provider_arn, Shapes::ShapeRef.new(shape: CredentialProviderArn, required: true, location_name: "credentialProviderArn"))
81
+ GetApiKeyRequest.struct_class = Types::GetApiKeyRequest
82
+
83
+ GetApiKeyResponse.add_member(:api_key, Shapes::ShapeRef.new(shape: ApiKey, required: true, location_name: "apiKey"))
84
+ GetApiKeyResponse.struct_class = Types::GetApiKeyResponse
85
+
86
+ GetOAuthTokenRequest.add_member(:credential_provider_arn, Shapes::ShapeRef.new(shape: CredentialProviderArn, required: true, location_name: "credentialProviderArn"))
87
+ GetOAuthTokenRequest.add_member(:grant_type, Shapes::ShapeRef.new(shape: GrantType, required: true, location_name: "grantType"))
88
+ GetOAuthTokenRequest.add_member(:scopes, Shapes::ShapeRef.new(shape: Scopes, location_name: "scopes"))
89
+ GetOAuthTokenRequest.add_member(:resources, Shapes::ShapeRef.new(shape: Resources, location_name: "resources"))
90
+ GetOAuthTokenRequest.add_member(:audiences, Shapes::ShapeRef.new(shape: Audiences, location_name: "audiences"))
91
+ GetOAuthTokenRequest.add_member(:custom_parameters, Shapes::ShapeRef.new(shape: CustomParameters, location_name: "customParameters"))
92
+ GetOAuthTokenRequest.add_member(:force_authentication, Shapes::ShapeRef.new(shape: Boolean, location_name: "forceAuthentication"))
93
+ GetOAuthTokenRequest.add_member(:session_uri, Shapes::ShapeRef.new(shape: SessionUri, location_name: "sessionUri"))
94
+ GetOAuthTokenRequest.struct_class = Types::GetOAuthTokenRequest
95
+
96
+ GetOAuthTokenResponse.add_member(:access_token, Shapes::ShapeRef.new(shape: AccessToken, location_name: "accessToken"))
97
+ GetOAuthTokenResponse.add_member(:expires_at, Shapes::ShapeRef.new(shape: Timestamp, location_name: "expiresAt"))
98
+ GetOAuthTokenResponse.add_member(:session_status, Shapes::ShapeRef.new(shape: SessionStatus, location_name: "sessionStatus"))
99
+ GetOAuthTokenResponse.struct_class = Types::GetOAuthTokenResponse
100
+
101
+ InternalServerException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
102
+ InternalServerException.add_member(:retry_after_seconds, Shapes::ShapeRef.new(shape: Integer, location: "header", location_name: "Retry-After"))
103
+ InternalServerException.struct_class = Types::InternalServerException
104
+
105
+ ResourceNotFoundException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
106
+ ResourceNotFoundException.add_member(:resource_id, Shapes::ShapeRef.new(shape: String, location_name: "resourceId"))
107
+ ResourceNotFoundException.add_member(:resource_type, Shapes::ShapeRef.new(shape: String, location_name: "resourceType"))
108
+ ResourceNotFoundException.struct_class = Types::ResourceNotFoundException
109
+
110
+ Resources.member = Shapes::ShapeRef.new(shape: ResourceValue)
111
+
112
+ Scopes.member = Shapes::ShapeRef.new(shape: ScopeValue)
113
+
114
+ ServiceQuotaExceededException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
115
+ ServiceQuotaExceededException.add_member(:resource_id, Shapes::ShapeRef.new(shape: String, location_name: "resourceId"))
116
+ ServiceQuotaExceededException.add_member(:resource_type, Shapes::ShapeRef.new(shape: String, location_name: "resourceType"))
117
+ ServiceQuotaExceededException.add_member(:service_code, Shapes::ShapeRef.new(shape: String, location_name: "serviceCode"))
118
+ ServiceQuotaExceededException.add_member(:quota_code, Shapes::ShapeRef.new(shape: String, location_name: "quotaCode"))
119
+ ServiceQuotaExceededException.struct_class = Types::ServiceQuotaExceededException
120
+
121
+ ServiceUnavailableException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
122
+ ServiceUnavailableException.add_member(:retry_after_seconds, Shapes::ShapeRef.new(shape: Integer, location: "header", location_name: "Retry-After"))
123
+ ServiceUnavailableException.struct_class = Types::ServiceUnavailableException
124
+
125
+ StartOAuthSessionRequest.add_member(:credential_provider_arn, Shapes::ShapeRef.new(shape: CredentialProviderArn, required: true, location_name: "credentialProviderArn"))
126
+ StartOAuthSessionRequest.add_member(:scopes, Shapes::ShapeRef.new(shape: Scopes, location_name: "scopes"))
127
+ StartOAuthSessionRequest.add_member(:session_binding_url, Shapes::ShapeRef.new(shape: SessionBindingUrl, required: true, location_name: "sessionBindingUrl"))
128
+ StartOAuthSessionRequest.add_member(:resources, Shapes::ShapeRef.new(shape: Resources, location_name: "resources"))
129
+ StartOAuthSessionRequest.add_member(:audiences, Shapes::ShapeRef.new(shape: Audiences, location_name: "audiences"))
130
+ StartOAuthSessionRequest.add_member(:custom_parameters, Shapes::ShapeRef.new(shape: CustomParameters, location_name: "customParameters"))
131
+ StartOAuthSessionRequest.add_member(:custom_state, Shapes::ShapeRef.new(shape: CustomState, location_name: "customState"))
132
+ StartOAuthSessionRequest.struct_class = Types::StartOAuthSessionRequest
133
+
134
+ StartOAuthSessionResponse.add_member(:authorization_url, Shapes::ShapeRef.new(shape: AuthorizationUrl, location_name: "authorizationUrl"))
135
+ StartOAuthSessionResponse.add_member(:session_uri, Shapes::ShapeRef.new(shape: SessionUri, location_name: "sessionUri"))
136
+ StartOAuthSessionResponse.add_member(:session_status, Shapes::ShapeRef.new(shape: SessionStatus, location_name: "sessionStatus"))
137
+ StartOAuthSessionResponse.add_member(:access_token, Shapes::ShapeRef.new(shape: AccessToken, location_name: "accessToken"))
138
+ StartOAuthSessionResponse.add_member(:expires_at, Shapes::ShapeRef.new(shape: Timestamp, location_name: "expiresAt"))
139
+ StartOAuthSessionResponse.struct_class = Types::StartOAuthSessionResponse
140
+
141
+ ThrottlingException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
142
+ ThrottlingException.add_member(:retry_after_seconds, Shapes::ShapeRef.new(shape: Integer, location: "header", location_name: "Retry-After"))
143
+ ThrottlingException.struct_class = Types::ThrottlingException
144
+
145
+ ValidationException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
146
+ ValidationException.add_member(:reason, Shapes::ShapeRef.new(shape: ValidationExceptionReason, required: true, location_name: "reason"))
147
+ ValidationException.struct_class = Types::ValidationException
148
+
149
+
150
+ # @api private
151
+ API = Seahorse::Model::Api.new.tap do |api|
152
+
153
+ api.version = "2026-07-01"
154
+
155
+ api.metadata = {
156
+ "apiVersion" => "2026-07-01",
157
+ "auth" => ["aws.auth#sigv4"],
158
+ "endpointPrefix" => "credentialbroker",
159
+ "protocol" => "rest-json",
160
+ "protocols" => ["rest-json"],
161
+ "serviceFullName" => "AWS IAM CredentialBroker",
162
+ "serviceId" => "CredentialBroker",
163
+ "signatureVersion" => "v4",
164
+ "signingName" => "credentialbroker",
165
+ "uid" => "credentialbroker-2026-07-01",
166
+ }
167
+
168
+ api.add_operation(:complete_o_auth_session_binding, Seahorse::Model::Operation.new.tap do |o|
169
+ o.name = "CompleteOAuthSessionBinding"
170
+ o.http_method = "POST"
171
+ o.http_request_uri = "/CompleteOAuthSessionBinding"
172
+ o.input = Shapes::ShapeRef.new(shape: CompleteOAuthSessionBindingRequest)
173
+ o.output = Shapes::ShapeRef.new(shape: CompleteOAuthSessionBindingResponse)
174
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
175
+ o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
176
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
177
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
178
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
179
+ o.errors << Shapes::ShapeRef.new(shape: ConflictException)
180
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
181
+ end)
182
+
183
+ api.add_operation(:get_api_key, Seahorse::Model::Operation.new.tap do |o|
184
+ o.name = "GetApiKey"
185
+ o.http_method = "POST"
186
+ o.http_request_uri = "/GetApiKey"
187
+ o.input = Shapes::ShapeRef.new(shape: GetApiKeyRequest)
188
+ o.output = Shapes::ShapeRef.new(shape: GetApiKeyResponse)
189
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
190
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
191
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
192
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
193
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
194
+ end)
195
+
196
+ api.add_operation(:get_o_auth_token, Seahorse::Model::Operation.new.tap do |o|
197
+ o.name = "GetOAuthToken"
198
+ o.http_method = "POST"
199
+ o.http_request_uri = "/oauth2/token"
200
+ o.input = Shapes::ShapeRef.new(shape: GetOAuthTokenRequest)
201
+ o.output = Shapes::ShapeRef.new(shape: GetOAuthTokenResponse)
202
+ o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
203
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
204
+ o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
205
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
206
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
207
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
208
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
209
+ end)
210
+
211
+ api.add_operation(:start_o_auth_session, Seahorse::Model::Operation.new.tap do |o|
212
+ o.name = "StartOAuthSession"
213
+ o.http_method = "POST"
214
+ o.http_request_uri = "/StartOAuthSession"
215
+ o.input = Shapes::ShapeRef.new(shape: StartOAuthSessionRequest)
216
+ o.output = Shapes::ShapeRef.new(shape: StartOAuthSessionResponse)
217
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
218
+ o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
219
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
220
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
221
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
222
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
223
+ end)
224
+ end
225
+
226
+ end
227
+ end
File without changes
@@ -0,0 +1,59 @@
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::CredentialBroker
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute use_fips
14
+ # When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
15
+ #
16
+ # @return [boolean]
17
+ #
18
+ # @!attribute endpoint
19
+ # Override the endpoint used to send this request
20
+ #
21
+ # @return [string]
22
+ #
23
+ # @!attribute region
24
+ # The AWS region used to dispatch the request.
25
+ #
26
+ # @return [string]
27
+ #
28
+ EndpointParameters = Struct.new(
29
+ :use_fips,
30
+ :endpoint,
31
+ :region,
32
+ ) do
33
+ include Aws::Structure
34
+
35
+ # @api private
36
+ class << self
37
+ PARAM_MAP = {
38
+ 'UseFIPS' => :use_fips,
39
+ 'Endpoint' => :endpoint,
40
+ 'Region' => :region,
41
+ }.freeze
42
+ end
43
+
44
+ def initialize(options = {})
45
+ self[:use_fips] = options[:use_fips]
46
+ self[:use_fips] = false if self[:use_fips].nil?
47
+ self[:endpoint] = options[:endpoint]
48
+ self[:region] = options[:region]
49
+ end
50
+
51
+ def self.create(config, options={})
52
+ new({
53
+ use_fips: config.use_fips_endpoint,
54
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
55
+ region: config.region,
56
+ }.merge(options))
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,32 @@
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::CredentialBroker
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
+ return Aws::Endpoints::Endpoint.new(url: parameters.endpoint, headers: {}, properties: {})
18
+ end
19
+ if Aws::Endpoints::Matchers.set?(parameters.region)
20
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
21
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
22
+ return Aws::Endpoints::Endpoint.new(url: "https://credentialbroker-fips.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: "https://credentialbroker.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
25
+ end
26
+ end
27
+ raise ArgumentError, "Invalid Configuration: Missing Region"
28
+ raise ArgumentError, 'No endpoint could be resolved'
29
+
30
+ end
31
+ end
32
+ 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::CredentialBroker
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::CredentialBroker::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,252 @@
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::CredentialBroker
11
+
12
+ # When CredentialBroker returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::CredentialBroker::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all CredentialBroker errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::CredentialBroker::Errors::ServiceError
20
+ # # rescues all CredentialBroker 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
+ # * {AccessDeniedException}
31
+ # * {ConflictException}
32
+ # * {InternalServerException}
33
+ # * {ResourceNotFoundException}
34
+ # * {ServiceQuotaExceededException}
35
+ # * {ServiceUnavailableException}
36
+ # * {ThrottlingException}
37
+ # * {ValidationException}
38
+ #
39
+ # Additionally, error classes are dynamically generated for service errors based on the error code
40
+ # if they are not defined above.
41
+ module Errors
42
+
43
+ extend Aws::Errors::DynamicErrors
44
+
45
+ class AccessDeniedException < ServiceError
46
+
47
+ # @param [Seahorse::Client::RequestContext] context
48
+ # @param [String] message
49
+ # @param [Aws::CredentialBroker::Types::AccessDeniedException] data
50
+ def initialize(context, message, data = Aws::EmptyStructure.new)
51
+ super(context, message, data)
52
+ end
53
+
54
+ # @return [String]
55
+ def message
56
+ @message || @data[:message]
57
+ end
58
+
59
+ # @return [String]
60
+ def reason
61
+ @data[:reason]
62
+ end
63
+ end
64
+
65
+ class ConflictException < ServiceError
66
+
67
+ # @param [Seahorse::Client::RequestContext] context
68
+ # @param [String] message
69
+ # @param [Aws::CredentialBroker::Types::ConflictException] data
70
+ def initialize(context, message, data = Aws::EmptyStructure.new)
71
+ super(context, message, data)
72
+ end
73
+
74
+ # @return [String]
75
+ def message
76
+ @message || @data[:message]
77
+ end
78
+
79
+ # @return [String]
80
+ def resource_id
81
+ @data[:resource_id]
82
+ end
83
+
84
+ # @return [String]
85
+ def resource_type
86
+ @data[:resource_type]
87
+ end
88
+
89
+ # @return [String]
90
+ def reason
91
+ @data[:reason]
92
+ end
93
+ end
94
+
95
+ class InternalServerException < ServiceError
96
+
97
+ # @param [Seahorse::Client::RequestContext] context
98
+ # @param [String] message
99
+ # @param [Aws::CredentialBroker::Types::InternalServerException] data
100
+ def initialize(context, message, data = Aws::EmptyStructure.new)
101
+ super(context, message, data)
102
+ end
103
+
104
+ # @return [String]
105
+ def message
106
+ @message || @data[:message]
107
+ end
108
+
109
+ # @return [String]
110
+ def retry_after_seconds
111
+ @data[:retry_after_seconds]
112
+ end
113
+
114
+ def retryable?
115
+ true
116
+ end
117
+ end
118
+
119
+ class ResourceNotFoundException < ServiceError
120
+
121
+ # @param [Seahorse::Client::RequestContext] context
122
+ # @param [String] message
123
+ # @param [Aws::CredentialBroker::Types::ResourceNotFoundException] data
124
+ def initialize(context, message, data = Aws::EmptyStructure.new)
125
+ super(context, message, data)
126
+ end
127
+
128
+ # @return [String]
129
+ def message
130
+ @message || @data[:message]
131
+ end
132
+
133
+ # @return [String]
134
+ def resource_id
135
+ @data[:resource_id]
136
+ end
137
+
138
+ # @return [String]
139
+ def resource_type
140
+ @data[:resource_type]
141
+ end
142
+ end
143
+
144
+ class ServiceQuotaExceededException < ServiceError
145
+
146
+ # @param [Seahorse::Client::RequestContext] context
147
+ # @param [String] message
148
+ # @param [Aws::CredentialBroker::Types::ServiceQuotaExceededException] data
149
+ def initialize(context, message, data = Aws::EmptyStructure.new)
150
+ super(context, message, data)
151
+ end
152
+
153
+ # @return [String]
154
+ def message
155
+ @message || @data[:message]
156
+ end
157
+
158
+ # @return [String]
159
+ def resource_id
160
+ @data[:resource_id]
161
+ end
162
+
163
+ # @return [String]
164
+ def resource_type
165
+ @data[:resource_type]
166
+ end
167
+
168
+ # @return [String]
169
+ def service_code
170
+ @data[:service_code]
171
+ end
172
+
173
+ # @return [String]
174
+ def quota_code
175
+ @data[:quota_code]
176
+ end
177
+ end
178
+
179
+ class ServiceUnavailableException < ServiceError
180
+
181
+ # @param [Seahorse::Client::RequestContext] context
182
+ # @param [String] message
183
+ # @param [Aws::CredentialBroker::Types::ServiceUnavailableException] data
184
+ def initialize(context, message, data = Aws::EmptyStructure.new)
185
+ super(context, message, data)
186
+ end
187
+
188
+ # @return [String]
189
+ def message
190
+ @message || @data[:message]
191
+ end
192
+
193
+ # @return [String]
194
+ def retry_after_seconds
195
+ @data[:retry_after_seconds]
196
+ end
197
+
198
+ def retryable?
199
+ true
200
+ end
201
+ end
202
+
203
+ class ThrottlingException < ServiceError
204
+
205
+ # @param [Seahorse::Client::RequestContext] context
206
+ # @param [String] message
207
+ # @param [Aws::CredentialBroker::Types::ThrottlingException] data
208
+ def initialize(context, message, data = Aws::EmptyStructure.new)
209
+ super(context, message, data)
210
+ end
211
+
212
+ # @return [String]
213
+ def message
214
+ @message || @data[:message]
215
+ end
216
+
217
+ # @return [String]
218
+ def retry_after_seconds
219
+ @data[:retry_after_seconds]
220
+ end
221
+
222
+ def retryable?
223
+ true
224
+ end
225
+
226
+ def throttling?
227
+ true
228
+ end
229
+ end
230
+
231
+ class ValidationException < ServiceError
232
+
233
+ # @param [Seahorse::Client::RequestContext] context
234
+ # @param [String] message
235
+ # @param [Aws::CredentialBroker::Types::ValidationException] data
236
+ def initialize(context, message, data = Aws::EmptyStructure.new)
237
+ super(context, message, data)
238
+ end
239
+
240
+ # @return [String]
241
+ def message
242
+ @message || @data[:message]
243
+ end
244
+
245
+ # @return [String]
246
+ def reason
247
+ @data[:reason]
248
+ end
249
+ end
250
+
251
+ end
252
+ 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::CredentialBroker
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::CredentialBroker::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::CredentialBroker::EndpointParameters`.
22
+ DOCS
23
+ Aws::CredentialBroker::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::CredentialBroker::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