aws-sdk-migrationhuborchestrator 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,124 @@
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::MigrationHubOrchestrator
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::MigrationHubOrchestrator::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::MigrationHubOrchestrator::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::MigrationHubOrchestrator::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 :create_workflow
60
+ Aws::MigrationHubOrchestrator::Endpoints::CreateWorkflow.build(context)
61
+ when :create_workflow_step
62
+ Aws::MigrationHubOrchestrator::Endpoints::CreateWorkflowStep.build(context)
63
+ when :create_workflow_step_group
64
+ Aws::MigrationHubOrchestrator::Endpoints::CreateWorkflowStepGroup.build(context)
65
+ when :delete_workflow
66
+ Aws::MigrationHubOrchestrator::Endpoints::DeleteWorkflow.build(context)
67
+ when :delete_workflow_step
68
+ Aws::MigrationHubOrchestrator::Endpoints::DeleteWorkflowStep.build(context)
69
+ when :delete_workflow_step_group
70
+ Aws::MigrationHubOrchestrator::Endpoints::DeleteWorkflowStepGroup.build(context)
71
+ when :get_template
72
+ Aws::MigrationHubOrchestrator::Endpoints::GetTemplate.build(context)
73
+ when :get_template_step
74
+ Aws::MigrationHubOrchestrator::Endpoints::GetTemplateStep.build(context)
75
+ when :get_template_step_group
76
+ Aws::MigrationHubOrchestrator::Endpoints::GetTemplateStepGroup.build(context)
77
+ when :get_workflow
78
+ Aws::MigrationHubOrchestrator::Endpoints::GetWorkflow.build(context)
79
+ when :get_workflow_step
80
+ Aws::MigrationHubOrchestrator::Endpoints::GetWorkflowStep.build(context)
81
+ when :get_workflow_step_group
82
+ Aws::MigrationHubOrchestrator::Endpoints::GetWorkflowStepGroup.build(context)
83
+ when :list_plugins
84
+ Aws::MigrationHubOrchestrator::Endpoints::ListPlugins.build(context)
85
+ when :list_tags_for_resource
86
+ Aws::MigrationHubOrchestrator::Endpoints::ListTagsForResource.build(context)
87
+ when :list_template_step_groups
88
+ Aws::MigrationHubOrchestrator::Endpoints::ListTemplateStepGroups.build(context)
89
+ when :list_template_steps
90
+ Aws::MigrationHubOrchestrator::Endpoints::ListTemplateSteps.build(context)
91
+ when :list_templates
92
+ Aws::MigrationHubOrchestrator::Endpoints::ListTemplates.build(context)
93
+ when :list_workflow_step_groups
94
+ Aws::MigrationHubOrchestrator::Endpoints::ListWorkflowStepGroups.build(context)
95
+ when :list_workflow_steps
96
+ Aws::MigrationHubOrchestrator::Endpoints::ListWorkflowSteps.build(context)
97
+ when :list_workflows
98
+ Aws::MigrationHubOrchestrator::Endpoints::ListWorkflows.build(context)
99
+ when :retry_workflow_step
100
+ Aws::MigrationHubOrchestrator::Endpoints::RetryWorkflowStep.build(context)
101
+ when :start_workflow
102
+ Aws::MigrationHubOrchestrator::Endpoints::StartWorkflow.build(context)
103
+ when :stop_workflow
104
+ Aws::MigrationHubOrchestrator::Endpoints::StopWorkflow.build(context)
105
+ when :tag_resource
106
+ Aws::MigrationHubOrchestrator::Endpoints::TagResource.build(context)
107
+ when :untag_resource
108
+ Aws::MigrationHubOrchestrator::Endpoints::UntagResource.build(context)
109
+ when :update_workflow
110
+ Aws::MigrationHubOrchestrator::Endpoints::UpdateWorkflow.build(context)
111
+ when :update_workflow_step
112
+ Aws::MigrationHubOrchestrator::Endpoints::UpdateWorkflowStep.build(context)
113
+ when :update_workflow_step_group
114
+ Aws::MigrationHubOrchestrator::Endpoints::UpdateWorkflowStepGroup.build(context)
115
+ end
116
+ end
117
+ end
118
+
119
+ def add_handlers(handlers, _config)
120
+ handlers.add(Handler, step: :build, priority: 75)
121
+ end
122
+ end
123
+ end
124
+ end