api_op_CreateContainerService.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  // Creates an Amazon Lightsail container service.
  15  //
  16  // A Lightsail container service is a compute resource to which you can deploy
  17  // containers. For more information, see [Container services in Amazon Lightsail]in the Lightsail Dev Guide.
  18  //
  19  // [Container services in Amazon Lightsail]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-container-services
  20  func (c *Client) CreateContainerService(ctx context.Context, params *CreateContainerServiceInput, optFns ...func(*Options)) (*CreateContainerServiceOutput, error) {
  21  	if params == nil {
  22  		params = &CreateContainerServiceInput{}
  23  	}
  24  
  25  	result, metadata, err := c.invokeOperation(ctx, "CreateContainerService", params, optFns, c.addOperationCreateContainerServiceMiddlewares)
  26  	if err != nil {
  27  		return nil, err
  28  	}
  29  
  30  	out := result.(*CreateContainerServiceOutput)
  31  	out.ResultMetadata = metadata
  32  	return out, nil
  33  }
  34  
  35  type CreateContainerServiceInput struct {
  36  
  37  	// The power specification for the container service.
  38  	//
  39  	// The power specifies the amount of memory, vCPUs, and base monthly cost of each
  40  	// node of the container service. The power and scale of a container service makes
  41  	// up its configured capacity. To determine the monthly price of your container
  42  	// service, multiply the base price of the power with the scale (the number of
  43  	// nodes) of the service.
  44  	//
  45  	// Use the GetContainerServicePowers action to get a list of power options that
  46  	// you can specify using this parameter, and their base monthly cost.
  47  	//
  48  	// This member is required.
  49  	Power types.ContainerServicePowerName
  50  
  51  	// The scale specification for the container service.
  52  	//
  53  	// The scale specifies the allocated compute nodes of the container service. The
  54  	// power and scale of a container service makes up its configured capacity. To
  55  	// determine the monthly price of your container service, multiply the base price
  56  	// of the power with the scale (the number of nodes) of the service.
  57  	//
  58  	// This member is required.
  59  	Scale *int32
  60  
  61  	// The name for the container service.
  62  	//
  63  	// The name that you specify for your container service will make up part of its
  64  	// default domain. The default domain of a container service is typically
  65  	// https://...cs.amazonlightsail.com . If the name of your container service is
  66  	// container-service-1 , and it's located in the US East (Ohio) Amazon Web Services
  67  	// Region ( us-east-2 ), then the domain for your container service will be like
  68  	// the following example:
  69  	// https://container-service-1.ur4EXAMPLE2uq.us-east-2.cs.amazonlightsail.com
  70  	//
  71  	// The following are the requirements for container service names:
  72  	//
  73  	//   - Must be unique within each Amazon Web Services Region in your Lightsail
  74  	//   account.
  75  	//
  76  	//   - Must contain 1 to 63 characters.
  77  	//
  78  	//   - Must contain only alphanumeric characters and hyphens.
  79  	//
  80  	//   - A hyphen (-) can separate words but cannot be at the start or end of the
  81  	//   name.
  82  	//
  83  	// This member is required.
  84  	ServiceName *string
  85  
  86  	// An object that describes a deployment for the container service.
  87  	//
  88  	// A deployment specifies the containers that will be launched on the container
  89  	// service and their settings, such as the ports to open, the environment variables
  90  	// to apply, and the launch command to run. It also specifies the container that
  91  	// will serve as the public endpoint of the deployment and its settings, such as
  92  	// the HTTP or HTTPS port to use, and the health check configuration.
  93  	Deployment *types.ContainerServiceDeploymentRequest
  94  
  95  	// An object to describe the configuration for the container service to access
  96  	// private container image repositories, such as Amazon Elastic Container Registry
  97  	// (Amazon ECR) private repositories.
  98  	//
  99  	// For more information, see [Configuring access to an Amazon ECR private repository for an Amazon Lightsail container service] in the Amazon Lightsail Developer Guide.
 100  	//
 101  	// [Configuring access to an Amazon ECR private repository for an Amazon Lightsail container service]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-container-service-ecr-private-repo-access
 102  	PrivateRegistryAccess *types.PrivateRegistryAccessRequest
 103  
 104  	// The public domain names to use with the container service, such as example.com
 105  	// and www.example.com .
 106  	//
 107  	// You can specify up to four public domain names for a container service. The
 108  	// domain names that you specify are used when you create a deployment with a
 109  	// container configured as the public endpoint of your container service.
 110  	//
 111  	// If you don't specify public domain names, then you can use the default domain
 112  	// of the container service.
 113  	//
 114  	// You must create and validate an SSL/TLS certificate before you can use public
 115  	// domain names with your container service. Use the CreateCertificate action to
 116  	// create a certificate for the public domain names you want to use with your
 117  	// container service.
 118  	//
 119  	// You can specify public domain names using a string to array map as shown in the
 120  	// example later on this page.
 121  	PublicDomainNames map[string][]string
 122  
 123  	// The tag keys and optional values to add to the container service during create.
 124  	//
 125  	// Use the TagResource action to tag a resource after it's created.
 126  	//
 127  	// For more information about tags in Lightsail, see the [Amazon Lightsail Developer Guide].
 128  	//
 129  	// [Amazon Lightsail Developer Guide]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-tags
 130  	Tags []types.Tag
 131  
 132  	noSmithyDocumentSerde
 133  }
 134  
 135  type CreateContainerServiceOutput struct {
 136  
 137  	// An object that describes a container service.
 138  	ContainerService *types.ContainerService
 139  
 140  	// Metadata pertaining to the operation's result.
 141  	ResultMetadata middleware.Metadata
 142  
 143  	noSmithyDocumentSerde
 144  }
 145  
 146  func (c *Client) addOperationCreateContainerServiceMiddlewares(stack *middleware.Stack, options Options) (err error) {
 147  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
 148  		return err
 149  	}
 150  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateContainerService{}, middleware.After)
 151  	if err != nil {
 152  		return err
 153  	}
 154  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateContainerService{}, middleware.After)
 155  	if err != nil {
 156  		return err
 157  	}
 158  	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateContainerService"); err != nil {
 159  		return fmt.Errorf("add protocol finalizers: %v", err)
 160  	}
 161  
 162  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
 163  		return err
 164  	}
 165  	if err = addSetLoggerMiddleware(stack, options); err != nil {
 166  		return err
 167  	}
 168  	if err = addClientRequestID(stack); err != nil {
 169  		return err
 170  	}
 171  	if err = addComputeContentLength(stack); err != nil {
 172  		return err
 173  	}
 174  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 175  		return err
 176  	}
 177  	if err = addComputePayloadSHA256(stack); err != nil {
 178  		return err
 179  	}
 180  	if err = addRetry(stack, options); err != nil {
 181  		return err
 182  	}
 183  	if err = addRawResponseToMetadata(stack); err != nil {
 184  		return err
 185  	}
 186  	if err = addRecordResponseTiming(stack); err != nil {
 187  		return err
 188  	}
 189  	if err = addSpanRetryLoop(stack, options); err != nil {
 190  		return err
 191  	}
 192  	if err = addClientUserAgent(stack, options); err != nil {
 193  		return err
 194  	}
 195  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 196  		return err
 197  	}
 198  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 199  		return err
 200  	}
 201  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 202  		return err
 203  	}
 204  	if err = addTimeOffsetBuild(stack, c); err != nil {
 205  		return err
 206  	}
 207  	if err = addUserAgentRetryMode(stack, options); err != nil {
 208  		return err
 209  	}
 210  	if err = addCredentialSource(stack, options); err != nil {
 211  		return err
 212  	}
 213  	if err = addOpCreateContainerServiceValidationMiddleware(stack); err != nil {
 214  		return err
 215  	}
 216  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateContainerService(options.Region), middleware.Before); err != nil {
 217  		return err
 218  	}
 219  	if err = addRecursionDetection(stack); err != nil {
 220  		return err
 221  	}
 222  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 223  		return err
 224  	}
 225  	if err = addResponseErrorMiddleware(stack); err != nil {
 226  		return err
 227  	}
 228  	if err = addRequestResponseLogging(stack, options); err != nil {
 229  		return err
 230  	}
 231  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 232  		return err
 233  	}
 234  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 235  		return err
 236  	}
 237  	if err = addInterceptAttempt(stack, options); err != nil {
 238  		return err
 239  	}
 240  	if err = addInterceptors(stack, options); err != nil {
 241  		return err
 242  	}
 243  	return nil
 244  }
 245  
 246  func newServiceMetadataMiddleware_opCreateContainerService(region string) *awsmiddleware.RegisterServiceMetadata {
 247  	return &awsmiddleware.RegisterServiceMetadata{
 248  		Region:        region,
 249  		ServiceID:     ServiceID,
 250  		OperationName: "CreateContainerService",
 251  	}
 252  }
 253