1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package ecrpublic 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/aws-sdk-go-v2/service/ecrpublic/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Creates or updates the image manifest and tags associated with an image. When an 15// image is pushed and all new image layers have been uploaded, the PutImage API is 16// called once to create or update the image manifest and the tags associated with 17// the image. This operation is used by the Amazon ECR proxy and is not generally 18// used by customers for pulling and pushing images. In most cases, you should use 19// the docker CLI to pull, tag, and push images. 20func (c *Client) PutImage(ctx context.Context, params *PutImageInput, optFns ...func(*Options)) (*PutImageOutput, error) { 21 if params == nil { 22 params = &PutImageInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "PutImage", params, optFns, addOperationPutImageMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*PutImageOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33} 34 35type PutImageInput struct { 36 37 // The image manifest corresponding to the image to be uploaded. 38 // 39 // This member is required. 40 ImageManifest *string 41 42 // The name of the repository in which to put the image. 43 // 44 // This member is required. 45 RepositoryName *string 46 47 // The image digest of the image manifest corresponding to the image. 48 ImageDigest *string 49 50 // The media type of the image manifest. If you push an image manifest that does 51 // not contain the mediaType field, you must specify the imageManifestMediaType in 52 // the request. 53 ImageManifestMediaType *string 54 55 // The tag to associate with the image. This parameter is required for images that 56 // use the Docker Image Manifest V2 Schema 2 or Open Container Initiative (OCI) 57 // formats. 58 ImageTag *string 59 60 // The AWS account ID associated with the public registry that contains the 61 // repository in which to put the image. If you do not specify a registry, the 62 // default public registry is assumed. 63 RegistryId *string 64} 65 66type PutImageOutput struct { 67 68 // Details of the image uploaded. 69 Image *types.Image 70 71 // Metadata pertaining to the operation's result. 72 ResultMetadata middleware.Metadata 73} 74 75func addOperationPutImageMiddlewares(stack *middleware.Stack, options Options) (err error) { 76 err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutImage{}, middleware.After) 77 if err != nil { 78 return err 79 } 80 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutImage{}, middleware.After) 81 if err != nil { 82 return err 83 } 84 if err = addSetLoggerMiddleware(stack, options); err != nil { 85 return err 86 } 87 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 88 return err 89 } 90 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 91 return err 92 } 93 if err = addResolveEndpointMiddleware(stack, options); err != nil { 94 return err 95 } 96 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 97 return err 98 } 99 if err = addRetryMiddlewares(stack, options); err != nil { 100 return err 101 } 102 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 103 return err 104 } 105 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 106 return err 107 } 108 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 109 return err 110 } 111 if err = addClientUserAgent(stack); err != nil { 112 return err 113 } 114 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 115 return err 116 } 117 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 118 return err 119 } 120 if err = addOpPutImageValidationMiddleware(stack); err != nil { 121 return err 122 } 123 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutImage(options.Region), middleware.Before); err != nil { 124 return err 125 } 126 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 127 return err 128 } 129 if err = addResponseErrorMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addRequestResponseLogging(stack, options); err != nil { 133 return err 134 } 135 return nil 136} 137 138func newServiceMetadataMiddleware_opPutImage(region string) *awsmiddleware.RegisterServiceMetadata { 139 return &awsmiddleware.RegisterServiceMetadata{ 140 Region: region, 141 ServiceID: ServiceID, 142 SigningName: "ecr-public", 143 OperationName: "PutImage", 144 } 145} 146