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