aws-sdk-globalaccelerator 1.41.0 → 1.43.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,166 @@
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::GlobalAccelerator
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::GlobalAccelerator::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::GlobalAccelerator::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::GlobalAccelerator::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 :add_custom_routing_endpoints
60
+ Aws::GlobalAccelerator::Endpoints::AddCustomRoutingEndpoints.build(context)
61
+ when :add_endpoints
62
+ Aws::GlobalAccelerator::Endpoints::AddEndpoints.build(context)
63
+ when :advertise_byoip_cidr
64
+ Aws::GlobalAccelerator::Endpoints::AdvertiseByoipCidr.build(context)
65
+ when :allow_custom_routing_traffic
66
+ Aws::GlobalAccelerator::Endpoints::AllowCustomRoutingTraffic.build(context)
67
+ when :create_accelerator
68
+ Aws::GlobalAccelerator::Endpoints::CreateAccelerator.build(context)
69
+ when :create_custom_routing_accelerator
70
+ Aws::GlobalAccelerator::Endpoints::CreateCustomRoutingAccelerator.build(context)
71
+ when :create_custom_routing_endpoint_group
72
+ Aws::GlobalAccelerator::Endpoints::CreateCustomRoutingEndpointGroup.build(context)
73
+ when :create_custom_routing_listener
74
+ Aws::GlobalAccelerator::Endpoints::CreateCustomRoutingListener.build(context)
75
+ when :create_endpoint_group
76
+ Aws::GlobalAccelerator::Endpoints::CreateEndpointGroup.build(context)
77
+ when :create_listener
78
+ Aws::GlobalAccelerator::Endpoints::CreateListener.build(context)
79
+ when :delete_accelerator
80
+ Aws::GlobalAccelerator::Endpoints::DeleteAccelerator.build(context)
81
+ when :delete_custom_routing_accelerator
82
+ Aws::GlobalAccelerator::Endpoints::DeleteCustomRoutingAccelerator.build(context)
83
+ when :delete_custom_routing_endpoint_group
84
+ Aws::GlobalAccelerator::Endpoints::DeleteCustomRoutingEndpointGroup.build(context)
85
+ when :delete_custom_routing_listener
86
+ Aws::GlobalAccelerator::Endpoints::DeleteCustomRoutingListener.build(context)
87
+ when :delete_endpoint_group
88
+ Aws::GlobalAccelerator::Endpoints::DeleteEndpointGroup.build(context)
89
+ when :delete_listener
90
+ Aws::GlobalAccelerator::Endpoints::DeleteListener.build(context)
91
+ when :deny_custom_routing_traffic
92
+ Aws::GlobalAccelerator::Endpoints::DenyCustomRoutingTraffic.build(context)
93
+ when :deprovision_byoip_cidr
94
+ Aws::GlobalAccelerator::Endpoints::DeprovisionByoipCidr.build(context)
95
+ when :describe_accelerator
96
+ Aws::GlobalAccelerator::Endpoints::DescribeAccelerator.build(context)
97
+ when :describe_accelerator_attributes
98
+ Aws::GlobalAccelerator::Endpoints::DescribeAcceleratorAttributes.build(context)
99
+ when :describe_custom_routing_accelerator
100
+ Aws::GlobalAccelerator::Endpoints::DescribeCustomRoutingAccelerator.build(context)
101
+ when :describe_custom_routing_accelerator_attributes
102
+ Aws::GlobalAccelerator::Endpoints::DescribeCustomRoutingAcceleratorAttributes.build(context)
103
+ when :describe_custom_routing_endpoint_group
104
+ Aws::GlobalAccelerator::Endpoints::DescribeCustomRoutingEndpointGroup.build(context)
105
+ when :describe_custom_routing_listener
106
+ Aws::GlobalAccelerator::Endpoints::DescribeCustomRoutingListener.build(context)
107
+ when :describe_endpoint_group
108
+ Aws::GlobalAccelerator::Endpoints::DescribeEndpointGroup.build(context)
109
+ when :describe_listener
110
+ Aws::GlobalAccelerator::Endpoints::DescribeListener.build(context)
111
+ when :list_accelerators
112
+ Aws::GlobalAccelerator::Endpoints::ListAccelerators.build(context)
113
+ when :list_byoip_cidrs
114
+ Aws::GlobalAccelerator::Endpoints::ListByoipCidrs.build(context)
115
+ when :list_custom_routing_accelerators
116
+ Aws::GlobalAccelerator::Endpoints::ListCustomRoutingAccelerators.build(context)
117
+ when :list_custom_routing_endpoint_groups
118
+ Aws::GlobalAccelerator::Endpoints::ListCustomRoutingEndpointGroups.build(context)
119
+ when :list_custom_routing_listeners
120
+ Aws::GlobalAccelerator::Endpoints::ListCustomRoutingListeners.build(context)
121
+ when :list_custom_routing_port_mappings
122
+ Aws::GlobalAccelerator::Endpoints::ListCustomRoutingPortMappings.build(context)
123
+ when :list_custom_routing_port_mappings_by_destination
124
+ Aws::GlobalAccelerator::Endpoints::ListCustomRoutingPortMappingsByDestination.build(context)
125
+ when :list_endpoint_groups
126
+ Aws::GlobalAccelerator::Endpoints::ListEndpointGroups.build(context)
127
+ when :list_listeners
128
+ Aws::GlobalAccelerator::Endpoints::ListListeners.build(context)
129
+ when :list_tags_for_resource
130
+ Aws::GlobalAccelerator::Endpoints::ListTagsForResource.build(context)
131
+ when :provision_byoip_cidr
132
+ Aws::GlobalAccelerator::Endpoints::ProvisionByoipCidr.build(context)
133
+ when :remove_custom_routing_endpoints
134
+ Aws::GlobalAccelerator::Endpoints::RemoveCustomRoutingEndpoints.build(context)
135
+ when :remove_endpoints
136
+ Aws::GlobalAccelerator::Endpoints::RemoveEndpoints.build(context)
137
+ when :tag_resource
138
+ Aws::GlobalAccelerator::Endpoints::TagResource.build(context)
139
+ when :untag_resource
140
+ Aws::GlobalAccelerator::Endpoints::UntagResource.build(context)
141
+ when :update_accelerator
142
+ Aws::GlobalAccelerator::Endpoints::UpdateAccelerator.build(context)
143
+ when :update_accelerator_attributes
144
+ Aws::GlobalAccelerator::Endpoints::UpdateAcceleratorAttributes.build(context)
145
+ when :update_custom_routing_accelerator
146
+ Aws::GlobalAccelerator::Endpoints::UpdateCustomRoutingAccelerator.build(context)
147
+ when :update_custom_routing_accelerator_attributes
148
+ Aws::GlobalAccelerator::Endpoints::UpdateCustomRoutingAcceleratorAttributes.build(context)
149
+ when :update_custom_routing_listener
150
+ Aws::GlobalAccelerator::Endpoints::UpdateCustomRoutingListener.build(context)
151
+ when :update_endpoint_group
152
+ Aws::GlobalAccelerator::Endpoints::UpdateEndpointGroup.build(context)
153
+ when :update_listener
154
+ Aws::GlobalAccelerator::Endpoints::UpdateListener.build(context)
155
+ when :withdraw_byoip_cidr
156
+ Aws::GlobalAccelerator::Endpoints::WithdrawByoipCidr.build(context)
157
+ end
158
+ end
159
+ end
160
+
161
+ def add_handlers(handlers, _config)
162
+ handlers.add(Handler, step: :build, priority: 75)
163
+ end
164
+ end
165
+ end
166
+ end