aws-sdk-cloudsearch 1.40.0 → 1.42.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,120 @@
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::CloudSearch
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::CloudSearch::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::CloudSearch::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::CloudSearch::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 :build_suggesters
60
+ Aws::CloudSearch::Endpoints::BuildSuggesters.build(context)
61
+ when :create_domain
62
+ Aws::CloudSearch::Endpoints::CreateDomain.build(context)
63
+ when :define_analysis_scheme
64
+ Aws::CloudSearch::Endpoints::DefineAnalysisScheme.build(context)
65
+ when :define_expression
66
+ Aws::CloudSearch::Endpoints::DefineExpression.build(context)
67
+ when :define_index_field
68
+ Aws::CloudSearch::Endpoints::DefineIndexField.build(context)
69
+ when :define_suggester
70
+ Aws::CloudSearch::Endpoints::DefineSuggester.build(context)
71
+ when :delete_analysis_scheme
72
+ Aws::CloudSearch::Endpoints::DeleteAnalysisScheme.build(context)
73
+ when :delete_domain
74
+ Aws::CloudSearch::Endpoints::DeleteDomain.build(context)
75
+ when :delete_expression
76
+ Aws::CloudSearch::Endpoints::DeleteExpression.build(context)
77
+ when :delete_index_field
78
+ Aws::CloudSearch::Endpoints::DeleteIndexField.build(context)
79
+ when :delete_suggester
80
+ Aws::CloudSearch::Endpoints::DeleteSuggester.build(context)
81
+ when :describe_analysis_schemes
82
+ Aws::CloudSearch::Endpoints::DescribeAnalysisSchemes.build(context)
83
+ when :describe_availability_options
84
+ Aws::CloudSearch::Endpoints::DescribeAvailabilityOptions.build(context)
85
+ when :describe_domain_endpoint_options
86
+ Aws::CloudSearch::Endpoints::DescribeDomainEndpointOptions.build(context)
87
+ when :describe_domains
88
+ Aws::CloudSearch::Endpoints::DescribeDomains.build(context)
89
+ when :describe_expressions
90
+ Aws::CloudSearch::Endpoints::DescribeExpressions.build(context)
91
+ when :describe_index_fields
92
+ Aws::CloudSearch::Endpoints::DescribeIndexFields.build(context)
93
+ when :describe_scaling_parameters
94
+ Aws::CloudSearch::Endpoints::DescribeScalingParameters.build(context)
95
+ when :describe_service_access_policies
96
+ Aws::CloudSearch::Endpoints::DescribeServiceAccessPolicies.build(context)
97
+ when :describe_suggesters
98
+ Aws::CloudSearch::Endpoints::DescribeSuggesters.build(context)
99
+ when :index_documents
100
+ Aws::CloudSearch::Endpoints::IndexDocuments.build(context)
101
+ when :list_domain_names
102
+ Aws::CloudSearch::Endpoints::ListDomainNames.build(context)
103
+ when :update_availability_options
104
+ Aws::CloudSearch::Endpoints::UpdateAvailabilityOptions.build(context)
105
+ when :update_domain_endpoint_options
106
+ Aws::CloudSearch::Endpoints::UpdateDomainEndpointOptions.build(context)
107
+ when :update_scaling_parameters
108
+ Aws::CloudSearch::Endpoints::UpdateScalingParameters.build(context)
109
+ when :update_service_access_policies
110
+ Aws::CloudSearch::Endpoints::UpdateServiceAccessPolicies.build(context)
111
+ end
112
+ end
113
+ end
114
+
115
+ def add_handlers(handlers, _config)
116
+ handlers.add(Handler, step: :build, priority: 75)
117
+ end
118
+ end
119
+ end
120
+ end