aws-sdk-glacier 1.46.0 → 1.48.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,134 @@
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::Glacier
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::Glacier::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::Glacier::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::Glacier::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 :abort_multipart_upload
60
+ Aws::Glacier::Endpoints::AbortMultipartUpload.build(context)
61
+ when :abort_vault_lock
62
+ Aws::Glacier::Endpoints::AbortVaultLock.build(context)
63
+ when :add_tags_to_vault
64
+ Aws::Glacier::Endpoints::AddTagsToVault.build(context)
65
+ when :complete_multipart_upload
66
+ Aws::Glacier::Endpoints::CompleteMultipartUpload.build(context)
67
+ when :complete_vault_lock
68
+ Aws::Glacier::Endpoints::CompleteVaultLock.build(context)
69
+ when :create_vault
70
+ Aws::Glacier::Endpoints::CreateVault.build(context)
71
+ when :delete_archive
72
+ Aws::Glacier::Endpoints::DeleteArchive.build(context)
73
+ when :delete_vault
74
+ Aws::Glacier::Endpoints::DeleteVault.build(context)
75
+ when :delete_vault_access_policy
76
+ Aws::Glacier::Endpoints::DeleteVaultAccessPolicy.build(context)
77
+ when :delete_vault_notifications
78
+ Aws::Glacier::Endpoints::DeleteVaultNotifications.build(context)
79
+ when :describe_job
80
+ Aws::Glacier::Endpoints::DescribeJob.build(context)
81
+ when :describe_vault
82
+ Aws::Glacier::Endpoints::DescribeVault.build(context)
83
+ when :get_data_retrieval_policy
84
+ Aws::Glacier::Endpoints::GetDataRetrievalPolicy.build(context)
85
+ when :get_job_output
86
+ Aws::Glacier::Endpoints::GetJobOutput.build(context)
87
+ when :get_vault_access_policy
88
+ Aws::Glacier::Endpoints::GetVaultAccessPolicy.build(context)
89
+ when :get_vault_lock
90
+ Aws::Glacier::Endpoints::GetVaultLock.build(context)
91
+ when :get_vault_notifications
92
+ Aws::Glacier::Endpoints::GetVaultNotifications.build(context)
93
+ when :initiate_job
94
+ Aws::Glacier::Endpoints::InitiateJob.build(context)
95
+ when :initiate_multipart_upload
96
+ Aws::Glacier::Endpoints::InitiateMultipartUpload.build(context)
97
+ when :initiate_vault_lock
98
+ Aws::Glacier::Endpoints::InitiateVaultLock.build(context)
99
+ when :list_jobs
100
+ Aws::Glacier::Endpoints::ListJobs.build(context)
101
+ when :list_multipart_uploads
102
+ Aws::Glacier::Endpoints::ListMultipartUploads.build(context)
103
+ when :list_parts
104
+ Aws::Glacier::Endpoints::ListParts.build(context)
105
+ when :list_provisioned_capacity
106
+ Aws::Glacier::Endpoints::ListProvisionedCapacity.build(context)
107
+ when :list_tags_for_vault
108
+ Aws::Glacier::Endpoints::ListTagsForVault.build(context)
109
+ when :list_vaults
110
+ Aws::Glacier::Endpoints::ListVaults.build(context)
111
+ when :purchase_provisioned_capacity
112
+ Aws::Glacier::Endpoints::PurchaseProvisionedCapacity.build(context)
113
+ when :remove_tags_from_vault
114
+ Aws::Glacier::Endpoints::RemoveTagsFromVault.build(context)
115
+ when :set_data_retrieval_policy
116
+ Aws::Glacier::Endpoints::SetDataRetrievalPolicy.build(context)
117
+ when :set_vault_access_policy
118
+ Aws::Glacier::Endpoints::SetVaultAccessPolicy.build(context)
119
+ when :set_vault_notifications
120
+ Aws::Glacier::Endpoints::SetVaultNotifications.build(context)
121
+ when :upload_archive
122
+ Aws::Glacier::Endpoints::UploadArchive.build(context)
123
+ when :upload_multipart_part
124
+ Aws::Glacier::Endpoints::UploadMultipartPart.build(context)
125
+ end
126
+ end
127
+ end
128
+
129
+ def add_handlers(handlers, _config)
130
+ handlers.add(Handler, step: :build, priority: 75)
131
+ end
132
+ end
133
+ end
134
+ end