api_op_RegisterContainerImage.go raw
1 // Code generated by smithy-go-codegen DO NOT EDIT.
2
3 package lightsail
4
5 import (
6 "context"
7 "fmt"
8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9 "github.com/aws/aws-sdk-go-v2/service/lightsail/types"
10 "github.com/aws/smithy-go/middleware"
11 smithyhttp "github.com/aws/smithy-go/transport/http"
12 )
13
14 // Registers a container image to your Amazon Lightsail container service.
15 //
16 // This action is not required if you install and use the Lightsail Control
17 // (lightsailctl) plugin to push container images to your Lightsail container
18 // service. For more information, see [Pushing and managing container images on your Amazon Lightsail container services]in the Amazon Lightsail Developer Guide.
19 //
20 // [Pushing and managing container images on your Amazon Lightsail container services]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-pushing-container-images
21 func (c *Client) RegisterContainerImage(ctx context.Context, params *RegisterContainerImageInput, optFns ...func(*Options)) (*RegisterContainerImageOutput, error) {
22 if params == nil {
23 params = &RegisterContainerImageInput{}
24 }
25
26 result, metadata, err := c.invokeOperation(ctx, "RegisterContainerImage", params, optFns, c.addOperationRegisterContainerImageMiddlewares)
27 if err != nil {
28 return nil, err
29 }
30
31 out := result.(*RegisterContainerImageOutput)
32 out.ResultMetadata = metadata
33 return out, nil
34 }
35
36 type RegisterContainerImageInput struct {
37
38 // The digest of the container image to be registered.
39 //
40 // This member is required.
41 Digest *string
42
43 // The label for the container image when it's registered to the container service.
44 //
45 // Use a descriptive label that you can use to track the different versions of
46 // your registered container images.
47 //
48 // Use the GetContainerImages action to return the container images registered to
49 // a Lightsail container service. The label is the portion of the following image
50 // name example:
51 //
52 // - :container-service-1..1
53 //
54 // If the name of your container service is mycontainerservice , and the label that
55 // you specify is mystaticwebsite , then the name of the registered container image
56 // will be :mycontainerservice.mystaticwebsite.1 .
57 //
58 // The number at the end of these image name examples represents the version of
59 // the registered container image. If you push and register another container image
60 // to the same Lightsail container service, with the same label, then the version
61 // number for the new registered container image will be 2 . If you push and
62 // register another container image, the version number will be 3 , and so on.
63 //
64 // This member is required.
65 Label *string
66
67 // The name of the container service for which to register a container image.
68 //
69 // This member is required.
70 ServiceName *string
71
72 noSmithyDocumentSerde
73 }
74
75 type RegisterContainerImageOutput struct {
76
77 // An object that describes a container image that is registered to a Lightsail
78 // container service
79 ContainerImage *types.ContainerImage
80
81 // Metadata pertaining to the operation's result.
82 ResultMetadata middleware.Metadata
83
84 noSmithyDocumentSerde
85 }
86
87 func (c *Client) addOperationRegisterContainerImageMiddlewares(stack *middleware.Stack, options Options) (err error) {
88 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
89 return err
90 }
91 err = stack.Serialize.Add(&awsAwsjson11_serializeOpRegisterContainerImage{}, middleware.After)
92 if err != nil {
93 return err
94 }
95 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpRegisterContainerImage{}, middleware.After)
96 if err != nil {
97 return err
98 }
99 if err := addProtocolFinalizerMiddlewares(stack, options, "RegisterContainerImage"); err != nil {
100 return fmt.Errorf("add protocol finalizers: %v", err)
101 }
102
103 if err = addlegacyEndpointContextSetter(stack, options); err != nil {
104 return err
105 }
106 if err = addSetLoggerMiddleware(stack, options); err != nil {
107 return err
108 }
109 if err = addClientRequestID(stack); err != nil {
110 return err
111 }
112 if err = addComputeContentLength(stack); err != nil {
113 return err
114 }
115 if err = addResolveEndpointMiddleware(stack, options); err != nil {
116 return err
117 }
118 if err = addComputePayloadSHA256(stack); err != nil {
119 return err
120 }
121 if err = addRetry(stack, options); err != nil {
122 return err
123 }
124 if err = addRawResponseToMetadata(stack); err != nil {
125 return err
126 }
127 if err = addRecordResponseTiming(stack); err != nil {
128 return err
129 }
130 if err = addSpanRetryLoop(stack, options); err != nil {
131 return err
132 }
133 if err = addClientUserAgent(stack, options); err != nil {
134 return err
135 }
136 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
137 return err
138 }
139 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
140 return err
141 }
142 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
143 return err
144 }
145 if err = addTimeOffsetBuild(stack, c); err != nil {
146 return err
147 }
148 if err = addUserAgentRetryMode(stack, options); err != nil {
149 return err
150 }
151 if err = addCredentialSource(stack, options); err != nil {
152 return err
153 }
154 if err = addOpRegisterContainerImageValidationMiddleware(stack); err != nil {
155 return err
156 }
157 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRegisterContainerImage(options.Region), middleware.Before); err != nil {
158 return err
159 }
160 if err = addRecursionDetection(stack); err != nil {
161 return err
162 }
163 if err = addRequestIDRetrieverMiddleware(stack); err != nil {
164 return err
165 }
166 if err = addResponseErrorMiddleware(stack); err != nil {
167 return err
168 }
169 if err = addRequestResponseLogging(stack, options); err != nil {
170 return err
171 }
172 if err = addDisableHTTPSMiddleware(stack, options); err != nil {
173 return err
174 }
175 if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
176 return err
177 }
178 if err = addInterceptAttempt(stack, options); err != nil {
179 return err
180 }
181 if err = addInterceptors(stack, options); err != nil {
182 return err
183 }
184 return nil
185 }
186
187 func newServiceMetadataMiddleware_opRegisterContainerImage(region string) *awsmiddleware.RegisterServiceMetadata {
188 return &awsmiddleware.RegisterServiceMetadata{
189 Region: region,
190 ServiceID: ServiceID,
191 OperationName: "RegisterContainerImage",
192 }
193 }
194