aws-sdk-wafv2 1.42.0 → 1.44.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,164 @@
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::WAFV2
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::WAFV2::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::WAFV2::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::WAFV2::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 :associate_web_acl
60
+ Aws::WAFV2::Endpoints::AssociateWebACL.build(context)
61
+ when :check_capacity
62
+ Aws::WAFV2::Endpoints::CheckCapacity.build(context)
63
+ when :create_ip_set
64
+ Aws::WAFV2::Endpoints::CreateIPSet.build(context)
65
+ when :create_regex_pattern_set
66
+ Aws::WAFV2::Endpoints::CreateRegexPatternSet.build(context)
67
+ when :create_rule_group
68
+ Aws::WAFV2::Endpoints::CreateRuleGroup.build(context)
69
+ when :create_web_acl
70
+ Aws::WAFV2::Endpoints::CreateWebACL.build(context)
71
+ when :delete_firewall_manager_rule_groups
72
+ Aws::WAFV2::Endpoints::DeleteFirewallManagerRuleGroups.build(context)
73
+ when :delete_ip_set
74
+ Aws::WAFV2::Endpoints::DeleteIPSet.build(context)
75
+ when :delete_logging_configuration
76
+ Aws::WAFV2::Endpoints::DeleteLoggingConfiguration.build(context)
77
+ when :delete_permission_policy
78
+ Aws::WAFV2::Endpoints::DeletePermissionPolicy.build(context)
79
+ when :delete_regex_pattern_set
80
+ Aws::WAFV2::Endpoints::DeleteRegexPatternSet.build(context)
81
+ when :delete_rule_group
82
+ Aws::WAFV2::Endpoints::DeleteRuleGroup.build(context)
83
+ when :delete_web_acl
84
+ Aws::WAFV2::Endpoints::DeleteWebACL.build(context)
85
+ when :describe_managed_rule_group
86
+ Aws::WAFV2::Endpoints::DescribeManagedRuleGroup.build(context)
87
+ when :disassociate_web_acl
88
+ Aws::WAFV2::Endpoints::DisassociateWebACL.build(context)
89
+ when :generate_mobile_sdk_release_url
90
+ Aws::WAFV2::Endpoints::GenerateMobileSdkReleaseUrl.build(context)
91
+ when :get_ip_set
92
+ Aws::WAFV2::Endpoints::GetIPSet.build(context)
93
+ when :get_logging_configuration
94
+ Aws::WAFV2::Endpoints::GetLoggingConfiguration.build(context)
95
+ when :get_managed_rule_set
96
+ Aws::WAFV2::Endpoints::GetManagedRuleSet.build(context)
97
+ when :get_mobile_sdk_release
98
+ Aws::WAFV2::Endpoints::GetMobileSdkRelease.build(context)
99
+ when :get_permission_policy
100
+ Aws::WAFV2::Endpoints::GetPermissionPolicy.build(context)
101
+ when :get_rate_based_statement_managed_keys
102
+ Aws::WAFV2::Endpoints::GetRateBasedStatementManagedKeys.build(context)
103
+ when :get_regex_pattern_set
104
+ Aws::WAFV2::Endpoints::GetRegexPatternSet.build(context)
105
+ when :get_rule_group
106
+ Aws::WAFV2::Endpoints::GetRuleGroup.build(context)
107
+ when :get_sampled_requests
108
+ Aws::WAFV2::Endpoints::GetSampledRequests.build(context)
109
+ when :get_web_acl
110
+ Aws::WAFV2::Endpoints::GetWebACL.build(context)
111
+ when :get_web_acl_for_resource
112
+ Aws::WAFV2::Endpoints::GetWebACLForResource.build(context)
113
+ when :list_available_managed_rule_group_versions
114
+ Aws::WAFV2::Endpoints::ListAvailableManagedRuleGroupVersions.build(context)
115
+ when :list_available_managed_rule_groups
116
+ Aws::WAFV2::Endpoints::ListAvailableManagedRuleGroups.build(context)
117
+ when :list_ip_sets
118
+ Aws::WAFV2::Endpoints::ListIPSets.build(context)
119
+ when :list_logging_configurations
120
+ Aws::WAFV2::Endpoints::ListLoggingConfigurations.build(context)
121
+ when :list_managed_rule_sets
122
+ Aws::WAFV2::Endpoints::ListManagedRuleSets.build(context)
123
+ when :list_mobile_sdk_releases
124
+ Aws::WAFV2::Endpoints::ListMobileSdkReleases.build(context)
125
+ when :list_regex_pattern_sets
126
+ Aws::WAFV2::Endpoints::ListRegexPatternSets.build(context)
127
+ when :list_resources_for_web_acl
128
+ Aws::WAFV2::Endpoints::ListResourcesForWebACL.build(context)
129
+ when :list_rule_groups
130
+ Aws::WAFV2::Endpoints::ListRuleGroups.build(context)
131
+ when :list_tags_for_resource
132
+ Aws::WAFV2::Endpoints::ListTagsForResource.build(context)
133
+ when :list_web_acls
134
+ Aws::WAFV2::Endpoints::ListWebACLs.build(context)
135
+ when :put_logging_configuration
136
+ Aws::WAFV2::Endpoints::PutLoggingConfiguration.build(context)
137
+ when :put_managed_rule_set_versions
138
+ Aws::WAFV2::Endpoints::PutManagedRuleSetVersions.build(context)
139
+ when :put_permission_policy
140
+ Aws::WAFV2::Endpoints::PutPermissionPolicy.build(context)
141
+ when :tag_resource
142
+ Aws::WAFV2::Endpoints::TagResource.build(context)
143
+ when :untag_resource
144
+ Aws::WAFV2::Endpoints::UntagResource.build(context)
145
+ when :update_ip_set
146
+ Aws::WAFV2::Endpoints::UpdateIPSet.build(context)
147
+ when :update_managed_rule_set_version_expiry_date
148
+ Aws::WAFV2::Endpoints::UpdateManagedRuleSetVersionExpiryDate.build(context)
149
+ when :update_regex_pattern_set
150
+ Aws::WAFV2::Endpoints::UpdateRegexPatternSet.build(context)
151
+ when :update_rule_group
152
+ Aws::WAFV2::Endpoints::UpdateRuleGroup.build(context)
153
+ when :update_web_acl
154
+ Aws::WAFV2::Endpoints::UpdateWebACL.build(context)
155
+ end
156
+ end
157
+ end
158
+
159
+ def add_handlers(handlers, _config)
160
+ handlers.add(Handler, step: :build, priority: 75)
161
+ end
162
+ end
163
+ end
164
+ end