api_op_CreateContainerServiceDeployment.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 a deployment for your Amazon Lightsail container service.
  15  //
  16  // A deployment specifies the containers that will be launched on the container
  17  // service and their settings, such as the ports to open, the environment variables
  18  // to apply, and the launch command to run. It also specifies the container that
  19  // will serve as the public endpoint of the deployment and its settings, such as
  20  // the HTTP or HTTPS port to use, and the health check configuration.
  21  //
  22  // You can deploy containers to your container service using container images from
  23  // a public registry such as Amazon ECR Public, or from your local machine. For
  24  // more information, see [Creating container images for your Amazon Lightsail container services]in the Amazon Lightsail Developer Guide.
  25  //
  26  // [Creating container images for your Amazon Lightsail container services]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-creating-container-images
  27  func (c *Client) CreateContainerServiceDeployment(ctx context.Context, params *CreateContainerServiceDeploymentInput, optFns ...func(*Options)) (*CreateContainerServiceDeploymentOutput, error) {
  28  	if params == nil {
  29  		params = &CreateContainerServiceDeploymentInput{}
  30  	}
  31  
  32  	result, metadata, err := c.invokeOperation(ctx, "CreateContainerServiceDeployment", params, optFns, c.addOperationCreateContainerServiceDeploymentMiddlewares)
  33  	if err != nil {
  34  		return nil, err
  35  	}
  36  
  37  	out := result.(*CreateContainerServiceDeploymentOutput)
  38  	out.ResultMetadata = metadata
  39  	return out, nil
  40  }
  41  
  42  type CreateContainerServiceDeploymentInput struct {
  43  
  44  	// The name of the container service for which to create the deployment.
  45  	//
  46  	// This member is required.
  47  	ServiceName *string
  48  
  49  	// An object that describes the settings of the containers that will be launched
  50  	// on the container service.
  51  	Containers map[string]types.Container
  52  
  53  	// An object that describes the settings of the public endpoint for the container
  54  	// service.
  55  	PublicEndpoint *types.EndpointRequest
  56  
  57  	noSmithyDocumentSerde
  58  }
  59  
  60  type CreateContainerServiceDeploymentOutput struct {
  61  
  62  	// An object that describes a container service.
  63  	ContainerService *types.ContainerService
  64  
  65  	// Metadata pertaining to the operation's result.
  66  	ResultMetadata middleware.Metadata
  67  
  68  	noSmithyDocumentSerde
  69  }
  70  
  71  func (c *Client) addOperationCreateContainerServiceDeploymentMiddlewares(stack *middleware.Stack, options Options) (err error) {
  72  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  73  		return err
  74  	}
  75  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateContainerServiceDeployment{}, middleware.After)
  76  	if err != nil {
  77  		return err
  78  	}
  79  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateContainerServiceDeployment{}, middleware.After)
  80  	if err != nil {
  81  		return err
  82  	}
  83  	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateContainerServiceDeployment"); err != nil {
  84  		return fmt.Errorf("add protocol finalizers: %v", err)
  85  	}
  86  
  87  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  88  		return err
  89  	}
  90  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  91  		return err
  92  	}
  93  	if err = addClientRequestID(stack); err != nil {
  94  		return err
  95  	}
  96  	if err = addComputeContentLength(stack); err != nil {
  97  		return err
  98  	}
  99  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 100  		return err
 101  	}
 102  	if err = addComputePayloadSHA256(stack); err != nil {
 103  		return err
 104  	}
 105  	if err = addRetry(stack, options); err != nil {
 106  		return err
 107  	}
 108  	if err = addRawResponseToMetadata(stack); err != nil {
 109  		return err
 110  	}
 111  	if err = addRecordResponseTiming(stack); err != nil {
 112  		return err
 113  	}
 114  	if err = addSpanRetryLoop(stack, options); err != nil {
 115  		return err
 116  	}
 117  	if err = addClientUserAgent(stack, options); err != nil {
 118  		return err
 119  	}
 120  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 121  		return err
 122  	}
 123  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 124  		return err
 125  	}
 126  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 127  		return err
 128  	}
 129  	if err = addTimeOffsetBuild(stack, c); err != nil {
 130  		return err
 131  	}
 132  	if err = addUserAgentRetryMode(stack, options); err != nil {
 133  		return err
 134  	}
 135  	if err = addCredentialSource(stack, options); err != nil {
 136  		return err
 137  	}
 138  	if err = addOpCreateContainerServiceDeploymentValidationMiddleware(stack); err != nil {
 139  		return err
 140  	}
 141  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateContainerServiceDeployment(options.Region), middleware.Before); err != nil {
 142  		return err
 143  	}
 144  	if err = addRecursionDetection(stack); err != nil {
 145  		return err
 146  	}
 147  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 148  		return err
 149  	}
 150  	if err = addResponseErrorMiddleware(stack); err != nil {
 151  		return err
 152  	}
 153  	if err = addRequestResponseLogging(stack, options); err != nil {
 154  		return err
 155  	}
 156  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 157  		return err
 158  	}
 159  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 160  		return err
 161  	}
 162  	if err = addInterceptAttempt(stack, options); err != nil {
 163  		return err
 164  	}
 165  	if err = addInterceptors(stack, options); err != nil {
 166  		return err
 167  	}
 168  	return nil
 169  }
 170  
 171  func newServiceMetadataMiddleware_opCreateContainerServiceDeployment(region string) *awsmiddleware.RegisterServiceMetadata {
 172  	return &awsmiddleware.RegisterServiceMetadata{
 173  		Region:        region,
 174  		ServiceID:     ServiceID,
 175  		OperationName: "CreateContainerServiceDeployment",
 176  	}
 177  }
 178