aws-sdk-imagebuilder 1.40.0 → 1.42.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,168 @@
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::Imagebuilder
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::Imagebuilder::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::Imagebuilder::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::Imagebuilder::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_image_creation
60
+ Aws::Imagebuilder::Endpoints::CancelImageCreation.build(context)
61
+ when :create_component
62
+ Aws::Imagebuilder::Endpoints::CreateComponent.build(context)
63
+ when :create_container_recipe
64
+ Aws::Imagebuilder::Endpoints::CreateContainerRecipe.build(context)
65
+ when :create_distribution_configuration
66
+ Aws::Imagebuilder::Endpoints::CreateDistributionConfiguration.build(context)
67
+ when :create_image
68
+ Aws::Imagebuilder::Endpoints::CreateImage.build(context)
69
+ when :create_image_pipeline
70
+ Aws::Imagebuilder::Endpoints::CreateImagePipeline.build(context)
71
+ when :create_image_recipe
72
+ Aws::Imagebuilder::Endpoints::CreateImageRecipe.build(context)
73
+ when :create_infrastructure_configuration
74
+ Aws::Imagebuilder::Endpoints::CreateInfrastructureConfiguration.build(context)
75
+ when :delete_component
76
+ Aws::Imagebuilder::Endpoints::DeleteComponent.build(context)
77
+ when :delete_container_recipe
78
+ Aws::Imagebuilder::Endpoints::DeleteContainerRecipe.build(context)
79
+ when :delete_distribution_configuration
80
+ Aws::Imagebuilder::Endpoints::DeleteDistributionConfiguration.build(context)
81
+ when :delete_image
82
+ Aws::Imagebuilder::Endpoints::DeleteImage.build(context)
83
+ when :delete_image_pipeline
84
+ Aws::Imagebuilder::Endpoints::DeleteImagePipeline.build(context)
85
+ when :delete_image_recipe
86
+ Aws::Imagebuilder::Endpoints::DeleteImageRecipe.build(context)
87
+ when :delete_infrastructure_configuration
88
+ Aws::Imagebuilder::Endpoints::DeleteInfrastructureConfiguration.build(context)
89
+ when :get_component
90
+ Aws::Imagebuilder::Endpoints::GetComponent.build(context)
91
+ when :get_component_policy
92
+ Aws::Imagebuilder::Endpoints::GetComponentPolicy.build(context)
93
+ when :get_container_recipe
94
+ Aws::Imagebuilder::Endpoints::GetContainerRecipe.build(context)
95
+ when :get_container_recipe_policy
96
+ Aws::Imagebuilder::Endpoints::GetContainerRecipePolicy.build(context)
97
+ when :get_distribution_configuration
98
+ Aws::Imagebuilder::Endpoints::GetDistributionConfiguration.build(context)
99
+ when :get_image
100
+ Aws::Imagebuilder::Endpoints::GetImage.build(context)
101
+ when :get_image_pipeline
102
+ Aws::Imagebuilder::Endpoints::GetImagePipeline.build(context)
103
+ when :get_image_policy
104
+ Aws::Imagebuilder::Endpoints::GetImagePolicy.build(context)
105
+ when :get_image_recipe
106
+ Aws::Imagebuilder::Endpoints::GetImageRecipe.build(context)
107
+ when :get_image_recipe_policy
108
+ Aws::Imagebuilder::Endpoints::GetImageRecipePolicy.build(context)
109
+ when :get_infrastructure_configuration
110
+ Aws::Imagebuilder::Endpoints::GetInfrastructureConfiguration.build(context)
111
+ when :import_component
112
+ Aws::Imagebuilder::Endpoints::ImportComponent.build(context)
113
+ when :import_vm_image
114
+ Aws::Imagebuilder::Endpoints::ImportVmImage.build(context)
115
+ when :list_component_build_versions
116
+ Aws::Imagebuilder::Endpoints::ListComponentBuildVersions.build(context)
117
+ when :list_components
118
+ Aws::Imagebuilder::Endpoints::ListComponents.build(context)
119
+ when :list_container_recipes
120
+ Aws::Imagebuilder::Endpoints::ListContainerRecipes.build(context)
121
+ when :list_distribution_configurations
122
+ Aws::Imagebuilder::Endpoints::ListDistributionConfigurations.build(context)
123
+ when :list_image_build_versions
124
+ Aws::Imagebuilder::Endpoints::ListImageBuildVersions.build(context)
125
+ when :list_image_packages
126
+ Aws::Imagebuilder::Endpoints::ListImagePackages.build(context)
127
+ when :list_image_pipeline_images
128
+ Aws::Imagebuilder::Endpoints::ListImagePipelineImages.build(context)
129
+ when :list_image_pipelines
130
+ Aws::Imagebuilder::Endpoints::ListImagePipelines.build(context)
131
+ when :list_image_recipes
132
+ Aws::Imagebuilder::Endpoints::ListImageRecipes.build(context)
133
+ when :list_images
134
+ Aws::Imagebuilder::Endpoints::ListImages.build(context)
135
+ when :list_infrastructure_configurations
136
+ Aws::Imagebuilder::Endpoints::ListInfrastructureConfigurations.build(context)
137
+ when :list_tags_for_resource
138
+ Aws::Imagebuilder::Endpoints::ListTagsForResource.build(context)
139
+ when :put_component_policy
140
+ Aws::Imagebuilder::Endpoints::PutComponentPolicy.build(context)
141
+ when :put_container_recipe_policy
142
+ Aws::Imagebuilder::Endpoints::PutContainerRecipePolicy.build(context)
143
+ when :put_image_policy
144
+ Aws::Imagebuilder::Endpoints::PutImagePolicy.build(context)
145
+ when :put_image_recipe_policy
146
+ Aws::Imagebuilder::Endpoints::PutImageRecipePolicy.build(context)
147
+ when :start_image_pipeline_execution
148
+ Aws::Imagebuilder::Endpoints::StartImagePipelineExecution.build(context)
149
+ when :tag_resource
150
+ Aws::Imagebuilder::Endpoints::TagResource.build(context)
151
+ when :untag_resource
152
+ Aws::Imagebuilder::Endpoints::UntagResource.build(context)
153
+ when :update_distribution_configuration
154
+ Aws::Imagebuilder::Endpoints::UpdateDistributionConfiguration.build(context)
155
+ when :update_image_pipeline
156
+ Aws::Imagebuilder::Endpoints::UpdateImagePipeline.build(context)
157
+ when :update_infrastructure_configuration
158
+ Aws::Imagebuilder::Endpoints::UpdateInfrastructureConfiguration.build(context)
159
+ end
160
+ end
161
+ end
162
+
163
+ def add_handlers(handlers, _config)
164
+ handlers.add(Handler, step: :build, priority: 75)
165
+ end
166
+ end
167
+ end
168
+ end