aws-sdk-waf 1.47.0 → 1.49.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,222 @@
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::WAF
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::WAF::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::WAF::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::WAF::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_byte_match_set
60
+ Aws::WAF::Endpoints::CreateByteMatchSet.build(context)
61
+ when :create_geo_match_set
62
+ Aws::WAF::Endpoints::CreateGeoMatchSet.build(context)
63
+ when :create_ip_set
64
+ Aws::WAF::Endpoints::CreateIPSet.build(context)
65
+ when :create_rate_based_rule
66
+ Aws::WAF::Endpoints::CreateRateBasedRule.build(context)
67
+ when :create_regex_match_set
68
+ Aws::WAF::Endpoints::CreateRegexMatchSet.build(context)
69
+ when :create_regex_pattern_set
70
+ Aws::WAF::Endpoints::CreateRegexPatternSet.build(context)
71
+ when :create_rule
72
+ Aws::WAF::Endpoints::CreateRule.build(context)
73
+ when :create_rule_group
74
+ Aws::WAF::Endpoints::CreateRuleGroup.build(context)
75
+ when :create_size_constraint_set
76
+ Aws::WAF::Endpoints::CreateSizeConstraintSet.build(context)
77
+ when :create_sql_injection_match_set
78
+ Aws::WAF::Endpoints::CreateSqlInjectionMatchSet.build(context)
79
+ when :create_web_acl
80
+ Aws::WAF::Endpoints::CreateWebACL.build(context)
81
+ when :create_web_acl_migration_stack
82
+ Aws::WAF::Endpoints::CreateWebACLMigrationStack.build(context)
83
+ when :create_xss_match_set
84
+ Aws::WAF::Endpoints::CreateXssMatchSet.build(context)
85
+ when :delete_byte_match_set
86
+ Aws::WAF::Endpoints::DeleteByteMatchSet.build(context)
87
+ when :delete_geo_match_set
88
+ Aws::WAF::Endpoints::DeleteGeoMatchSet.build(context)
89
+ when :delete_ip_set
90
+ Aws::WAF::Endpoints::DeleteIPSet.build(context)
91
+ when :delete_logging_configuration
92
+ Aws::WAF::Endpoints::DeleteLoggingConfiguration.build(context)
93
+ when :delete_permission_policy
94
+ Aws::WAF::Endpoints::DeletePermissionPolicy.build(context)
95
+ when :delete_rate_based_rule
96
+ Aws::WAF::Endpoints::DeleteRateBasedRule.build(context)
97
+ when :delete_regex_match_set
98
+ Aws::WAF::Endpoints::DeleteRegexMatchSet.build(context)
99
+ when :delete_regex_pattern_set
100
+ Aws::WAF::Endpoints::DeleteRegexPatternSet.build(context)
101
+ when :delete_rule
102
+ Aws::WAF::Endpoints::DeleteRule.build(context)
103
+ when :delete_rule_group
104
+ Aws::WAF::Endpoints::DeleteRuleGroup.build(context)
105
+ when :delete_size_constraint_set
106
+ Aws::WAF::Endpoints::DeleteSizeConstraintSet.build(context)
107
+ when :delete_sql_injection_match_set
108
+ Aws::WAF::Endpoints::DeleteSqlInjectionMatchSet.build(context)
109
+ when :delete_web_acl
110
+ Aws::WAF::Endpoints::DeleteWebACL.build(context)
111
+ when :delete_xss_match_set
112
+ Aws::WAF::Endpoints::DeleteXssMatchSet.build(context)
113
+ when :get_byte_match_set
114
+ Aws::WAF::Endpoints::GetByteMatchSet.build(context)
115
+ when :get_change_token
116
+ Aws::WAF::Endpoints::GetChangeToken.build(context)
117
+ when :get_change_token_status
118
+ Aws::WAF::Endpoints::GetChangeTokenStatus.build(context)
119
+ when :get_geo_match_set
120
+ Aws::WAF::Endpoints::GetGeoMatchSet.build(context)
121
+ when :get_ip_set
122
+ Aws::WAF::Endpoints::GetIPSet.build(context)
123
+ when :get_logging_configuration
124
+ Aws::WAF::Endpoints::GetLoggingConfiguration.build(context)
125
+ when :get_permission_policy
126
+ Aws::WAF::Endpoints::GetPermissionPolicy.build(context)
127
+ when :get_rate_based_rule
128
+ Aws::WAF::Endpoints::GetRateBasedRule.build(context)
129
+ when :get_rate_based_rule_managed_keys
130
+ Aws::WAF::Endpoints::GetRateBasedRuleManagedKeys.build(context)
131
+ when :get_regex_match_set
132
+ Aws::WAF::Endpoints::GetRegexMatchSet.build(context)
133
+ when :get_regex_pattern_set
134
+ Aws::WAF::Endpoints::GetRegexPatternSet.build(context)
135
+ when :get_rule
136
+ Aws::WAF::Endpoints::GetRule.build(context)
137
+ when :get_rule_group
138
+ Aws::WAF::Endpoints::GetRuleGroup.build(context)
139
+ when :get_sampled_requests
140
+ Aws::WAF::Endpoints::GetSampledRequests.build(context)
141
+ when :get_size_constraint_set
142
+ Aws::WAF::Endpoints::GetSizeConstraintSet.build(context)
143
+ when :get_sql_injection_match_set
144
+ Aws::WAF::Endpoints::GetSqlInjectionMatchSet.build(context)
145
+ when :get_web_acl
146
+ Aws::WAF::Endpoints::GetWebACL.build(context)
147
+ when :get_xss_match_set
148
+ Aws::WAF::Endpoints::GetXssMatchSet.build(context)
149
+ when :list_activated_rules_in_rule_group
150
+ Aws::WAF::Endpoints::ListActivatedRulesInRuleGroup.build(context)
151
+ when :list_byte_match_sets
152
+ Aws::WAF::Endpoints::ListByteMatchSets.build(context)
153
+ when :list_geo_match_sets
154
+ Aws::WAF::Endpoints::ListGeoMatchSets.build(context)
155
+ when :list_ip_sets
156
+ Aws::WAF::Endpoints::ListIPSets.build(context)
157
+ when :list_logging_configurations
158
+ Aws::WAF::Endpoints::ListLoggingConfigurations.build(context)
159
+ when :list_rate_based_rules
160
+ Aws::WAF::Endpoints::ListRateBasedRules.build(context)
161
+ when :list_regex_match_sets
162
+ Aws::WAF::Endpoints::ListRegexMatchSets.build(context)
163
+ when :list_regex_pattern_sets
164
+ Aws::WAF::Endpoints::ListRegexPatternSets.build(context)
165
+ when :list_rule_groups
166
+ Aws::WAF::Endpoints::ListRuleGroups.build(context)
167
+ when :list_rules
168
+ Aws::WAF::Endpoints::ListRules.build(context)
169
+ when :list_size_constraint_sets
170
+ Aws::WAF::Endpoints::ListSizeConstraintSets.build(context)
171
+ when :list_sql_injection_match_sets
172
+ Aws::WAF::Endpoints::ListSqlInjectionMatchSets.build(context)
173
+ when :list_subscribed_rule_groups
174
+ Aws::WAF::Endpoints::ListSubscribedRuleGroups.build(context)
175
+ when :list_tags_for_resource
176
+ Aws::WAF::Endpoints::ListTagsForResource.build(context)
177
+ when :list_web_acls
178
+ Aws::WAF::Endpoints::ListWebACLs.build(context)
179
+ when :list_xss_match_sets
180
+ Aws::WAF::Endpoints::ListXssMatchSets.build(context)
181
+ when :put_logging_configuration
182
+ Aws::WAF::Endpoints::PutLoggingConfiguration.build(context)
183
+ when :put_permission_policy
184
+ Aws::WAF::Endpoints::PutPermissionPolicy.build(context)
185
+ when :tag_resource
186
+ Aws::WAF::Endpoints::TagResource.build(context)
187
+ when :untag_resource
188
+ Aws::WAF::Endpoints::UntagResource.build(context)
189
+ when :update_byte_match_set
190
+ Aws::WAF::Endpoints::UpdateByteMatchSet.build(context)
191
+ when :update_geo_match_set
192
+ Aws::WAF::Endpoints::UpdateGeoMatchSet.build(context)
193
+ when :update_ip_set
194
+ Aws::WAF::Endpoints::UpdateIPSet.build(context)
195
+ when :update_rate_based_rule
196
+ Aws::WAF::Endpoints::UpdateRateBasedRule.build(context)
197
+ when :update_regex_match_set
198
+ Aws::WAF::Endpoints::UpdateRegexMatchSet.build(context)
199
+ when :update_regex_pattern_set
200
+ Aws::WAF::Endpoints::UpdateRegexPatternSet.build(context)
201
+ when :update_rule
202
+ Aws::WAF::Endpoints::UpdateRule.build(context)
203
+ when :update_rule_group
204
+ Aws::WAF::Endpoints::UpdateRuleGroup.build(context)
205
+ when :update_size_constraint_set
206
+ Aws::WAF::Endpoints::UpdateSizeConstraintSet.build(context)
207
+ when :update_sql_injection_match_set
208
+ Aws::WAF::Endpoints::UpdateSqlInjectionMatchSet.build(context)
209
+ when :update_web_acl
210
+ Aws::WAF::Endpoints::UpdateWebACL.build(context)
211
+ when :update_xss_match_set
212
+ Aws::WAF::Endpoints::UpdateXssMatchSet.build(context)
213
+ end
214
+ end
215
+ end
216
+
217
+ def add_handlers(handlers, _config)
218
+ handlers.add(Handler, step: :build, priority: 75)
219
+ end
220
+ end
221
+ end
222
+ end