aws-sdk-opensearchmemory 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,70 @@
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::OpenSearchMemory
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute region
14
+ # The AWS Region to send the request to.
15
+ #
16
+ # @return [string]
17
+ #
18
+ # @!attribute endpoint
19
+ # An endpoint URL to use instead of the one the rules resolve.
20
+ #
21
+ # @return [string]
22
+ #
23
+ # @!attribute space_id
24
+ # The ID of the space the request targets. When set, the request goes to that space's endpoint.
25
+ #
26
+ # @return [string]
27
+ #
28
+ # @!attribute use_fips
29
+ # When true, send the request to a FIPS endpoint. The service has no FIPS endpoint, so the request fails.
30
+ #
31
+ # @return [boolean]
32
+ #
33
+ EndpointParameters = Struct.new(
34
+ :region,
35
+ :endpoint,
36
+ :space_id,
37
+ :use_fips,
38
+ ) do
39
+ include Aws::Structure
40
+
41
+ # @api private
42
+ class << self
43
+ PARAM_MAP = {
44
+ 'Region' => :region,
45
+ 'Endpoint' => :endpoint,
46
+ 'SpaceId' => :space_id,
47
+ 'UseFIPS' => :use_fips,
48
+ }.freeze
49
+ end
50
+
51
+ def initialize(options = {})
52
+ self[:region] = options[:region]
53
+ if self[:region].nil?
54
+ raise ArgumentError, "Missing required EndpointParameter: :region"
55
+ end
56
+ self[:endpoint] = options[:endpoint]
57
+ self[:space_id] = options[:space_id]
58
+ self[:use_fips] = options[:use_fips]
59
+ self[:use_fips] = false if self[:use_fips].nil?
60
+ end
61
+
62
+ def self.create(config, options={})
63
+ new({
64
+ region: config.region,
65
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
66
+ use_fips: config.use_fips_endpoint,
67
+ }.merge(options))
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,36 @@
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::OpenSearchMemory
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint) && Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
14
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
15
+ end
16
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint)
17
+ return Aws::Endpoints::Endpoint.new(url: "#{parameters.endpoint}")
18
+ end
19
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
20
+ raise ArgumentError, "Invalid Configuration: FIPS is not supported with OpenSearch Memory."
21
+ end
22
+ if Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.valid_host_label?(parameters.region, true))
23
+ raise ArgumentError, "Invalid Configuration: Region must be a valid host label"
24
+ end
25
+ if Aws::Endpoints::Matchers.set?(parameters.space_id) && Aws::Endpoints::Matchers.valid_host_label?(parameters.space_id, false)
26
+ return Aws::Endpoints::Endpoint.new(url: "https://#{parameters.space_id}.osm.#{parameters.region}.on.aws")
27
+ end
28
+ if Aws::Endpoints::Matchers.set?(parameters.space_id)
29
+ raise ArgumentError, "Invalid SpaceId: must be a valid host label"
30
+ end
31
+ return Aws::Endpoints::Endpoint.new(url: "https://osm.#{parameters.region}.api.aws")
32
+ raise ArgumentError, 'No endpoint could be resolved'
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,155 @@
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::OpenSearchMemory
12
+ # @api private
13
+ module Endpoints
14
+
15
+ class BatchGetEvent
16
+ def self.build(context)
17
+ Aws::OpenSearchMemory::EndpointParameters.create(
18
+ context.config,
19
+ space_id: context.params[:space_id],
20
+ )
21
+ end
22
+ end
23
+
24
+ class CreateEvent
25
+ def self.build(context)
26
+ Aws::OpenSearchMemory::EndpointParameters.create(
27
+ context.config,
28
+ space_id: context.params[:space_id],
29
+ )
30
+ end
31
+ end
32
+
33
+ class CreateMemory
34
+ def self.build(context)
35
+ Aws::OpenSearchMemory::EndpointParameters.create(
36
+ context.config,
37
+ space_id: context.params[:space_id],
38
+ )
39
+ end
40
+ end
41
+
42
+ class DeleteEvent
43
+ def self.build(context)
44
+ Aws::OpenSearchMemory::EndpointParameters.create(
45
+ context.config,
46
+ space_id: context.params[:space_id],
47
+ )
48
+ end
49
+ end
50
+
51
+ class DeleteMemory
52
+ def self.build(context)
53
+ Aws::OpenSearchMemory::EndpointParameters.create(
54
+ context.config,
55
+ space_id: context.params[:space_id],
56
+ )
57
+ end
58
+ end
59
+
60
+ class GetEvent
61
+ def self.build(context)
62
+ Aws::OpenSearchMemory::EndpointParameters.create(
63
+ context.config,
64
+ space_id: context.params[:space_id],
65
+ )
66
+ end
67
+ end
68
+
69
+ class GetMemory
70
+ def self.build(context)
71
+ Aws::OpenSearchMemory::EndpointParameters.create(
72
+ context.config,
73
+ space_id: context.params[:space_id],
74
+ )
75
+ end
76
+ end
77
+
78
+ class ListEvents
79
+ def self.build(context)
80
+ Aws::OpenSearchMemory::EndpointParameters.create(
81
+ context.config,
82
+ space_id: context.params[:space_id],
83
+ )
84
+ end
85
+ end
86
+
87
+ class ListMemories
88
+ def self.build(context)
89
+ Aws::OpenSearchMemory::EndpointParameters.create(
90
+ context.config,
91
+ space_id: context.params[:space_id],
92
+ )
93
+ end
94
+ end
95
+
96
+ class SearchEvents
97
+ def self.build(context)
98
+ Aws::OpenSearchMemory::EndpointParameters.create(
99
+ context.config,
100
+ space_id: context.params[:space_id],
101
+ )
102
+ end
103
+ end
104
+
105
+ class SearchMemories
106
+ def self.build(context)
107
+ Aws::OpenSearchMemory::EndpointParameters.create(
108
+ context.config,
109
+ space_id: context.params[:space_id],
110
+ )
111
+ end
112
+ end
113
+
114
+ class UpdateMemory
115
+ def self.build(context)
116
+ Aws::OpenSearchMemory::EndpointParameters.create(
117
+ context.config,
118
+ space_id: context.params[:space_id],
119
+ )
120
+ end
121
+ end
122
+
123
+
124
+ def self.parameters_for_operation(context)
125
+ case context.operation_name
126
+ when :batch_get_event
127
+ BatchGetEvent.build(context)
128
+ when :create_event
129
+ CreateEvent.build(context)
130
+ when :create_memory
131
+ CreateMemory.build(context)
132
+ when :delete_event
133
+ DeleteEvent.build(context)
134
+ when :delete_memory
135
+ DeleteMemory.build(context)
136
+ when :get_event
137
+ GetEvent.build(context)
138
+ when :get_memory
139
+ GetMemory.build(context)
140
+ when :list_events
141
+ ListEvents.build(context)
142
+ when :list_memories
143
+ ListMemories.build(context)
144
+ when :search_events
145
+ SearchEvents.build(context)
146
+ when :search_memories
147
+ SearchMemories.build(context)
148
+ when :update_memory
149
+ UpdateMemory.build(context)
150
+ else
151
+ Aws::OpenSearchMemory::EndpointParameters.create(context.config)
152
+ end
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,207 @@
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::OpenSearchMemory
11
+
12
+ # When OpenSearchMemory returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::OpenSearchMemory::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all OpenSearchMemory errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::OpenSearchMemory::Errors::ServiceError
20
+ # # rescues all OpenSearchMemory 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::OpenSearchMemory::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::OpenSearchMemory::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::OpenSearchMemory::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
+ def retryable?
99
+ true
100
+ end
101
+ end
102
+
103
+ class ResourceNotFoundException < ServiceError
104
+
105
+ # @param [Seahorse::Client::RequestContext] context
106
+ # @param [String] message
107
+ # @param [Aws::OpenSearchMemory::Types::ResourceNotFoundException] data
108
+ def initialize(context, message, data = Aws::EmptyStructure.new)
109
+ super(context, message, data)
110
+ end
111
+
112
+ # @return [String]
113
+ def message
114
+ @message || @data[:message]
115
+ end
116
+
117
+ # @return [String]
118
+ def resource_id
119
+ @data[:resource_id]
120
+ end
121
+
122
+ # @return [String]
123
+ def resource_type
124
+ @data[:resource_type]
125
+ end
126
+ end
127
+
128
+ class ServiceQuotaExceededException < ServiceError
129
+
130
+ # @param [Seahorse::Client::RequestContext] context
131
+ # @param [String] message
132
+ # @param [Aws::OpenSearchMemory::Types::ServiceQuotaExceededException] data
133
+ def initialize(context, message, data = Aws::EmptyStructure.new)
134
+ super(context, message, data)
135
+ end
136
+
137
+ # @return [String]
138
+ def message
139
+ @message || @data[:message]
140
+ end
141
+
142
+ # @return [String]
143
+ def quota_code
144
+ @data[:quota_code]
145
+ end
146
+
147
+ # @return [String]
148
+ def service_code
149
+ @data[:service_code]
150
+ end
151
+ end
152
+
153
+ class ThrottlingException < ServiceError
154
+
155
+ # @param [Seahorse::Client::RequestContext] context
156
+ # @param [String] message
157
+ # @param [Aws::OpenSearchMemory::Types::ThrottlingException] data
158
+ def initialize(context, message, data = Aws::EmptyStructure.new)
159
+ super(context, message, data)
160
+ end
161
+
162
+ # @return [String]
163
+ def message
164
+ @message || @data[:message]
165
+ end
166
+
167
+ # @return [String]
168
+ def retry_after_seconds
169
+ @data[:retry_after_seconds]
170
+ end
171
+
172
+ def retryable?
173
+ true
174
+ end
175
+
176
+ def throttling?
177
+ true
178
+ end
179
+ end
180
+
181
+ class ValidationException < ServiceError
182
+
183
+ # @param [Seahorse::Client::RequestContext] context
184
+ # @param [String] message
185
+ # @param [Aws::OpenSearchMemory::Types::ValidationException] data
186
+ def initialize(context, message, data = Aws::EmptyStructure.new)
187
+ super(context, message, data)
188
+ end
189
+
190
+ # @return [String]
191
+ def message
192
+ @message || @data[:message]
193
+ end
194
+
195
+ # @return [String]
196
+ def reason
197
+ @data[:reason]
198
+ end
199
+
200
+ # @return [String]
201
+ def field_list
202
+ @data[:field_list]
203
+ end
204
+ end
205
+
206
+ end
207
+ 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::OpenSearchMemory
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::OpenSearchMemory::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::OpenSearchMemory::EndpointParameters`.
22
+ DOCS
23
+ Aws::OpenSearchMemory::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::OpenSearchMemory::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::OpenSearchMemory
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