aws-sdk-datasync 1.50.0 → 1.52.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,156 @@
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::DataSync
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::DataSync::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::DataSync::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::DataSync::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_task_execution
60
+ Aws::DataSync::Endpoints::CancelTaskExecution.build(context)
61
+ when :create_agent
62
+ Aws::DataSync::Endpoints::CreateAgent.build(context)
63
+ when :create_location_efs
64
+ Aws::DataSync::Endpoints::CreateLocationEfs.build(context)
65
+ when :create_location_fsx_lustre
66
+ Aws::DataSync::Endpoints::CreateLocationFsxLustre.build(context)
67
+ when :create_location_fsx_ontap
68
+ Aws::DataSync::Endpoints::CreateLocationFsxOntap.build(context)
69
+ when :create_location_fsx_open_zfs
70
+ Aws::DataSync::Endpoints::CreateLocationFsxOpenZfs.build(context)
71
+ when :create_location_fsx_windows
72
+ Aws::DataSync::Endpoints::CreateLocationFsxWindows.build(context)
73
+ when :create_location_hdfs
74
+ Aws::DataSync::Endpoints::CreateLocationHdfs.build(context)
75
+ when :create_location_nfs
76
+ Aws::DataSync::Endpoints::CreateLocationNfs.build(context)
77
+ when :create_location_object_storage
78
+ Aws::DataSync::Endpoints::CreateLocationObjectStorage.build(context)
79
+ when :create_location_s3
80
+ Aws::DataSync::Endpoints::CreateLocationS3.build(context)
81
+ when :create_location_smb
82
+ Aws::DataSync::Endpoints::CreateLocationSmb.build(context)
83
+ when :create_task
84
+ Aws::DataSync::Endpoints::CreateTask.build(context)
85
+ when :delete_agent
86
+ Aws::DataSync::Endpoints::DeleteAgent.build(context)
87
+ when :delete_location
88
+ Aws::DataSync::Endpoints::DeleteLocation.build(context)
89
+ when :delete_task
90
+ Aws::DataSync::Endpoints::DeleteTask.build(context)
91
+ when :describe_agent
92
+ Aws::DataSync::Endpoints::DescribeAgent.build(context)
93
+ when :describe_location_efs
94
+ Aws::DataSync::Endpoints::DescribeLocationEfs.build(context)
95
+ when :describe_location_fsx_lustre
96
+ Aws::DataSync::Endpoints::DescribeLocationFsxLustre.build(context)
97
+ when :describe_location_fsx_ontap
98
+ Aws::DataSync::Endpoints::DescribeLocationFsxOntap.build(context)
99
+ when :describe_location_fsx_open_zfs
100
+ Aws::DataSync::Endpoints::DescribeLocationFsxOpenZfs.build(context)
101
+ when :describe_location_fsx_windows
102
+ Aws::DataSync::Endpoints::DescribeLocationFsxWindows.build(context)
103
+ when :describe_location_hdfs
104
+ Aws::DataSync::Endpoints::DescribeLocationHdfs.build(context)
105
+ when :describe_location_nfs
106
+ Aws::DataSync::Endpoints::DescribeLocationNfs.build(context)
107
+ when :describe_location_object_storage
108
+ Aws::DataSync::Endpoints::DescribeLocationObjectStorage.build(context)
109
+ when :describe_location_s3
110
+ Aws::DataSync::Endpoints::DescribeLocationS3.build(context)
111
+ when :describe_location_smb
112
+ Aws::DataSync::Endpoints::DescribeLocationSmb.build(context)
113
+ when :describe_task
114
+ Aws::DataSync::Endpoints::DescribeTask.build(context)
115
+ when :describe_task_execution
116
+ Aws::DataSync::Endpoints::DescribeTaskExecution.build(context)
117
+ when :list_agents
118
+ Aws::DataSync::Endpoints::ListAgents.build(context)
119
+ when :list_locations
120
+ Aws::DataSync::Endpoints::ListLocations.build(context)
121
+ when :list_tags_for_resource
122
+ Aws::DataSync::Endpoints::ListTagsForResource.build(context)
123
+ when :list_task_executions
124
+ Aws::DataSync::Endpoints::ListTaskExecutions.build(context)
125
+ when :list_tasks
126
+ Aws::DataSync::Endpoints::ListTasks.build(context)
127
+ when :start_task_execution
128
+ Aws::DataSync::Endpoints::StartTaskExecution.build(context)
129
+ when :tag_resource
130
+ Aws::DataSync::Endpoints::TagResource.build(context)
131
+ when :untag_resource
132
+ Aws::DataSync::Endpoints::UntagResource.build(context)
133
+ when :update_agent
134
+ Aws::DataSync::Endpoints::UpdateAgent.build(context)
135
+ when :update_location_hdfs
136
+ Aws::DataSync::Endpoints::UpdateLocationHdfs.build(context)
137
+ when :update_location_nfs
138
+ Aws::DataSync::Endpoints::UpdateLocationNfs.build(context)
139
+ when :update_location_object_storage
140
+ Aws::DataSync::Endpoints::UpdateLocationObjectStorage.build(context)
141
+ when :update_location_smb
142
+ Aws::DataSync::Endpoints::UpdateLocationSmb.build(context)
143
+ when :update_task
144
+ Aws::DataSync::Endpoints::UpdateTask.build(context)
145
+ when :update_task_execution
146
+ Aws::DataSync::Endpoints::UpdateTaskExecution.build(context)
147
+ end
148
+ end
149
+ end
150
+
151
+ def add_handlers(handlers, _config)
152
+ handlers.add(Handler, step: :build, priority: 75)
153
+ end
154
+ end
155
+ end
156
+ end