aws-sdk-iotevents 1.33.0 → 1.35.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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::IoTEvents
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::IoTEvents::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::IoTEvents::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::IoTEvents::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_alarm_model
60
+ Aws::IoTEvents::Endpoints::CreateAlarmModel.build(context)
61
+ when :create_detector_model
62
+ Aws::IoTEvents::Endpoints::CreateDetectorModel.build(context)
63
+ when :create_input
64
+ Aws::IoTEvents::Endpoints::CreateInput.build(context)
65
+ when :delete_alarm_model
66
+ Aws::IoTEvents::Endpoints::DeleteAlarmModel.build(context)
67
+ when :delete_detector_model
68
+ Aws::IoTEvents::Endpoints::DeleteDetectorModel.build(context)
69
+ when :delete_input
70
+ Aws::IoTEvents::Endpoints::DeleteInput.build(context)
71
+ when :describe_alarm_model
72
+ Aws::IoTEvents::Endpoints::DescribeAlarmModel.build(context)
73
+ when :describe_detector_model
74
+ Aws::IoTEvents::Endpoints::DescribeDetectorModel.build(context)
75
+ when :describe_detector_model_analysis
76
+ Aws::IoTEvents::Endpoints::DescribeDetectorModelAnalysis.build(context)
77
+ when :describe_input
78
+ Aws::IoTEvents::Endpoints::DescribeInput.build(context)
79
+ when :describe_logging_options
80
+ Aws::IoTEvents::Endpoints::DescribeLoggingOptions.build(context)
81
+ when :get_detector_model_analysis_results
82
+ Aws::IoTEvents::Endpoints::GetDetectorModelAnalysisResults.build(context)
83
+ when :list_alarm_model_versions
84
+ Aws::IoTEvents::Endpoints::ListAlarmModelVersions.build(context)
85
+ when :list_alarm_models
86
+ Aws::IoTEvents::Endpoints::ListAlarmModels.build(context)
87
+ when :list_detector_model_versions
88
+ Aws::IoTEvents::Endpoints::ListDetectorModelVersions.build(context)
89
+ when :list_detector_models
90
+ Aws::IoTEvents::Endpoints::ListDetectorModels.build(context)
91
+ when :list_input_routings
92
+ Aws::IoTEvents::Endpoints::ListInputRoutings.build(context)
93
+ when :list_inputs
94
+ Aws::IoTEvents::Endpoints::ListInputs.build(context)
95
+ when :list_tags_for_resource
96
+ Aws::IoTEvents::Endpoints::ListTagsForResource.build(context)
97
+ when :put_logging_options
98
+ Aws::IoTEvents::Endpoints::PutLoggingOptions.build(context)
99
+ when :start_detector_model_analysis
100
+ Aws::IoTEvents::Endpoints::StartDetectorModelAnalysis.build(context)
101
+ when :tag_resource
102
+ Aws::IoTEvents::Endpoints::TagResource.build(context)
103
+ when :untag_resource
104
+ Aws::IoTEvents::Endpoints::UntagResource.build(context)
105
+ when :update_alarm_model
106
+ Aws::IoTEvents::Endpoints::UpdateAlarmModel.build(context)
107
+ when :update_detector_model
108
+ Aws::IoTEvents::Endpoints::UpdateDetectorModel.build(context)
109
+ when :update_input
110
+ Aws::IoTEvents::Endpoints::UpdateInput.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