aws-sdk-opensearchserverless 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,102 @@
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::OpenSearchServerless
11
+
12
+ # When OpenSearchServerless returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::OpenSearchServerless::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all OpenSearchServerless errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::OpenSearchServerless::Errors::ServiceError
20
+ # # rescues all OpenSearchServerless 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
+ # * {ConflictException}
31
+ # * {InternalServerException}
32
+ # * {ResourceNotFoundException}
33
+ # * {ValidationException}
34
+ #
35
+ # Additionally, error classes are dynamically generated for service errors based on the error code
36
+ # if they are not defined above.
37
+ module Errors
38
+
39
+ extend Aws::Errors::DynamicErrors
40
+
41
+ class ConflictException < ServiceError
42
+
43
+ # @param [Seahorse::Client::RequestContext] context
44
+ # @param [String] message
45
+ # @param [Aws::OpenSearchServerless::Types::ConflictException] data
46
+ def initialize(context, message, data = Aws::EmptyStructure.new)
47
+ super(context, message, data)
48
+ end
49
+
50
+ # @return [String]
51
+ def message
52
+ @message || @data[:message]
53
+ end
54
+ end
55
+
56
+ class InternalServerException < ServiceError
57
+
58
+ # @param [Seahorse::Client::RequestContext] context
59
+ # @param [String] message
60
+ # @param [Aws::OpenSearchServerless::Types::InternalServerException] data
61
+ def initialize(context, message, data = Aws::EmptyStructure.new)
62
+ super(context, message, data)
63
+ end
64
+
65
+ # @return [String]
66
+ def message
67
+ @message || @data[:message]
68
+ end
69
+ end
70
+
71
+ class ResourceNotFoundException < ServiceError
72
+
73
+ # @param [Seahorse::Client::RequestContext] context
74
+ # @param [String] message
75
+ # @param [Aws::OpenSearchServerless::Types::ResourceNotFoundException] data
76
+ def initialize(context, message, data = Aws::EmptyStructure.new)
77
+ super(context, message, data)
78
+ end
79
+
80
+ # @return [String]
81
+ def message
82
+ @message || @data[:message]
83
+ end
84
+ end
85
+
86
+ class ValidationException < ServiceError
87
+
88
+ # @param [Seahorse::Client::RequestContext] context
89
+ # @param [String] message
90
+ # @param [Aws::OpenSearchServerless::Types::ValidationException] 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
+ end
100
+
101
+ end
102
+ end
@@ -0,0 +1,130 @@
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::OpenSearchServerless
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::OpenSearchServerless::EndpointProvider',
17
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
+ 'object that responds to `#resolve_endpoint(parameters)` '\
19
+ 'where `parameters` is a Struct similar to '\
20
+ '`Aws::OpenSearchServerless::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::OpenSearchServerless::EndpointProvider.new
23
+ end
24
+
25
+ # @api private
26
+ class Handler < Seahorse::Client::Handler
27
+ def call(context)
28
+ # If endpoint was discovered, do not resolve or apply the endpoint.
29
+ unless context[:discovered_endpoint]
30
+ params = 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
+ end
36
+
37
+ context[:endpoint_params] = params
38
+ context[:auth_scheme] =
39
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
+
41
+ @handler.call(context)
42
+ end
43
+
44
+ private
45
+
46
+ def apply_endpoint_headers(context, headers)
47
+ headers.each do |key, values|
48
+ value = values
49
+ .compact
50
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
51
+ .join(',')
52
+
53
+ context.http_request.headers[key] = value
54
+ end
55
+ end
56
+
57
+ def parameters_for_operation(context)
58
+ case context.operation_name
59
+ when :batch_get_collection
60
+ Aws::OpenSearchServerless::Endpoints::BatchGetCollection.build(context)
61
+ when :batch_get_vpc_endpoint
62
+ Aws::OpenSearchServerless::Endpoints::BatchGetVpcEndpoint.build(context)
63
+ when :create_access_policy
64
+ Aws::OpenSearchServerless::Endpoints::CreateAccessPolicy.build(context)
65
+ when :create_collection
66
+ Aws::OpenSearchServerless::Endpoints::CreateCollection.build(context)
67
+ when :create_security_config
68
+ Aws::OpenSearchServerless::Endpoints::CreateSecurityConfig.build(context)
69
+ when :create_security_policy
70
+ Aws::OpenSearchServerless::Endpoints::CreateSecurityPolicy.build(context)
71
+ when :create_vpc_endpoint
72
+ Aws::OpenSearchServerless::Endpoints::CreateVpcEndpoint.build(context)
73
+ when :delete_access_policy
74
+ Aws::OpenSearchServerless::Endpoints::DeleteAccessPolicy.build(context)
75
+ when :delete_collection
76
+ Aws::OpenSearchServerless::Endpoints::DeleteCollection.build(context)
77
+ when :delete_security_config
78
+ Aws::OpenSearchServerless::Endpoints::DeleteSecurityConfig.build(context)
79
+ when :delete_security_policy
80
+ Aws::OpenSearchServerless::Endpoints::DeleteSecurityPolicy.build(context)
81
+ when :delete_vpc_endpoint
82
+ Aws::OpenSearchServerless::Endpoints::DeleteVpcEndpoint.build(context)
83
+ when :get_access_policy
84
+ Aws::OpenSearchServerless::Endpoints::GetAccessPolicy.build(context)
85
+ when :get_account_settings
86
+ Aws::OpenSearchServerless::Endpoints::GetAccountSettings.build(context)
87
+ when :get_policies_stats
88
+ Aws::OpenSearchServerless::Endpoints::GetPoliciesStats.build(context)
89
+ when :get_security_config
90
+ Aws::OpenSearchServerless::Endpoints::GetSecurityConfig.build(context)
91
+ when :get_security_policy
92
+ Aws::OpenSearchServerless::Endpoints::GetSecurityPolicy.build(context)
93
+ when :list_access_policies
94
+ Aws::OpenSearchServerless::Endpoints::ListAccessPolicies.build(context)
95
+ when :list_collections
96
+ Aws::OpenSearchServerless::Endpoints::ListCollections.build(context)
97
+ when :list_security_configs
98
+ Aws::OpenSearchServerless::Endpoints::ListSecurityConfigs.build(context)
99
+ when :list_security_policies
100
+ Aws::OpenSearchServerless::Endpoints::ListSecurityPolicies.build(context)
101
+ when :list_tags_for_resource
102
+ Aws::OpenSearchServerless::Endpoints::ListTagsForResource.build(context)
103
+ when :list_vpc_endpoints
104
+ Aws::OpenSearchServerless::Endpoints::ListVpcEndpoints.build(context)
105
+ when :tag_resource
106
+ Aws::OpenSearchServerless::Endpoints::TagResource.build(context)
107
+ when :untag_resource
108
+ Aws::OpenSearchServerless::Endpoints::UntagResource.build(context)
109
+ when :update_access_policy
110
+ Aws::OpenSearchServerless::Endpoints::UpdateAccessPolicy.build(context)
111
+ when :update_account_settings
112
+ Aws::OpenSearchServerless::Endpoints::UpdateAccountSettings.build(context)
113
+ when :update_collection
114
+ Aws::OpenSearchServerless::Endpoints::UpdateCollection.build(context)
115
+ when :update_security_config
116
+ Aws::OpenSearchServerless::Endpoints::UpdateSecurityConfig.build(context)
117
+ when :update_security_policy
118
+ Aws::OpenSearchServerless::Endpoints::UpdateSecurityPolicy.build(context)
119
+ when :update_vpc_endpoint
120
+ Aws::OpenSearchServerless::Endpoints::UpdateVpcEndpoint.build(context)
121
+ end
122
+ end
123
+ end
124
+
125
+ def add_handlers(handlers, _config)
126
+ handlers.add(Handler, step: :build, priority: 75)
127
+ end
128
+ end
129
+ end
130
+ 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::OpenSearchServerless
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