Notifies Amazon ECR that you intend to upload an image layer.
When an image is pushed, the InitiateLayerUpload API is called once per image layer that has not already been uploaded. Whether or not an image layer has been uploaded is determined by the BatchCheckLayerAvailability API action.
This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.
Parameters:
-
registry_id
(Optional[RegistryId], default:
None
)
–
The Amazon Web Services account ID associated with the registry to which you intend to upload layers. If you do not specify a registry, the default registry is assumed.
-
repository_name
(RepositoryName)
–
The name of the repository to which you intend to upload layers.
Raises:
-
InvalidParameterException
–
The specified parameter is invalid. Review the available parameters for the API request.
-
KmsException
–
The operation failed due to a KMS exception.
-
RepositoryNotFoundException
–
The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
ServerException
–
These errors are usually caused by a server-side issue.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_ecr/_services/ecr.py
| def initiate_layer_upload(
self,
repository_name: "capo_ecr.types.repository_name.RepositoryName",
*,
config_overrides: Optional[ECRClientConfig] = None,
registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
) -> "capo_ecr.types.initiate_layer_upload_response.InitiateLayerUploadResponse":
"""<p>Notifies Amazon ECR that you intend to upload an image layer.</p> <p>When an image is pushed, the InitiateLayerUpload API is called once per image layer that has not already been uploaded. Whether or not an image layer has been uploaded is determined by the BatchCheckLayerAvailability API action.</p> <note> <p>This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the <code>docker</code> CLI to pull, tag, and push images.</p> </note>
Args:
registry_id: <p>The Amazon Web Services account ID associated with the registry to which you intend to upload layers. If you do not specify a registry, the default registry is assumed.</p>
repository_name: <p>The name of the repository to which you intend to upload layers.</p>
Raises:
capo_ecr.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
capo_ecr.errors.kms_exception.KmsException: <p>The operation failed due to a KMS exception.</p>
capo_ecr.errors.repository_not_found_exception.RepositoryNotFoundException: <p>The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.</p>
capo_ecr.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ecr.types.initiate_layer_upload_request.InitiateLayerUploadRequest]",
) -> OperationResponse[
"capo_ecr.types.initiate_layer_upload_response.InitiateLayerUploadResponse"
]:
import capo_ecr._operations.amazon_ec2_container_registry_v20150921.initiate_layer_upload
output, http_response = (
capo_ecr._operations.amazon_ec2_container_registry_v20150921.initiate_layer_upload.initiate_layer_upload(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("InitiateLayerUpload")
)
input_: capo_ecr.types.initiate_layer_upload_request.InitiateLayerUploadRequest = {
"repository_name": repository_name
}
if registry_id is not None:
input_["registry_id"] = registry_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|