aws-sdk-codedeploy 1.49.0 → 1.51.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,162 @@
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::CodeDeploy
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::CodeDeploy::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::CodeDeploy::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::CodeDeploy::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 :add_tags_to_on_premises_instances
60
+ Aws::CodeDeploy::Endpoints::AddTagsToOnPremisesInstances.build(context)
61
+ when :batch_get_application_revisions
62
+ Aws::CodeDeploy::Endpoints::BatchGetApplicationRevisions.build(context)
63
+ when :batch_get_applications
64
+ Aws::CodeDeploy::Endpoints::BatchGetApplications.build(context)
65
+ when :batch_get_deployment_groups
66
+ Aws::CodeDeploy::Endpoints::BatchGetDeploymentGroups.build(context)
67
+ when :batch_get_deployment_instances
68
+ Aws::CodeDeploy::Endpoints::BatchGetDeploymentInstances.build(context)
69
+ when :batch_get_deployment_targets
70
+ Aws::CodeDeploy::Endpoints::BatchGetDeploymentTargets.build(context)
71
+ when :batch_get_deployments
72
+ Aws::CodeDeploy::Endpoints::BatchGetDeployments.build(context)
73
+ when :batch_get_on_premises_instances
74
+ Aws::CodeDeploy::Endpoints::BatchGetOnPremisesInstances.build(context)
75
+ when :continue_deployment
76
+ Aws::CodeDeploy::Endpoints::ContinueDeployment.build(context)
77
+ when :create_application
78
+ Aws::CodeDeploy::Endpoints::CreateApplication.build(context)
79
+ when :create_deployment
80
+ Aws::CodeDeploy::Endpoints::CreateDeployment.build(context)
81
+ when :create_deployment_config
82
+ Aws::CodeDeploy::Endpoints::CreateDeploymentConfig.build(context)
83
+ when :create_deployment_group
84
+ Aws::CodeDeploy::Endpoints::CreateDeploymentGroup.build(context)
85
+ when :delete_application
86
+ Aws::CodeDeploy::Endpoints::DeleteApplication.build(context)
87
+ when :delete_deployment_config
88
+ Aws::CodeDeploy::Endpoints::DeleteDeploymentConfig.build(context)
89
+ when :delete_deployment_group
90
+ Aws::CodeDeploy::Endpoints::DeleteDeploymentGroup.build(context)
91
+ when :delete_git_hub_account_token
92
+ Aws::CodeDeploy::Endpoints::DeleteGitHubAccountToken.build(context)
93
+ when :delete_resources_by_external_id
94
+ Aws::CodeDeploy::Endpoints::DeleteResourcesByExternalId.build(context)
95
+ when :deregister_on_premises_instance
96
+ Aws::CodeDeploy::Endpoints::DeregisterOnPremisesInstance.build(context)
97
+ when :get_application
98
+ Aws::CodeDeploy::Endpoints::GetApplication.build(context)
99
+ when :get_application_revision
100
+ Aws::CodeDeploy::Endpoints::GetApplicationRevision.build(context)
101
+ when :get_deployment
102
+ Aws::CodeDeploy::Endpoints::GetDeployment.build(context)
103
+ when :get_deployment_config
104
+ Aws::CodeDeploy::Endpoints::GetDeploymentConfig.build(context)
105
+ when :get_deployment_group
106
+ Aws::CodeDeploy::Endpoints::GetDeploymentGroup.build(context)
107
+ when :get_deployment_instance
108
+ Aws::CodeDeploy::Endpoints::GetDeploymentInstance.build(context)
109
+ when :get_deployment_target
110
+ Aws::CodeDeploy::Endpoints::GetDeploymentTarget.build(context)
111
+ when :get_on_premises_instance
112
+ Aws::CodeDeploy::Endpoints::GetOnPremisesInstance.build(context)
113
+ when :list_application_revisions
114
+ Aws::CodeDeploy::Endpoints::ListApplicationRevisions.build(context)
115
+ when :list_applications
116
+ Aws::CodeDeploy::Endpoints::ListApplications.build(context)
117
+ when :list_deployment_configs
118
+ Aws::CodeDeploy::Endpoints::ListDeploymentConfigs.build(context)
119
+ when :list_deployment_groups
120
+ Aws::CodeDeploy::Endpoints::ListDeploymentGroups.build(context)
121
+ when :list_deployment_instances
122
+ Aws::CodeDeploy::Endpoints::ListDeploymentInstances.build(context)
123
+ when :list_deployment_targets
124
+ Aws::CodeDeploy::Endpoints::ListDeploymentTargets.build(context)
125
+ when :list_deployments
126
+ Aws::CodeDeploy::Endpoints::ListDeployments.build(context)
127
+ when :list_git_hub_account_token_names
128
+ Aws::CodeDeploy::Endpoints::ListGitHubAccountTokenNames.build(context)
129
+ when :list_on_premises_instances
130
+ Aws::CodeDeploy::Endpoints::ListOnPremisesInstances.build(context)
131
+ when :list_tags_for_resource
132
+ Aws::CodeDeploy::Endpoints::ListTagsForResource.build(context)
133
+ when :put_lifecycle_event_hook_execution_status
134
+ Aws::CodeDeploy::Endpoints::PutLifecycleEventHookExecutionStatus.build(context)
135
+ when :register_application_revision
136
+ Aws::CodeDeploy::Endpoints::RegisterApplicationRevision.build(context)
137
+ when :register_on_premises_instance
138
+ Aws::CodeDeploy::Endpoints::RegisterOnPremisesInstance.build(context)
139
+ when :remove_tags_from_on_premises_instances
140
+ Aws::CodeDeploy::Endpoints::RemoveTagsFromOnPremisesInstances.build(context)
141
+ when :skip_wait_time_for_instance_termination
142
+ Aws::CodeDeploy::Endpoints::SkipWaitTimeForInstanceTermination.build(context)
143
+ when :stop_deployment
144
+ Aws::CodeDeploy::Endpoints::StopDeployment.build(context)
145
+ when :tag_resource
146
+ Aws::CodeDeploy::Endpoints::TagResource.build(context)
147
+ when :untag_resource
148
+ Aws::CodeDeploy::Endpoints::UntagResource.build(context)
149
+ when :update_application
150
+ Aws::CodeDeploy::Endpoints::UpdateApplication.build(context)
151
+ when :update_deployment_group
152
+ Aws::CodeDeploy::Endpoints::UpdateDeploymentGroup.build(context)
153
+ end
154
+ end
155
+ end
156
+
157
+ def add_handlers(handlers, _config)
158
+ handlers.add(Handler, step: :build, priority: 75)
159
+ end
160
+ end
161
+ end
162
+ end