aws-sdk-cloudwatchevents 1.57.0 → 1.59.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,170 @@
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::CloudWatchEvents
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::CloudWatchEvents::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::CloudWatchEvents::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::CloudWatchEvents::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_event_source
60
+ Aws::CloudWatchEvents::Endpoints::ActivateEventSource.build(context)
61
+ when :cancel_replay
62
+ Aws::CloudWatchEvents::Endpoints::CancelReplay.build(context)
63
+ when :create_api_destination
64
+ Aws::CloudWatchEvents::Endpoints::CreateApiDestination.build(context)
65
+ when :create_archive
66
+ Aws::CloudWatchEvents::Endpoints::CreateArchive.build(context)
67
+ when :create_connection
68
+ Aws::CloudWatchEvents::Endpoints::CreateConnection.build(context)
69
+ when :create_event_bus
70
+ Aws::CloudWatchEvents::Endpoints::CreateEventBus.build(context)
71
+ when :create_partner_event_source
72
+ Aws::CloudWatchEvents::Endpoints::CreatePartnerEventSource.build(context)
73
+ when :deactivate_event_source
74
+ Aws::CloudWatchEvents::Endpoints::DeactivateEventSource.build(context)
75
+ when :deauthorize_connection
76
+ Aws::CloudWatchEvents::Endpoints::DeauthorizeConnection.build(context)
77
+ when :delete_api_destination
78
+ Aws::CloudWatchEvents::Endpoints::DeleteApiDestination.build(context)
79
+ when :delete_archive
80
+ Aws::CloudWatchEvents::Endpoints::DeleteArchive.build(context)
81
+ when :delete_connection
82
+ Aws::CloudWatchEvents::Endpoints::DeleteConnection.build(context)
83
+ when :delete_event_bus
84
+ Aws::CloudWatchEvents::Endpoints::DeleteEventBus.build(context)
85
+ when :delete_partner_event_source
86
+ Aws::CloudWatchEvents::Endpoints::DeletePartnerEventSource.build(context)
87
+ when :delete_rule
88
+ Aws::CloudWatchEvents::Endpoints::DeleteRule.build(context)
89
+ when :describe_api_destination
90
+ Aws::CloudWatchEvents::Endpoints::DescribeApiDestination.build(context)
91
+ when :describe_archive
92
+ Aws::CloudWatchEvents::Endpoints::DescribeArchive.build(context)
93
+ when :describe_connection
94
+ Aws::CloudWatchEvents::Endpoints::DescribeConnection.build(context)
95
+ when :describe_event_bus
96
+ Aws::CloudWatchEvents::Endpoints::DescribeEventBus.build(context)
97
+ when :describe_event_source
98
+ Aws::CloudWatchEvents::Endpoints::DescribeEventSource.build(context)
99
+ when :describe_partner_event_source
100
+ Aws::CloudWatchEvents::Endpoints::DescribePartnerEventSource.build(context)
101
+ when :describe_replay
102
+ Aws::CloudWatchEvents::Endpoints::DescribeReplay.build(context)
103
+ when :describe_rule
104
+ Aws::CloudWatchEvents::Endpoints::DescribeRule.build(context)
105
+ when :disable_rule
106
+ Aws::CloudWatchEvents::Endpoints::DisableRule.build(context)
107
+ when :enable_rule
108
+ Aws::CloudWatchEvents::Endpoints::EnableRule.build(context)
109
+ when :list_api_destinations
110
+ Aws::CloudWatchEvents::Endpoints::ListApiDestinations.build(context)
111
+ when :list_archives
112
+ Aws::CloudWatchEvents::Endpoints::ListArchives.build(context)
113
+ when :list_connections
114
+ Aws::CloudWatchEvents::Endpoints::ListConnections.build(context)
115
+ when :list_event_buses
116
+ Aws::CloudWatchEvents::Endpoints::ListEventBuses.build(context)
117
+ when :list_event_sources
118
+ Aws::CloudWatchEvents::Endpoints::ListEventSources.build(context)
119
+ when :list_partner_event_source_accounts
120
+ Aws::CloudWatchEvents::Endpoints::ListPartnerEventSourceAccounts.build(context)
121
+ when :list_partner_event_sources
122
+ Aws::CloudWatchEvents::Endpoints::ListPartnerEventSources.build(context)
123
+ when :list_replays
124
+ Aws::CloudWatchEvents::Endpoints::ListReplays.build(context)
125
+ when :list_rule_names_by_target
126
+ Aws::CloudWatchEvents::Endpoints::ListRuleNamesByTarget.build(context)
127
+ when :list_rules
128
+ Aws::CloudWatchEvents::Endpoints::ListRules.build(context)
129
+ when :list_tags_for_resource
130
+ Aws::CloudWatchEvents::Endpoints::ListTagsForResource.build(context)
131
+ when :list_targets_by_rule
132
+ Aws::CloudWatchEvents::Endpoints::ListTargetsByRule.build(context)
133
+ when :put_events
134
+ Aws::CloudWatchEvents::Endpoints::PutEvents.build(context)
135
+ when :put_partner_events
136
+ Aws::CloudWatchEvents::Endpoints::PutPartnerEvents.build(context)
137
+ when :put_permission
138
+ Aws::CloudWatchEvents::Endpoints::PutPermission.build(context)
139
+ when :put_rule
140
+ Aws::CloudWatchEvents::Endpoints::PutRule.build(context)
141
+ when :put_targets
142
+ Aws::CloudWatchEvents::Endpoints::PutTargets.build(context)
143
+ when :remove_permission
144
+ Aws::CloudWatchEvents::Endpoints::RemovePermission.build(context)
145
+ when :remove_targets
146
+ Aws::CloudWatchEvents::Endpoints::RemoveTargets.build(context)
147
+ when :start_replay
148
+ Aws::CloudWatchEvents::Endpoints::StartReplay.build(context)
149
+ when :tag_resource
150
+ Aws::CloudWatchEvents::Endpoints::TagResource.build(context)
151
+ when :test_event_pattern
152
+ Aws::CloudWatchEvents::Endpoints::TestEventPattern.build(context)
153
+ when :untag_resource
154
+ Aws::CloudWatchEvents::Endpoints::UntagResource.build(context)
155
+ when :update_api_destination
156
+ Aws::CloudWatchEvents::Endpoints::UpdateApiDestination.build(context)
157
+ when :update_archive
158
+ Aws::CloudWatchEvents::Endpoints::UpdateArchive.build(context)
159
+ when :update_connection
160
+ Aws::CloudWatchEvents::Endpoints::UpdateConnection.build(context)
161
+ end
162
+ end
163
+ end
164
+
165
+ def add_handlers(handlers, _config)
166
+ handlers.add(Handler, step: :build, priority: 75)
167
+ end
168
+ end
169
+ end
170
+ end