aws-sdk-workspacesinstances 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.
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::WorkspacesInstances
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::WorkspacesInstances
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://workspaces-instances-fips.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: "https://workspaces-instances.#{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::WorkspacesInstances
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::WorkspacesInstances::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,232 @@
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::WorkspacesInstances
11
+
12
+ # When WorkspacesInstances returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::WorkspacesInstances::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all WorkspacesInstances errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::WorkspacesInstances::Errors::ServiceError
20
+ # # rescues all WorkspacesInstances 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
+ # * {ThrottlingException}
36
+ # * {ValidationException}
37
+ #
38
+ # Additionally, error classes are dynamically generated for service errors based on the error code
39
+ # if they are not defined above.
40
+ module Errors
41
+
42
+ extend Aws::Errors::DynamicErrors
43
+
44
+ class AccessDeniedException < ServiceError
45
+
46
+ # @param [Seahorse::Client::RequestContext] context
47
+ # @param [String] message
48
+ # @param [Aws::WorkspacesInstances::Types::AccessDeniedException] data
49
+ def initialize(context, message, data = Aws::EmptyStructure.new)
50
+ super(context, message, data)
51
+ end
52
+
53
+ # @return [String]
54
+ def message
55
+ @message || @data[:message]
56
+ end
57
+ end
58
+
59
+ class ConflictException < ServiceError
60
+
61
+ # @param [Seahorse::Client::RequestContext] context
62
+ # @param [String] message
63
+ # @param [Aws::WorkspacesInstances::Types::ConflictException] data
64
+ def initialize(context, message, data = Aws::EmptyStructure.new)
65
+ super(context, message, data)
66
+ end
67
+
68
+ # @return [String]
69
+ def message
70
+ @message || @data[:message]
71
+ end
72
+
73
+ # @return [String]
74
+ def resource_id
75
+ @data[:resource_id]
76
+ end
77
+
78
+ # @return [String]
79
+ def resource_type
80
+ @data[:resource_type]
81
+ end
82
+ end
83
+
84
+ class InternalServerException < ServiceError
85
+
86
+ # @param [Seahorse::Client::RequestContext] context
87
+ # @param [String] message
88
+ # @param [Aws::WorkspacesInstances::Types::InternalServerException] data
89
+ def initialize(context, message, data = Aws::EmptyStructure.new)
90
+ super(context, message, data)
91
+ end
92
+
93
+ # @return [String]
94
+ def message
95
+ @message || @data[:message]
96
+ end
97
+
98
+ # @return [String]
99
+ def retry_after_seconds
100
+ @data[:retry_after_seconds]
101
+ end
102
+
103
+ def retryable?
104
+ true
105
+ end
106
+ end
107
+
108
+ class ResourceNotFoundException < ServiceError
109
+
110
+ # @param [Seahorse::Client::RequestContext] context
111
+ # @param [String] message
112
+ # @param [Aws::WorkspacesInstances::Types::ResourceNotFoundException] data
113
+ def initialize(context, message, data = Aws::EmptyStructure.new)
114
+ super(context, message, data)
115
+ end
116
+
117
+ # @return [String]
118
+ def message
119
+ @message || @data[:message]
120
+ end
121
+
122
+ # @return [String]
123
+ def resource_id
124
+ @data[:resource_id]
125
+ end
126
+
127
+ # @return [String]
128
+ def resource_type
129
+ @data[:resource_type]
130
+ end
131
+ end
132
+
133
+ class ServiceQuotaExceededException < ServiceError
134
+
135
+ # @param [Seahorse::Client::RequestContext] context
136
+ # @param [String] message
137
+ # @param [Aws::WorkspacesInstances::Types::ServiceQuotaExceededException] data
138
+ def initialize(context, message, data = Aws::EmptyStructure.new)
139
+ super(context, message, data)
140
+ end
141
+
142
+ # @return [String]
143
+ def message
144
+ @message || @data[:message]
145
+ end
146
+
147
+ # @return [String]
148
+ def resource_id
149
+ @data[:resource_id]
150
+ end
151
+
152
+ # @return [String]
153
+ def resource_type
154
+ @data[:resource_type]
155
+ end
156
+
157
+ # @return [String]
158
+ def service_code
159
+ @data[:service_code]
160
+ end
161
+
162
+ # @return [String]
163
+ def quota_code
164
+ @data[:quota_code]
165
+ end
166
+ end
167
+
168
+ class ThrottlingException < ServiceError
169
+
170
+ # @param [Seahorse::Client::RequestContext] context
171
+ # @param [String] message
172
+ # @param [Aws::WorkspacesInstances::Types::ThrottlingException] data
173
+ def initialize(context, message, data = Aws::EmptyStructure.new)
174
+ super(context, message, data)
175
+ end
176
+
177
+ # @return [String]
178
+ def message
179
+ @message || @data[:message]
180
+ end
181
+
182
+ # @return [String]
183
+ def service_code
184
+ @data[:service_code]
185
+ end
186
+
187
+ # @return [String]
188
+ def quota_code
189
+ @data[:quota_code]
190
+ end
191
+
192
+ # @return [String]
193
+ def retry_after_seconds
194
+ @data[:retry_after_seconds]
195
+ end
196
+
197
+ def retryable?
198
+ true
199
+ end
200
+
201
+ def throttling?
202
+ true
203
+ end
204
+ end
205
+
206
+ class ValidationException < ServiceError
207
+
208
+ # @param [Seahorse::Client::RequestContext] context
209
+ # @param [String] message
210
+ # @param [Aws::WorkspacesInstances::Types::ValidationException] data
211
+ def initialize(context, message, data = Aws::EmptyStructure.new)
212
+ super(context, message, data)
213
+ end
214
+
215
+ # @return [String]
216
+ def message
217
+ @message || @data[:message]
218
+ end
219
+
220
+ # @return [String]
221
+ def reason
222
+ @data[:reason]
223
+ end
224
+
225
+ # @return [String]
226
+ def field_list
227
+ @data[:field_list]
228
+ end
229
+ end
230
+
231
+ end
232
+ 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::WorkspacesInstances
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::WorkspacesInstances::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::WorkspacesInstances::EndpointParameters`.
22
+ DOCS
23
+ Aws::WorkspacesInstances::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::WorkspacesInstances::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
@@ -0,0 +1,26 @@
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::WorkspacesInstances
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end