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/aws-sdk-go-v2/service/ecr/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Checks the availability of one or more image layers in a repository. When an 15// image is pushed to a repository, each image layer is checked to verify if it has 16// been uploaded before. If it has been uploaded, then the image layer is skipped. 17// This operation is used by the Amazon ECR proxy and is not generally used by 18// customers for pulling and pushing images. In most cases, you should use the 19// docker CLI to pull, tag, and push images. 20func (c *Client) BatchCheckLayerAvailability(ctx context.Context, params *BatchCheckLayerAvailabilityInput, optFns ...func(*Options)) (*BatchCheckLayerAvailabilityOutput, error) { 21 if params == nil { 22 params = &BatchCheckLayerAvailabilityInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "BatchCheckLayerAvailability", params, optFns, addOperationBatchCheckLayerAvailabilityMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*BatchCheckLayerAvailabilityOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33} 34 35type BatchCheckLayerAvailabilityInput struct { 36 37 // The digests of the image layers to check. 38 // 39 // This member is required. 40 LayerDigests []string 41 42 // The name of the repository that is associated with the image layers to check. 43 // 44 // This member is required. 45 RepositoryName *string 46 47 // The AWS account ID associated with the registry that contains the image layers 48 // to check. If you do not specify a registry, the default registry is assumed. 49 RegistryId *string 50} 51 52type BatchCheckLayerAvailabilityOutput struct { 53 54 // Any failures associated with the call. 55 Failures []types.LayerFailure 56 57 // A list of image layer objects corresponding to the image layer references in the 58 // request. 59 Layers []types.Layer 60 61 // Metadata pertaining to the operation's result. 62 ResultMetadata middleware.Metadata 63} 64 65func addOperationBatchCheckLayerAvailabilityMiddlewares(stack *middleware.Stack, options Options) (err error) { 66 err = stack.Serialize.Add(&awsAwsjson11_serializeOpBatchCheckLayerAvailability{}, middleware.After) 67 if err != nil { 68 return err 69 } 70 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpBatchCheckLayerAvailability{}, middleware.After) 71 if err != nil { 72 return err 73 } 74 if err = addSetLoggerMiddleware(stack, options); err != nil { 75 return err 76 } 77 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 78 return err 79 } 80 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 81 return err 82 } 83 if err = addResolveEndpointMiddleware(stack, options); err != nil { 84 return err 85 } 86 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 87 return err 88 } 89 if err = addRetryMiddlewares(stack, options); err != nil { 90 return err 91 } 92 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 93 return err 94 } 95 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 96 return err 97 } 98 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 99 return err 100 } 101 if err = addClientUserAgent(stack); err != nil { 102 return err 103 } 104 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 105 return err 106 } 107 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 108 return err 109 } 110 if err = addOpBatchCheckLayerAvailabilityValidationMiddleware(stack); err != nil { 111 return err 112 } 113 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchCheckLayerAvailability(options.Region), middleware.Before); err != nil { 114 return err 115 } 116 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 117 return err 118 } 119 if err = addResponseErrorMiddleware(stack); err != nil { 120 return err 121 } 122 if err = addRequestResponseLogging(stack, options); err != nil { 123 return err 124 } 125 return nil 126} 127 128func newServiceMetadataMiddleware_opBatchCheckLayerAvailability(region string) *awsmiddleware.RegisterServiceMetadata { 129 return &awsmiddleware.RegisterServiceMetadata{ 130 Region: region, 131 ServiceID: ServiceID, 132 SigningName: "ecr", 133 OperationName: "BatchCheckLayerAvailability", 134 } 135} 136