aws-sdk-locationservice 1.13.0 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,184 @@
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::LocationService
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::LocationService::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::LocationService::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::LocationService::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_tracker_consumer
60
+ Aws::LocationService::Endpoints::AssociateTrackerConsumer.build(context)
61
+ when :batch_delete_device_position_history
62
+ Aws::LocationService::Endpoints::BatchDeleteDevicePositionHistory.build(context)
63
+ when :batch_delete_geofence
64
+ Aws::LocationService::Endpoints::BatchDeleteGeofence.build(context)
65
+ when :batch_evaluate_geofences
66
+ Aws::LocationService::Endpoints::BatchEvaluateGeofences.build(context)
67
+ when :batch_get_device_position
68
+ Aws::LocationService::Endpoints::BatchGetDevicePosition.build(context)
69
+ when :batch_put_geofence
70
+ Aws::LocationService::Endpoints::BatchPutGeofence.build(context)
71
+ when :batch_update_device_position
72
+ Aws::LocationService::Endpoints::BatchUpdateDevicePosition.build(context)
73
+ when :calculate_route
74
+ Aws::LocationService::Endpoints::CalculateRoute.build(context)
75
+ when :calculate_route_matrix
76
+ Aws::LocationService::Endpoints::CalculateRouteMatrix.build(context)
77
+ when :create_geofence_collection
78
+ Aws::LocationService::Endpoints::CreateGeofenceCollection.build(context)
79
+ when :create_key
80
+ Aws::LocationService::Endpoints::CreateKey.build(context)
81
+ when :create_map
82
+ Aws::LocationService::Endpoints::CreateMap.build(context)
83
+ when :create_place_index
84
+ Aws::LocationService::Endpoints::CreatePlaceIndex.build(context)
85
+ when :create_route_calculator
86
+ Aws::LocationService::Endpoints::CreateRouteCalculator.build(context)
87
+ when :create_tracker
88
+ Aws::LocationService::Endpoints::CreateTracker.build(context)
89
+ when :delete_geofence_collection
90
+ Aws::LocationService::Endpoints::DeleteGeofenceCollection.build(context)
91
+ when :delete_key
92
+ Aws::LocationService::Endpoints::DeleteKey.build(context)
93
+ when :delete_map
94
+ Aws::LocationService::Endpoints::DeleteMap.build(context)
95
+ when :delete_place_index
96
+ Aws::LocationService::Endpoints::DeletePlaceIndex.build(context)
97
+ when :delete_route_calculator
98
+ Aws::LocationService::Endpoints::DeleteRouteCalculator.build(context)
99
+ when :delete_tracker
100
+ Aws::LocationService::Endpoints::DeleteTracker.build(context)
101
+ when :describe_geofence_collection
102
+ Aws::LocationService::Endpoints::DescribeGeofenceCollection.build(context)
103
+ when :describe_key
104
+ Aws::LocationService::Endpoints::DescribeKey.build(context)
105
+ when :describe_map
106
+ Aws::LocationService::Endpoints::DescribeMap.build(context)
107
+ when :describe_place_index
108
+ Aws::LocationService::Endpoints::DescribePlaceIndex.build(context)
109
+ when :describe_route_calculator
110
+ Aws::LocationService::Endpoints::DescribeRouteCalculator.build(context)
111
+ when :describe_tracker
112
+ Aws::LocationService::Endpoints::DescribeTracker.build(context)
113
+ when :disassociate_tracker_consumer
114
+ Aws::LocationService::Endpoints::DisassociateTrackerConsumer.build(context)
115
+ when :get_device_position
116
+ Aws::LocationService::Endpoints::GetDevicePosition.build(context)
117
+ when :get_device_position_history
118
+ Aws::LocationService::Endpoints::GetDevicePositionHistory.build(context)
119
+ when :get_geofence
120
+ Aws::LocationService::Endpoints::GetGeofence.build(context)
121
+ when :get_map_glyphs
122
+ Aws::LocationService::Endpoints::GetMapGlyphs.build(context)
123
+ when :get_map_sprites
124
+ Aws::LocationService::Endpoints::GetMapSprites.build(context)
125
+ when :get_map_style_descriptor
126
+ Aws::LocationService::Endpoints::GetMapStyleDescriptor.build(context)
127
+ when :get_map_tile
128
+ Aws::LocationService::Endpoints::GetMapTile.build(context)
129
+ when :get_place
130
+ Aws::LocationService::Endpoints::GetPlace.build(context)
131
+ when :list_device_positions
132
+ Aws::LocationService::Endpoints::ListDevicePositions.build(context)
133
+ when :list_geofence_collections
134
+ Aws::LocationService::Endpoints::ListGeofenceCollections.build(context)
135
+ when :list_geofences
136
+ Aws::LocationService::Endpoints::ListGeofences.build(context)
137
+ when :list_keys
138
+ Aws::LocationService::Endpoints::ListKeys.build(context)
139
+ when :list_maps
140
+ Aws::LocationService::Endpoints::ListMaps.build(context)
141
+ when :list_place_indexes
142
+ Aws::LocationService::Endpoints::ListPlaceIndexes.build(context)
143
+ when :list_route_calculators
144
+ Aws::LocationService::Endpoints::ListRouteCalculators.build(context)
145
+ when :list_tags_for_resource
146
+ Aws::LocationService::Endpoints::ListTagsForResource.build(context)
147
+ when :list_tracker_consumers
148
+ Aws::LocationService::Endpoints::ListTrackerConsumers.build(context)
149
+ when :list_trackers
150
+ Aws::LocationService::Endpoints::ListTrackers.build(context)
151
+ when :put_geofence
152
+ Aws::LocationService::Endpoints::PutGeofence.build(context)
153
+ when :search_place_index_for_position
154
+ Aws::LocationService::Endpoints::SearchPlaceIndexForPosition.build(context)
155
+ when :search_place_index_for_suggestions
156
+ Aws::LocationService::Endpoints::SearchPlaceIndexForSuggestions.build(context)
157
+ when :search_place_index_for_text
158
+ Aws::LocationService::Endpoints::SearchPlaceIndexForText.build(context)
159
+ when :tag_resource
160
+ Aws::LocationService::Endpoints::TagResource.build(context)
161
+ when :untag_resource
162
+ Aws::LocationService::Endpoints::UntagResource.build(context)
163
+ when :update_geofence_collection
164
+ Aws::LocationService::Endpoints::UpdateGeofenceCollection.build(context)
165
+ when :update_key
166
+ Aws::LocationService::Endpoints::UpdateKey.build(context)
167
+ when :update_map
168
+ Aws::LocationService::Endpoints::UpdateMap.build(context)
169
+ when :update_place_index
170
+ Aws::LocationService::Endpoints::UpdatePlaceIndex.build(context)
171
+ when :update_route_calculator
172
+ Aws::LocationService::Endpoints::UpdateRouteCalculator.build(context)
173
+ when :update_tracker
174
+ Aws::LocationService::Endpoints::UpdateTracker.build(context)
175
+ end
176
+ end
177
+ end
178
+
179
+ def add_handlers(handlers, _config)
180
+ handlers.add(Handler, step: :build, priority: 75)
181
+ end
182
+ end
183
+ end
184
+ end