aws-sdk-kendraranking 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,166 @@
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::KendraRanking
11
+
12
+ # When KendraRanking returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::KendraRanking::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all KendraRanking errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::KendraRanking::Errors::ServiceError
20
+ # # rescues all KendraRanking 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
+ # * {ResourceUnavailableException}
35
+ # * {ServiceQuotaExceededException}
36
+ # * {ThrottlingException}
37
+ # * {ValidationException}
38
+ #
39
+ # Additionally, error classes are dynamically generated for service errors based on the error code
40
+ # if they are not defined above.
41
+ module Errors
42
+
43
+ extend Aws::Errors::DynamicErrors
44
+
45
+ class AccessDeniedException < ServiceError
46
+
47
+ # @param [Seahorse::Client::RequestContext] context
48
+ # @param [String] message
49
+ # @param [Aws::KendraRanking::Types::AccessDeniedException] data
50
+ def initialize(context, message, data = Aws::EmptyStructure.new)
51
+ super(context, message, data)
52
+ end
53
+
54
+ # @return [String]
55
+ def message
56
+ @message || @data[:message]
57
+ end
58
+ end
59
+
60
+ class ConflictException < ServiceError
61
+
62
+ # @param [Seahorse::Client::RequestContext] context
63
+ # @param [String] message
64
+ # @param [Aws::KendraRanking::Types::ConflictException] data
65
+ def initialize(context, message, data = Aws::EmptyStructure.new)
66
+ super(context, message, data)
67
+ end
68
+
69
+ # @return [String]
70
+ def message
71
+ @message || @data[:message]
72
+ end
73
+ end
74
+
75
+ class InternalServerException < ServiceError
76
+
77
+ # @param [Seahorse::Client::RequestContext] context
78
+ # @param [String] message
79
+ # @param [Aws::KendraRanking::Types::InternalServerException] data
80
+ def initialize(context, message, data = Aws::EmptyStructure.new)
81
+ super(context, message, data)
82
+ end
83
+
84
+ # @return [String]
85
+ def message
86
+ @message || @data[:message]
87
+ end
88
+ end
89
+
90
+ class ResourceNotFoundException < ServiceError
91
+
92
+ # @param [Seahorse::Client::RequestContext] context
93
+ # @param [String] message
94
+ # @param [Aws::KendraRanking::Types::ResourceNotFoundException] data
95
+ def initialize(context, message, data = Aws::EmptyStructure.new)
96
+ super(context, message, data)
97
+ end
98
+
99
+ # @return [String]
100
+ def message
101
+ @message || @data[:message]
102
+ end
103
+ end
104
+
105
+ class ResourceUnavailableException < ServiceError
106
+
107
+ # @param [Seahorse::Client::RequestContext] context
108
+ # @param [String] message
109
+ # @param [Aws::KendraRanking::Types::ResourceUnavailableException] data
110
+ def initialize(context, message, data = Aws::EmptyStructure.new)
111
+ super(context, message, data)
112
+ end
113
+
114
+ # @return [String]
115
+ def message
116
+ @message || @data[:message]
117
+ end
118
+ end
119
+
120
+ class ServiceQuotaExceededException < ServiceError
121
+
122
+ # @param [Seahorse::Client::RequestContext] context
123
+ # @param [String] message
124
+ # @param [Aws::KendraRanking::Types::ServiceQuotaExceededException] data
125
+ def initialize(context, message, data = Aws::EmptyStructure.new)
126
+ super(context, message, data)
127
+ end
128
+
129
+ # @return [String]
130
+ def message
131
+ @message || @data[:message]
132
+ end
133
+ end
134
+
135
+ class ThrottlingException < ServiceError
136
+
137
+ # @param [Seahorse::Client::RequestContext] context
138
+ # @param [String] message
139
+ # @param [Aws::KendraRanking::Types::ThrottlingException] data
140
+ def initialize(context, message, data = Aws::EmptyStructure.new)
141
+ super(context, message, data)
142
+ end
143
+
144
+ # @return [String]
145
+ def message
146
+ @message || @data[:message]
147
+ end
148
+ end
149
+
150
+ class ValidationException < ServiceError
151
+
152
+ # @param [Seahorse::Client::RequestContext] context
153
+ # @param [String] message
154
+ # @param [Aws::KendraRanking::Types::ValidationException] data
155
+ def initialize(context, message, data = Aws::EmptyStructure.new)
156
+ super(context, message, data)
157
+ end
158
+
159
+ # @return [String]
160
+ def message
161
+ @message || @data[:message]
162
+ end
163
+ end
164
+
165
+ end
166
+ end
@@ -0,0 +1,86 @@
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::KendraRanking
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::KendraRanking::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::KendraRanking::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::KendraRanking::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 :create_rescore_execution_plan
60
+ Aws::KendraRanking::Endpoints::CreateRescoreExecutionPlan.build(context)
61
+ when :delete_rescore_execution_plan
62
+ Aws::KendraRanking::Endpoints::DeleteRescoreExecutionPlan.build(context)
63
+ when :describe_rescore_execution_plan
64
+ Aws::KendraRanking::Endpoints::DescribeRescoreExecutionPlan.build(context)
65
+ when :list_rescore_execution_plans
66
+ Aws::KendraRanking::Endpoints::ListRescoreExecutionPlans.build(context)
67
+ when :list_tags_for_resource
68
+ Aws::KendraRanking::Endpoints::ListTagsForResource.build(context)
69
+ when :rescore
70
+ Aws::KendraRanking::Endpoints::Rescore.build(context)
71
+ when :tag_resource
72
+ Aws::KendraRanking::Endpoints::TagResource.build(context)
73
+ when :untag_resource
74
+ Aws::KendraRanking::Endpoints::UntagResource.build(context)
75
+ when :update_rescore_execution_plan
76
+ Aws::KendraRanking::Endpoints::UpdateRescoreExecutionPlan.build(context)
77
+ end
78
+ end
79
+ end
80
+
81
+ def add_handlers(handlers, _config)
82
+ handlers.add(Handler, step: :build, priority: 75)
83
+ end
84
+ end
85
+ end
86
+ 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::KendraRanking
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