aws-sdk-lookoutmetrics 1.22.0 → 1.24.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,128 @@
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::LookoutMetrics
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::LookoutMetrics::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::LookoutMetrics::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::LookoutMetrics::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 :activate_anomaly_detector
60
+ Aws::LookoutMetrics::Endpoints::ActivateAnomalyDetector.build(context)
61
+ when :back_test_anomaly_detector
62
+ Aws::LookoutMetrics::Endpoints::BackTestAnomalyDetector.build(context)
63
+ when :create_alert
64
+ Aws::LookoutMetrics::Endpoints::CreateAlert.build(context)
65
+ when :create_anomaly_detector
66
+ Aws::LookoutMetrics::Endpoints::CreateAnomalyDetector.build(context)
67
+ when :create_metric_set
68
+ Aws::LookoutMetrics::Endpoints::CreateMetricSet.build(context)
69
+ when :deactivate_anomaly_detector
70
+ Aws::LookoutMetrics::Endpoints::DeactivateAnomalyDetector.build(context)
71
+ when :delete_alert
72
+ Aws::LookoutMetrics::Endpoints::DeleteAlert.build(context)
73
+ when :delete_anomaly_detector
74
+ Aws::LookoutMetrics::Endpoints::DeleteAnomalyDetector.build(context)
75
+ when :describe_alert
76
+ Aws::LookoutMetrics::Endpoints::DescribeAlert.build(context)
77
+ when :describe_anomaly_detection_executions
78
+ Aws::LookoutMetrics::Endpoints::DescribeAnomalyDetectionExecutions.build(context)
79
+ when :describe_anomaly_detector
80
+ Aws::LookoutMetrics::Endpoints::DescribeAnomalyDetector.build(context)
81
+ when :describe_metric_set
82
+ Aws::LookoutMetrics::Endpoints::DescribeMetricSet.build(context)
83
+ when :detect_metric_set_config
84
+ Aws::LookoutMetrics::Endpoints::DetectMetricSetConfig.build(context)
85
+ when :get_anomaly_group
86
+ Aws::LookoutMetrics::Endpoints::GetAnomalyGroup.build(context)
87
+ when :get_data_quality_metrics
88
+ Aws::LookoutMetrics::Endpoints::GetDataQualityMetrics.build(context)
89
+ when :get_feedback
90
+ Aws::LookoutMetrics::Endpoints::GetFeedback.build(context)
91
+ when :get_sample_data
92
+ Aws::LookoutMetrics::Endpoints::GetSampleData.build(context)
93
+ when :list_alerts
94
+ Aws::LookoutMetrics::Endpoints::ListAlerts.build(context)
95
+ when :list_anomaly_detectors
96
+ Aws::LookoutMetrics::Endpoints::ListAnomalyDetectors.build(context)
97
+ when :list_anomaly_group_related_metrics
98
+ Aws::LookoutMetrics::Endpoints::ListAnomalyGroupRelatedMetrics.build(context)
99
+ when :list_anomaly_group_summaries
100
+ Aws::LookoutMetrics::Endpoints::ListAnomalyGroupSummaries.build(context)
101
+ when :list_anomaly_group_time_series
102
+ Aws::LookoutMetrics::Endpoints::ListAnomalyGroupTimeSeries.build(context)
103
+ when :list_metric_sets
104
+ Aws::LookoutMetrics::Endpoints::ListMetricSets.build(context)
105
+ when :list_tags_for_resource
106
+ Aws::LookoutMetrics::Endpoints::ListTagsForResource.build(context)
107
+ when :put_feedback
108
+ Aws::LookoutMetrics::Endpoints::PutFeedback.build(context)
109
+ when :tag_resource
110
+ Aws::LookoutMetrics::Endpoints::TagResource.build(context)
111
+ when :untag_resource
112
+ Aws::LookoutMetrics::Endpoints::UntagResource.build(context)
113
+ when :update_alert
114
+ Aws::LookoutMetrics::Endpoints::UpdateAlert.build(context)
115
+ when :update_anomaly_detector
116
+ Aws::LookoutMetrics::Endpoints::UpdateAnomalyDetector.build(context)
117
+ when :update_metric_set
118
+ Aws::LookoutMetrics::Endpoints::UpdateMetricSet.build(context)
119
+ end
120
+ end
121
+ end
122
+
123
+ def add_handlers(handlers, _config)
124
+ handlers.add(Handler, step: :build, priority: 75)
125
+ end
126
+ end
127
+ end
128
+ end