aws-sdk-ecr 1.56.0 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,150 @@
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::ECR
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::ECR::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::ECR::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::ECR::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 :batch_check_layer_availability
60
+ Aws::ECR::Endpoints::BatchCheckLayerAvailability.build(context)
61
+ when :batch_delete_image
62
+ Aws::ECR::Endpoints::BatchDeleteImage.build(context)
63
+ when :batch_get_image
64
+ Aws::ECR::Endpoints::BatchGetImage.build(context)
65
+ when :batch_get_repository_scanning_configuration
66
+ Aws::ECR::Endpoints::BatchGetRepositoryScanningConfiguration.build(context)
67
+ when :complete_layer_upload
68
+ Aws::ECR::Endpoints::CompleteLayerUpload.build(context)
69
+ when :create_pull_through_cache_rule
70
+ Aws::ECR::Endpoints::CreatePullThroughCacheRule.build(context)
71
+ when :create_repository
72
+ Aws::ECR::Endpoints::CreateRepository.build(context)
73
+ when :delete_lifecycle_policy
74
+ Aws::ECR::Endpoints::DeleteLifecyclePolicy.build(context)
75
+ when :delete_pull_through_cache_rule
76
+ Aws::ECR::Endpoints::DeletePullThroughCacheRule.build(context)
77
+ when :delete_registry_policy
78
+ Aws::ECR::Endpoints::DeleteRegistryPolicy.build(context)
79
+ when :delete_repository
80
+ Aws::ECR::Endpoints::DeleteRepository.build(context)
81
+ when :delete_repository_policy
82
+ Aws::ECR::Endpoints::DeleteRepositoryPolicy.build(context)
83
+ when :describe_image_replication_status
84
+ Aws::ECR::Endpoints::DescribeImageReplicationStatus.build(context)
85
+ when :describe_image_scan_findings
86
+ Aws::ECR::Endpoints::DescribeImageScanFindings.build(context)
87
+ when :describe_images
88
+ Aws::ECR::Endpoints::DescribeImages.build(context)
89
+ when :describe_pull_through_cache_rules
90
+ Aws::ECR::Endpoints::DescribePullThroughCacheRules.build(context)
91
+ when :describe_registry
92
+ Aws::ECR::Endpoints::DescribeRegistry.build(context)
93
+ when :describe_repositories
94
+ Aws::ECR::Endpoints::DescribeRepositories.build(context)
95
+ when :get_authorization_token
96
+ Aws::ECR::Endpoints::GetAuthorizationToken.build(context)
97
+ when :get_download_url_for_layer
98
+ Aws::ECR::Endpoints::GetDownloadUrlForLayer.build(context)
99
+ when :get_lifecycle_policy
100
+ Aws::ECR::Endpoints::GetLifecyclePolicy.build(context)
101
+ when :get_lifecycle_policy_preview
102
+ Aws::ECR::Endpoints::GetLifecyclePolicyPreview.build(context)
103
+ when :get_registry_policy
104
+ Aws::ECR::Endpoints::GetRegistryPolicy.build(context)
105
+ when :get_registry_scanning_configuration
106
+ Aws::ECR::Endpoints::GetRegistryScanningConfiguration.build(context)
107
+ when :get_repository_policy
108
+ Aws::ECR::Endpoints::GetRepositoryPolicy.build(context)
109
+ when :initiate_layer_upload
110
+ Aws::ECR::Endpoints::InitiateLayerUpload.build(context)
111
+ when :list_images
112
+ Aws::ECR::Endpoints::ListImages.build(context)
113
+ when :list_tags_for_resource
114
+ Aws::ECR::Endpoints::ListTagsForResource.build(context)
115
+ when :put_image
116
+ Aws::ECR::Endpoints::PutImage.build(context)
117
+ when :put_image_scanning_configuration
118
+ Aws::ECR::Endpoints::PutImageScanningConfiguration.build(context)
119
+ when :put_image_tag_mutability
120
+ Aws::ECR::Endpoints::PutImageTagMutability.build(context)
121
+ when :put_lifecycle_policy
122
+ Aws::ECR::Endpoints::PutLifecyclePolicy.build(context)
123
+ when :put_registry_policy
124
+ Aws::ECR::Endpoints::PutRegistryPolicy.build(context)
125
+ when :put_registry_scanning_configuration
126
+ Aws::ECR::Endpoints::PutRegistryScanningConfiguration.build(context)
127
+ when :put_replication_configuration
128
+ Aws::ECR::Endpoints::PutReplicationConfiguration.build(context)
129
+ when :set_repository_policy
130
+ Aws::ECR::Endpoints::SetRepositoryPolicy.build(context)
131
+ when :start_image_scan
132
+ Aws::ECR::Endpoints::StartImageScan.build(context)
133
+ when :start_lifecycle_policy_preview
134
+ Aws::ECR::Endpoints::StartLifecyclePolicyPreview.build(context)
135
+ when :tag_resource
136
+ Aws::ECR::Endpoints::TagResource.build(context)
137
+ when :untag_resource
138
+ Aws::ECR::Endpoints::UntagResource.build(context)
139
+ when :upload_layer_part
140
+ Aws::ECR::Endpoints::UploadLayerPart.build(context)
141
+ end
142
+ end
143
+ end
144
+
145
+ def add_handlers(handlers, _config)
146
+ handlers.add(Handler, step: :build, priority: 75)
147
+ end
148
+ end
149
+ end
150
+ end