1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package ecr
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Informs Amazon ECR that the image layer upload has completed for a specified
14// registry, repository name, and upload ID. You can optionally provide a sha256
15// digest of the image layer for data validation purposes. When an image is pushed,
16// the CompleteLayerUpload API is called once per each new image layer to verify
17// that the upload has completed. This operation is used by the Amazon ECR proxy
18// and is not generally used by customers for pulling and pushing images. In most
19// cases, you should use the docker CLI to pull, tag, and push images.
20func (c *Client) CompleteLayerUpload(ctx context.Context, params *CompleteLayerUploadInput, optFns ...func(*Options)) (*CompleteLayerUploadOutput, error) {
21	if params == nil {
22		params = &CompleteLayerUploadInput{}
23	}
24
25	result, metadata, err := c.invokeOperation(ctx, "CompleteLayerUpload", params, optFns, addOperationCompleteLayerUploadMiddlewares)
26	if err != nil {
27		return nil, err
28	}
29
30	out := result.(*CompleteLayerUploadOutput)
31	out.ResultMetadata = metadata
32	return out, nil
33}
34
35type CompleteLayerUploadInput struct {
36
37	// The sha256 digest of the image layer.
38	//
39	// This member is required.
40	LayerDigests []string
41
42	// The name of the repository to associate with the image layer.
43	//
44	// This member is required.
45	RepositoryName *string
46
47	// The upload ID from a previous InitiateLayerUpload operation to associate with
48	// the image layer.
49	//
50	// This member is required.
51	UploadId *string
52
53	// The AWS account ID associated with the registry to which to upload layers. If
54	// you do not specify a registry, the default registry is assumed.
55	RegistryId *string
56}
57
58type CompleteLayerUploadOutput struct {
59
60	// The sha256 digest of the image layer.
61	LayerDigest *string
62
63	// The registry ID associated with the request.
64	RegistryId *string
65
66	// The repository name associated with the request.
67	RepositoryName *string
68
69	// The upload ID associated with the layer.
70	UploadId *string
71
72	// Metadata pertaining to the operation's result.
73	ResultMetadata middleware.Metadata
74}
75
76func addOperationCompleteLayerUploadMiddlewares(stack *middleware.Stack, options Options) (err error) {
77	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCompleteLayerUpload{}, middleware.After)
78	if err != nil {
79		return err
80	}
81	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCompleteLayerUpload{}, middleware.After)
82	if err != nil {
83		return err
84	}
85	if err = addSetLoggerMiddleware(stack, options); err != nil {
86		return err
87	}
88	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
89		return err
90	}
91	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
92		return err
93	}
94	if err = addResolveEndpointMiddleware(stack, options); err != nil {
95		return err
96	}
97	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
98		return err
99	}
100	if err = addRetryMiddlewares(stack, options); err != nil {
101		return err
102	}
103	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
110		return err
111	}
112	if err = addClientUserAgent(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
119		return err
120	}
121	if err = addOpCompleteLayerUploadValidationMiddleware(stack); err != nil {
122		return err
123	}
124	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCompleteLayerUpload(options.Region), middleware.Before); err != nil {
125		return err
126	}
127	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addResponseErrorMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addRequestResponseLogging(stack, options); err != nil {
134		return err
135	}
136	return nil
137}
138
139func newServiceMetadataMiddleware_opCompleteLayerUpload(region string) *awsmiddleware.RegisterServiceMetadata {
140	return &awsmiddleware.RegisterServiceMetadata{
141		Region:        region,
142		ServiceID:     ServiceID,
143		SigningName:   "ecr",
144		OperationName: "CompleteLayerUpload",
145	}
146}
147