aws-sdk-machinelearning 1.37.0 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,124 @@
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::MachineLearning
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::MachineLearning::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::MachineLearning::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::MachineLearning::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 :add_tags
60
+ Aws::MachineLearning::Endpoints::AddTags.build(context)
61
+ when :create_batch_prediction
62
+ Aws::MachineLearning::Endpoints::CreateBatchPrediction.build(context)
63
+ when :create_data_source_from_rds
64
+ Aws::MachineLearning::Endpoints::CreateDataSourceFromRDS.build(context)
65
+ when :create_data_source_from_redshift
66
+ Aws::MachineLearning::Endpoints::CreateDataSourceFromRedshift.build(context)
67
+ when :create_data_source_from_s3
68
+ Aws::MachineLearning::Endpoints::CreateDataSourceFromS3.build(context)
69
+ when :create_evaluation
70
+ Aws::MachineLearning::Endpoints::CreateEvaluation.build(context)
71
+ when :create_ml_model
72
+ Aws::MachineLearning::Endpoints::CreateMLModel.build(context)
73
+ when :create_realtime_endpoint
74
+ Aws::MachineLearning::Endpoints::CreateRealtimeEndpoint.build(context)
75
+ when :delete_batch_prediction
76
+ Aws::MachineLearning::Endpoints::DeleteBatchPrediction.build(context)
77
+ when :delete_data_source
78
+ Aws::MachineLearning::Endpoints::DeleteDataSource.build(context)
79
+ when :delete_evaluation
80
+ Aws::MachineLearning::Endpoints::DeleteEvaluation.build(context)
81
+ when :delete_ml_model
82
+ Aws::MachineLearning::Endpoints::DeleteMLModel.build(context)
83
+ when :delete_realtime_endpoint
84
+ Aws::MachineLearning::Endpoints::DeleteRealtimeEndpoint.build(context)
85
+ when :delete_tags
86
+ Aws::MachineLearning::Endpoints::DeleteTags.build(context)
87
+ when :describe_batch_predictions
88
+ Aws::MachineLearning::Endpoints::DescribeBatchPredictions.build(context)
89
+ when :describe_data_sources
90
+ Aws::MachineLearning::Endpoints::DescribeDataSources.build(context)
91
+ when :describe_evaluations
92
+ Aws::MachineLearning::Endpoints::DescribeEvaluations.build(context)
93
+ when :describe_ml_models
94
+ Aws::MachineLearning::Endpoints::DescribeMLModels.build(context)
95
+ when :describe_tags
96
+ Aws::MachineLearning::Endpoints::DescribeTags.build(context)
97
+ when :get_batch_prediction
98
+ Aws::MachineLearning::Endpoints::GetBatchPrediction.build(context)
99
+ when :get_data_source
100
+ Aws::MachineLearning::Endpoints::GetDataSource.build(context)
101
+ when :get_evaluation
102
+ Aws::MachineLearning::Endpoints::GetEvaluation.build(context)
103
+ when :get_ml_model
104
+ Aws::MachineLearning::Endpoints::GetMLModel.build(context)
105
+ when :predict
106
+ Aws::MachineLearning::Endpoints::Predict.build(context)
107
+ when :update_batch_prediction
108
+ Aws::MachineLearning::Endpoints::UpdateBatchPrediction.build(context)
109
+ when :update_data_source
110
+ Aws::MachineLearning::Endpoints::UpdateDataSource.build(context)
111
+ when :update_evaluation
112
+ Aws::MachineLearning::Endpoints::UpdateEvaluation.build(context)
113
+ when :update_ml_model
114
+ Aws::MachineLearning::Endpoints::UpdateMLModel.build(context)
115
+ end
116
+ end
117
+ end
118
+
119
+ def add_handlers(handlers, _config)
120
+ handlers.add(Handler, step: :build, priority: 75)
121
+ end
122
+ end
123
+ end
124
+ end