aws-sdk-redshiftserverless 1.3.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,148 @@
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::RedshiftServerless
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::RedshiftServerless::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::RedshiftServerless::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::RedshiftServerless::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 :convert_recovery_point_to_snapshot
60
+ Aws::RedshiftServerless::Endpoints::ConvertRecoveryPointToSnapshot.build(context)
61
+ when :create_endpoint_access
62
+ Aws::RedshiftServerless::Endpoints::CreateEndpointAccess.build(context)
63
+ when :create_namespace
64
+ Aws::RedshiftServerless::Endpoints::CreateNamespace.build(context)
65
+ when :create_snapshot
66
+ Aws::RedshiftServerless::Endpoints::CreateSnapshot.build(context)
67
+ when :create_usage_limit
68
+ Aws::RedshiftServerless::Endpoints::CreateUsageLimit.build(context)
69
+ when :create_workgroup
70
+ Aws::RedshiftServerless::Endpoints::CreateWorkgroup.build(context)
71
+ when :delete_endpoint_access
72
+ Aws::RedshiftServerless::Endpoints::DeleteEndpointAccess.build(context)
73
+ when :delete_namespace
74
+ Aws::RedshiftServerless::Endpoints::DeleteNamespace.build(context)
75
+ when :delete_resource_policy
76
+ Aws::RedshiftServerless::Endpoints::DeleteResourcePolicy.build(context)
77
+ when :delete_snapshot
78
+ Aws::RedshiftServerless::Endpoints::DeleteSnapshot.build(context)
79
+ when :delete_usage_limit
80
+ Aws::RedshiftServerless::Endpoints::DeleteUsageLimit.build(context)
81
+ when :delete_workgroup
82
+ Aws::RedshiftServerless::Endpoints::DeleteWorkgroup.build(context)
83
+ when :get_credentials
84
+ Aws::RedshiftServerless::Endpoints::GetCredentials.build(context)
85
+ when :get_endpoint_access
86
+ Aws::RedshiftServerless::Endpoints::GetEndpointAccess.build(context)
87
+ when :get_namespace
88
+ Aws::RedshiftServerless::Endpoints::GetNamespace.build(context)
89
+ when :get_recovery_point
90
+ Aws::RedshiftServerless::Endpoints::GetRecoveryPoint.build(context)
91
+ when :get_resource_policy
92
+ Aws::RedshiftServerless::Endpoints::GetResourcePolicy.build(context)
93
+ when :get_snapshot
94
+ Aws::RedshiftServerless::Endpoints::GetSnapshot.build(context)
95
+ when :get_table_restore_status
96
+ Aws::RedshiftServerless::Endpoints::GetTableRestoreStatus.build(context)
97
+ when :get_usage_limit
98
+ Aws::RedshiftServerless::Endpoints::GetUsageLimit.build(context)
99
+ when :get_workgroup
100
+ Aws::RedshiftServerless::Endpoints::GetWorkgroup.build(context)
101
+ when :list_endpoint_access
102
+ Aws::RedshiftServerless::Endpoints::ListEndpointAccess.build(context)
103
+ when :list_namespaces
104
+ Aws::RedshiftServerless::Endpoints::ListNamespaces.build(context)
105
+ when :list_recovery_points
106
+ Aws::RedshiftServerless::Endpoints::ListRecoveryPoints.build(context)
107
+ when :list_snapshots
108
+ Aws::RedshiftServerless::Endpoints::ListSnapshots.build(context)
109
+ when :list_table_restore_status
110
+ Aws::RedshiftServerless::Endpoints::ListTableRestoreStatus.build(context)
111
+ when :list_tags_for_resource
112
+ Aws::RedshiftServerless::Endpoints::ListTagsForResource.build(context)
113
+ when :list_usage_limits
114
+ Aws::RedshiftServerless::Endpoints::ListUsageLimits.build(context)
115
+ when :list_workgroups
116
+ Aws::RedshiftServerless::Endpoints::ListWorkgroups.build(context)
117
+ when :put_resource_policy
118
+ Aws::RedshiftServerless::Endpoints::PutResourcePolicy.build(context)
119
+ when :restore_from_recovery_point
120
+ Aws::RedshiftServerless::Endpoints::RestoreFromRecoveryPoint.build(context)
121
+ when :restore_from_snapshot
122
+ Aws::RedshiftServerless::Endpoints::RestoreFromSnapshot.build(context)
123
+ when :restore_table_from_snapshot
124
+ Aws::RedshiftServerless::Endpoints::RestoreTableFromSnapshot.build(context)
125
+ when :tag_resource
126
+ Aws::RedshiftServerless::Endpoints::TagResource.build(context)
127
+ when :untag_resource
128
+ Aws::RedshiftServerless::Endpoints::UntagResource.build(context)
129
+ when :update_endpoint_access
130
+ Aws::RedshiftServerless::Endpoints::UpdateEndpointAccess.build(context)
131
+ when :update_namespace
132
+ Aws::RedshiftServerless::Endpoints::UpdateNamespace.build(context)
133
+ when :update_snapshot
134
+ Aws::RedshiftServerless::Endpoints::UpdateSnapshot.build(context)
135
+ when :update_usage_limit
136
+ Aws::RedshiftServerless::Endpoints::UpdateUsageLimit.build(context)
137
+ when :update_workgroup
138
+ Aws::RedshiftServerless::Endpoints::UpdateWorkgroup.build(context)
139
+ end
140
+ end
141
+ end
142
+
143
+ def add_handlers(handlers, _config)
144
+ handlers.add(Handler, step: :build, priority: 75)
145
+ end
146
+ end
147
+ end
148
+ end