aws-sdk-iot 1.68.0 → 1.149.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,69 @@
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::IoT
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute region
14
+ # The AWS region used to dispatch the request.
15
+ #
16
+ # @return [String]
17
+ #
18
+ # @!attribute use_dual_stack
19
+ # When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
20
+ #
21
+ # @return [Boolean]
22
+ #
23
+ # @!attribute use_fips
24
+ # 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.
25
+ #
26
+ # @return [Boolean]
27
+ #
28
+ # @!attribute endpoint
29
+ # Override the endpoint used to send this request
30
+ #
31
+ # @return [String]
32
+ #
33
+ EndpointParameters = Struct.new(
34
+ :region,
35
+ :use_dual_stack,
36
+ :use_fips,
37
+ :endpoint,
38
+ ) do
39
+ include Aws::Structure
40
+
41
+ # @api private
42
+ class << self
43
+ PARAM_MAP = {
44
+ 'Region' => :region,
45
+ 'UseDualStack' => :use_dual_stack,
46
+ 'UseFIPS' => :use_fips,
47
+ 'Endpoint' => :endpoint,
48
+ }.freeze
49
+ end
50
+
51
+ def initialize(options = {})
52
+ self[:region] = options[:region]
53
+ self[:use_dual_stack] = options[:use_dual_stack]
54
+ self[:use_dual_stack] = false if self[:use_dual_stack].nil?
55
+ self[:use_fips] = options[:use_fips]
56
+ self[:use_fips] = false if self[:use_fips].nil?
57
+ self[:endpoint] = options[:endpoint]
58
+ end
59
+
60
+ def self.create(config, options={})
61
+ new({
62
+ region: config.region,
63
+ use_dual_stack: config.use_dualstack_endpoint,
64
+ use_fips: config.use_fips_endpoint,
65
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
66
+ }.merge(options))
67
+ end
68
+ end
69
+ end
@@ -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::IoT
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
+ return Aws::Endpoints::Endpoint.new(url: "https://iot-fips.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
27
+ end
28
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
29
+ end
30
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
31
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
32
+ return Aws::Endpoints::Endpoint.new(url: "https://iot-fips.#{parameters.region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
33
+ end
34
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
35
+ end
36
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
37
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
38
+ return Aws::Endpoints::Endpoint.new(url: "https://iot.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
39
+ end
40
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
41
+ end
42
+ if Aws::Endpoints::Matchers.string_equals?("aws", Aws::Endpoints::Matchers.attr(partition_result, "name"))
43
+ return Aws::Endpoints::Endpoint.new(url: "https://iot.#{parameters.region}.amazonaws.com", headers: {}, properties: {})
44
+ end
45
+ if Aws::Endpoints::Matchers.string_equals?("aws-cn", Aws::Endpoints::Matchers.attr(partition_result, "name"))
46
+ return Aws::Endpoints::Endpoint.new(url: "https://iot.#{parameters.region}.amazonaws.com.cn", headers: {}, properties: {})
47
+ end
48
+ if Aws::Endpoints::Matchers.string_equals?("aws-us-gov", Aws::Endpoints::Matchers.attr(partition_result, "name"))
49
+ return Aws::Endpoints::Endpoint.new(url: "https://iot.#{parameters.region}.amazonaws.com", headers: {}, properties: {})
50
+ end
51
+ return Aws::Endpoints::Endpoint.new(url: "https://iot.#{parameters.region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
52
+ end
53
+ end
54
+ raise ArgumentError, "Invalid Configuration: Missing Region"
55
+ raise ArgumentError, 'No endpoint could be resolved'
56
+
57
+ end
58
+ end
59
+ 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::IoT
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::IoT::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -30,11 +30,13 @@ module Aws::IoT
30
30
  # * {CertificateConflictException}
31
31
  # * {CertificateStateException}
32
32
  # * {CertificateValidationException}
33
+ # * {ConflictException}
33
34
  # * {ConflictingResourceUpdateException}
34
35
  # * {DeleteConflictException}
35
36
  # * {IndexNotReadyException}
36
37
  # * {InternalException}
37
38
  # * {InternalFailureException}
39
+ # * {InternalServerException}
38
40
  # * {InvalidAggregationException}
39
41
  # * {InvalidQueryException}
40
42
  # * {InvalidRequestException}
@@ -47,6 +49,7 @@ module Aws::IoT
47
49
  # * {ResourceAlreadyExistsException}
48
50
  # * {ResourceNotFoundException}
49
51
  # * {ResourceRegistrationFailureException}
52
+ # * {ServiceQuotaExceededException}
50
53
  # * {ServiceUnavailableException}
51
54
  # * {SqlParseException}
52
55
  # * {TaskAlreadyExistsException}
@@ -54,6 +57,7 @@ module Aws::IoT
54
57
  # * {TransferAlreadyCompletedException}
55
58
  # * {TransferConflictException}
56
59
  # * {UnauthorizedException}
60
+ # * {ValidationException}
57
61
  # * {VersionConflictException}
58
62
  # * {VersionsLimitExceededException}
59
63
  #
@@ -108,6 +112,26 @@ module Aws::IoT
108
112
  end
109
113
  end
110
114
 
115
+ class ConflictException < ServiceError
116
+
117
+ # @param [Seahorse::Client::RequestContext] context
118
+ # @param [String] message
119
+ # @param [Aws::IoT::Types::ConflictException] data
120
+ def initialize(context, message, data = Aws::EmptyStructure.new)
121
+ super(context, message, data)
122
+ end
123
+
124
+ # @return [String]
125
+ def message
126
+ @message || @data[:message]
127
+ end
128
+
129
+ # @return [String]
130
+ def resource_id
131
+ @data[:resource_id]
132
+ end
133
+ end
134
+
111
135
  class ConflictingResourceUpdateException < ServiceError
112
136
 
113
137
  # @param [Seahorse::Client::RequestContext] context
@@ -183,6 +207,21 @@ module Aws::IoT
183
207
  end
184
208
  end
185
209
 
210
+ class InternalServerException < ServiceError
211
+
212
+ # @param [Seahorse::Client::RequestContext] context
213
+ # @param [String] message
214
+ # @param [Aws::IoT::Types::InternalServerException] data
215
+ def initialize(context, message, data = Aws::EmptyStructure.new)
216
+ super(context, message, data)
217
+ end
218
+
219
+ # @return [String]
220
+ def message
221
+ @message || @data[:message]
222
+ end
223
+ end
224
+
186
225
  class InvalidAggregationException < ServiceError
187
226
 
188
227
  # @param [Seahorse::Client::RequestContext] context
@@ -373,6 +412,21 @@ module Aws::IoT
373
412
  end
374
413
  end
375
414
 
415
+ class ServiceQuotaExceededException < ServiceError
416
+
417
+ # @param [Seahorse::Client::RequestContext] context
418
+ # @param [String] message
419
+ # @param [Aws::IoT::Types::ServiceQuotaExceededException] data
420
+ def initialize(context, message, data = Aws::EmptyStructure.new)
421
+ super(context, message, data)
422
+ end
423
+
424
+ # @return [String]
425
+ def message
426
+ @message || @data[:message]
427
+ end
428
+ end
429
+
376
430
  class ServiceUnavailableException < ServiceError
377
431
 
378
432
  # @param [Seahorse::Client::RequestContext] context
@@ -478,6 +532,21 @@ module Aws::IoT
478
532
  end
479
533
  end
480
534
 
535
+ class ValidationException < ServiceError
536
+
537
+ # @param [Seahorse::Client::RequestContext] context
538
+ # @param [String] message
539
+ # @param [Aws::IoT::Types::ValidationException] data
540
+ def initialize(context, message, data = Aws::EmptyStructure.new)
541
+ super(context, message, data)
542
+ end
543
+
544
+ # @return [String]
545
+ def message
546
+ @message || @data[:message]
547
+ end
548
+ end
549
+
481
550
  class VersionConflictException < ServiceError
482
551
 
483
552
  # @param [Seahorse::Client::RequestContext] context
@@ -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::IoT
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::IoT::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::IoT::EndpointParameters`.
22
+ DOCS
23
+ Aws::IoT::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::IoT::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