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// Creates an Amazon Lightsail container service. A Lightsail container service is
15// a compute resource to which you can deploy containers. For more information, see
16// Container services in Amazon Lightsail
17// (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-container-services)
18// in the Lightsail Dev Guide.
19func (c *Client) CreateContainerService(ctx context.Context, params *CreateContainerServiceInput, optFns ...func(*Options)) (*CreateContainerServiceOutput, error) {
20	if params == nil {
21		params = &CreateContainerServiceInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "CreateContainerService", params, optFns, addOperationCreateContainerServiceMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*CreateContainerServiceOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type CreateContainerServiceInput struct {
35
36	// The power specification for the container service. The power specifies the
37	// amount of memory, vCPUs, and base monthly cost of each node of the container
38	// service. The power and scale of a container service makes up its configured
39	// capacity. To determine the monthly price of your container service, multiply the
40	// base price of the power with the scale (the number of nodes) of the service. Use
41	// the GetContainerServicePowers action to get a list of power options that you can
42	// specify using this parameter, and their base monthly cost.
43	//
44	// This member is required.
45	Power types.ContainerServicePowerName
46
47	// The scale specification for the container service. The scale specifies the
48	// allocated compute nodes of the container service. The power and scale of a
49	// container service makes up its configured capacity. To determine the monthly
50	// price of your container service, multiply the base price of the power with the
51	// scale (the number of nodes) of the service.
52	//
53	// This member is required.
54	Scale *int32
55
56	// The name for the container service. The name that you specify for your container
57	// service will make up part of its default domain. The default domain of a
58	// container service is typically https://...cs.amazonlightsail.com. If the name of
59	// your container service is container-service-1, and it's located in the US East
60	// (Ohio) AWS region (us-east-2), then the domain for your container service will
61	// be like the following example:
62	// https://container-service-1.ur4EXAMPLE2uq.us-east-2.cs.amazonlightsail.com The
63	// following are the requirements for container service names:
64	//
65	// * Must be unique
66	// within each AWS Region in your Lightsail account.
67	//
68	// * Must contain 1 to 63
69	// characters.
70	//
71	// * Must contain only alphanumeric characters and hyphens.
72	//
73	// * A
74	// hyphen (-) can separate words but cannot be at the start or end of the name.
75	//
76	// This member is required.
77	ServiceName *string
78
79	// An object that describes a deployment for the container service. A deployment
80	// specifies the containers that will be launched on the container service and
81	// their settings, such as the ports to open, the environment variables to apply,
82	// and the launch command to run. It also specifies the container that will serve
83	// as the public endpoint of the deployment and its settings, such as the HTTP or
84	// HTTPS port to use, and the health check configuration.
85	Deployment *types.ContainerServiceDeploymentRequest
86
87	// The public domain names to use with the container service, such as example.com
88	// and www.example.com. You can specify up to four public domain names for a
89	// container service. The domain names that you specify are used when you create a
90	// deployment with a container configured as the public endpoint of your container
91	// service. If you don't specify public domain names, then you can use the default
92	// domain of the container service. You must create and validate an SSL/TLS
93	// certificate before you can use public domain names with your container service.
94	// Use the CreateCertificate action to create a certificate for the public domain
95	// names you want to use with your container service. You can specify public domain
96	// names using a string to array map as shown in the example later on this page.
97	PublicDomainNames map[string][]string
98
99	// The tag keys and optional values for the container service. For more information
100	// about tags in Lightsail, see the Lightsail Dev Guide
101	// (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags).
102	Tags []types.Tag
103}
104
105type CreateContainerServiceOutput struct {
106
107	// An object that describes a container service.
108	ContainerService *types.ContainerService
109
110	// Metadata pertaining to the operation's result.
111	ResultMetadata middleware.Metadata
112}
113
114func addOperationCreateContainerServiceMiddlewares(stack *middleware.Stack, options Options) (err error) {
115	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateContainerService{}, middleware.After)
116	if err != nil {
117		return err
118	}
119	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateContainerService{}, middleware.After)
120	if err != nil {
121		return err
122	}
123	if err = addSetLoggerMiddleware(stack, options); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
127		return err
128	}
129	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addResolveEndpointMiddleware(stack, options); err != nil {
133		return err
134	}
135	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
136		return err
137	}
138	if err = addRetryMiddlewares(stack, options); err != nil {
139		return err
140	}
141	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
142		return err
143	}
144	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
145		return err
146	}
147	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
148		return err
149	}
150	if err = addClientUserAgent(stack); err != nil {
151		return err
152	}
153	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
154		return err
155	}
156	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
157		return err
158	}
159	if err = addOpCreateContainerServiceValidationMiddleware(stack); err != nil {
160		return err
161	}
162	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateContainerService(options.Region), middleware.Before); err != nil {
163		return err
164	}
165	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
166		return err
167	}
168	if err = addResponseErrorMiddleware(stack); err != nil {
169		return err
170	}
171	if err = addRequestResponseLogging(stack, options); err != nil {
172		return err
173	}
174	return nil
175}
176
177func newServiceMetadataMiddleware_opCreateContainerService(region string) *awsmiddleware.RegisterServiceMetadata {
178	return &awsmiddleware.RegisterServiceMetadata{
179		Region:        region,
180		ServiceID:     ServiceID,
181		SigningName:   "lightsail",
182		OperationName: "CreateContainerService",
183	}
184}
185