aws-sdk-backup 1.45.0 → 1.47.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,212 @@
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::Backup
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::Backup::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::Backup::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::Backup::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 :cancel_legal_hold
60
+ Aws::Backup::Endpoints::CancelLegalHold.build(context)
61
+ when :create_backup_plan
62
+ Aws::Backup::Endpoints::CreateBackupPlan.build(context)
63
+ when :create_backup_selection
64
+ Aws::Backup::Endpoints::CreateBackupSelection.build(context)
65
+ when :create_backup_vault
66
+ Aws::Backup::Endpoints::CreateBackupVault.build(context)
67
+ when :create_framework
68
+ Aws::Backup::Endpoints::CreateFramework.build(context)
69
+ when :create_legal_hold
70
+ Aws::Backup::Endpoints::CreateLegalHold.build(context)
71
+ when :create_report_plan
72
+ Aws::Backup::Endpoints::CreateReportPlan.build(context)
73
+ when :delete_backup_plan
74
+ Aws::Backup::Endpoints::DeleteBackupPlan.build(context)
75
+ when :delete_backup_selection
76
+ Aws::Backup::Endpoints::DeleteBackupSelection.build(context)
77
+ when :delete_backup_vault
78
+ Aws::Backup::Endpoints::DeleteBackupVault.build(context)
79
+ when :delete_backup_vault_access_policy
80
+ Aws::Backup::Endpoints::DeleteBackupVaultAccessPolicy.build(context)
81
+ when :delete_backup_vault_lock_configuration
82
+ Aws::Backup::Endpoints::DeleteBackupVaultLockConfiguration.build(context)
83
+ when :delete_backup_vault_notifications
84
+ Aws::Backup::Endpoints::DeleteBackupVaultNotifications.build(context)
85
+ when :delete_framework
86
+ Aws::Backup::Endpoints::DeleteFramework.build(context)
87
+ when :delete_recovery_point
88
+ Aws::Backup::Endpoints::DeleteRecoveryPoint.build(context)
89
+ when :delete_report_plan
90
+ Aws::Backup::Endpoints::DeleteReportPlan.build(context)
91
+ when :describe_backup_job
92
+ Aws::Backup::Endpoints::DescribeBackupJob.build(context)
93
+ when :describe_backup_vault
94
+ Aws::Backup::Endpoints::DescribeBackupVault.build(context)
95
+ when :describe_copy_job
96
+ Aws::Backup::Endpoints::DescribeCopyJob.build(context)
97
+ when :describe_framework
98
+ Aws::Backup::Endpoints::DescribeFramework.build(context)
99
+ when :describe_global_settings
100
+ Aws::Backup::Endpoints::DescribeGlobalSettings.build(context)
101
+ when :describe_protected_resource
102
+ Aws::Backup::Endpoints::DescribeProtectedResource.build(context)
103
+ when :describe_recovery_point
104
+ Aws::Backup::Endpoints::DescribeRecoveryPoint.build(context)
105
+ when :describe_region_settings
106
+ Aws::Backup::Endpoints::DescribeRegionSettings.build(context)
107
+ when :describe_report_job
108
+ Aws::Backup::Endpoints::DescribeReportJob.build(context)
109
+ when :describe_report_plan
110
+ Aws::Backup::Endpoints::DescribeReportPlan.build(context)
111
+ when :describe_restore_job
112
+ Aws::Backup::Endpoints::DescribeRestoreJob.build(context)
113
+ when :disassociate_recovery_point
114
+ Aws::Backup::Endpoints::DisassociateRecoveryPoint.build(context)
115
+ when :disassociate_recovery_point_from_parent
116
+ Aws::Backup::Endpoints::DisassociateRecoveryPointFromParent.build(context)
117
+ when :export_backup_plan_template
118
+ Aws::Backup::Endpoints::ExportBackupPlanTemplate.build(context)
119
+ when :get_backup_plan
120
+ Aws::Backup::Endpoints::GetBackupPlan.build(context)
121
+ when :get_backup_plan_from_json
122
+ Aws::Backup::Endpoints::GetBackupPlanFromJSON.build(context)
123
+ when :get_backup_plan_from_template
124
+ Aws::Backup::Endpoints::GetBackupPlanFromTemplate.build(context)
125
+ when :get_backup_selection
126
+ Aws::Backup::Endpoints::GetBackupSelection.build(context)
127
+ when :get_backup_vault_access_policy
128
+ Aws::Backup::Endpoints::GetBackupVaultAccessPolicy.build(context)
129
+ when :get_backup_vault_notifications
130
+ Aws::Backup::Endpoints::GetBackupVaultNotifications.build(context)
131
+ when :get_legal_hold
132
+ Aws::Backup::Endpoints::GetLegalHold.build(context)
133
+ when :get_recovery_point_restore_metadata
134
+ Aws::Backup::Endpoints::GetRecoveryPointRestoreMetadata.build(context)
135
+ when :get_supported_resource_types
136
+ Aws::Backup::Endpoints::GetSupportedResourceTypes.build(context)
137
+ when :list_backup_jobs
138
+ Aws::Backup::Endpoints::ListBackupJobs.build(context)
139
+ when :list_backup_plan_templates
140
+ Aws::Backup::Endpoints::ListBackupPlanTemplates.build(context)
141
+ when :list_backup_plan_versions
142
+ Aws::Backup::Endpoints::ListBackupPlanVersions.build(context)
143
+ when :list_backup_plans
144
+ Aws::Backup::Endpoints::ListBackupPlans.build(context)
145
+ when :list_backup_selections
146
+ Aws::Backup::Endpoints::ListBackupSelections.build(context)
147
+ when :list_backup_vaults
148
+ Aws::Backup::Endpoints::ListBackupVaults.build(context)
149
+ when :list_copy_jobs
150
+ Aws::Backup::Endpoints::ListCopyJobs.build(context)
151
+ when :list_frameworks
152
+ Aws::Backup::Endpoints::ListFrameworks.build(context)
153
+ when :list_legal_holds
154
+ Aws::Backup::Endpoints::ListLegalHolds.build(context)
155
+ when :list_protected_resources
156
+ Aws::Backup::Endpoints::ListProtectedResources.build(context)
157
+ when :list_recovery_points_by_backup_vault
158
+ Aws::Backup::Endpoints::ListRecoveryPointsByBackupVault.build(context)
159
+ when :list_recovery_points_by_legal_hold
160
+ Aws::Backup::Endpoints::ListRecoveryPointsByLegalHold.build(context)
161
+ when :list_recovery_points_by_resource
162
+ Aws::Backup::Endpoints::ListRecoveryPointsByResource.build(context)
163
+ when :list_report_jobs
164
+ Aws::Backup::Endpoints::ListReportJobs.build(context)
165
+ when :list_report_plans
166
+ Aws::Backup::Endpoints::ListReportPlans.build(context)
167
+ when :list_restore_jobs
168
+ Aws::Backup::Endpoints::ListRestoreJobs.build(context)
169
+ when :list_tags
170
+ Aws::Backup::Endpoints::ListTags.build(context)
171
+ when :put_backup_vault_access_policy
172
+ Aws::Backup::Endpoints::PutBackupVaultAccessPolicy.build(context)
173
+ when :put_backup_vault_lock_configuration
174
+ Aws::Backup::Endpoints::PutBackupVaultLockConfiguration.build(context)
175
+ when :put_backup_vault_notifications
176
+ Aws::Backup::Endpoints::PutBackupVaultNotifications.build(context)
177
+ when :start_backup_job
178
+ Aws::Backup::Endpoints::StartBackupJob.build(context)
179
+ when :start_copy_job
180
+ Aws::Backup::Endpoints::StartCopyJob.build(context)
181
+ when :start_report_job
182
+ Aws::Backup::Endpoints::StartReportJob.build(context)
183
+ when :start_restore_job
184
+ Aws::Backup::Endpoints::StartRestoreJob.build(context)
185
+ when :stop_backup_job
186
+ Aws::Backup::Endpoints::StopBackupJob.build(context)
187
+ when :tag_resource
188
+ Aws::Backup::Endpoints::TagResource.build(context)
189
+ when :untag_resource
190
+ Aws::Backup::Endpoints::UntagResource.build(context)
191
+ when :update_backup_plan
192
+ Aws::Backup::Endpoints::UpdateBackupPlan.build(context)
193
+ when :update_framework
194
+ Aws::Backup::Endpoints::UpdateFramework.build(context)
195
+ when :update_global_settings
196
+ Aws::Backup::Endpoints::UpdateGlobalSettings.build(context)
197
+ when :update_recovery_point_lifecycle
198
+ Aws::Backup::Endpoints::UpdateRecoveryPointLifecycle.build(context)
199
+ when :update_region_settings
200
+ Aws::Backup::Endpoints::UpdateRegionSettings.build(context)
201
+ when :update_report_plan
202
+ Aws::Backup::Endpoints::UpdateReportPlan.build(context)
203
+ end
204
+ end
205
+ end
206
+
207
+ def add_handlers(handlers, _config)
208
+ handlers.add(Handler, step: :build, priority: 75)
209
+ end
210
+ end
211
+ end
212
+ end