1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package lightsail
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/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. This
15// action is not required if you install and use the Lightsail Control
16// (lightsailctl) plugin to push container images to your Lightsail container
17// service. For more information, see Pushing and managing container images on your
18// Amazon Lightsail container services
19// (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-pushing-container-images)
20// in the Amazon Lightsail Developer Guide.
21func (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
36type 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	// Use a descriptive label that you can use to track the different versions of your
45	// registered container images. Use the GetContainerImages action to return the
46	// container images registered to a Lightsail container service. The label is the
47	// portion of the following image name example:
48	//
49	// * :container-service-1..1
50	//
51	// If the
52	// name of your container service is mycontainerservice, and the label that you
53	// specify is mystaticwebsite, then the name of the registered container image will
54	// be :mycontainerservice.mystaticwebsite.1. The number at the end of these image
55	// name examples represents the version of the registered container image. If you
56	// push and register another container image to the same Lightsail container
57	// service, with the same label, then the version number for the new registered
58	// container image will be 2. If you push and register another container image, the
59	// version number will be 3, and so on.
60	//
61	// This member is required.
62	Label *string
63
64	// The name of the container service for which to register a container image.
65	//
66	// This member is required.
67	ServiceName *string
68
69	noSmithyDocumentSerde
70}
71
72type RegisterContainerImageOutput struct {
73
74	// Describes a container image that is registered to an Amazon Lightsail container
75	// service.
76	ContainerImage *types.ContainerImage
77
78	// Metadata pertaining to the operation's result.
79	ResultMetadata middleware.Metadata
80
81	noSmithyDocumentSerde
82}
83
84func (c *Client) addOperationRegisterContainerImageMiddlewares(stack *middleware.Stack, options Options) (err error) {
85	err = stack.Serialize.Add(&awsAwsjson11_serializeOpRegisterContainerImage{}, middleware.After)
86	if err != nil {
87		return err
88	}
89	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpRegisterContainerImage{}, middleware.After)
90	if err != nil {
91		return err
92	}
93	if err = addSetLoggerMiddleware(stack, options); err != nil {
94		return err
95	}
96	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
97		return err
98	}
99	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
100		return err
101	}
102	if err = addResolveEndpointMiddleware(stack, options); err != nil {
103		return err
104	}
105	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
106		return err
107	}
108	if err = addRetryMiddlewares(stack, options); err != nil {
109		return err
110	}
111	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
115		return err
116	}
117	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
118		return err
119	}
120	if err = addClientUserAgent(stack); err != nil {
121		return err
122	}
123	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
124		return err
125	}
126	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
127		return err
128	}
129	if err = addOpRegisterContainerImageValidationMiddleware(stack); err != nil {
130		return err
131	}
132	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRegisterContainerImage(options.Region), middleware.Before); err != nil {
133		return err
134	}
135	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addResponseErrorMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addRequestResponseLogging(stack, options); err != nil {
142		return err
143	}
144	return nil
145}
146
147func newServiceMetadataMiddleware_opRegisterContainerImage(region string) *awsmiddleware.RegisterServiceMetadata {
148	return &awsmiddleware.RegisterServiceMetadata{
149		Region:        region,
150		ServiceID:     ServiceID,
151		SigningName:   "lightsail",
152		OperationName: "RegisterContainerImage",
153	}
154}
155