api_op_CreateContainerServiceRegistryLogin.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 temporary set of log in credentials that you can use to log in to the
  15  // Docker process on your local machine. After you're logged in, you can use the
  16  // native Docker commands to push your local container images to the container
  17  // image registry of your Amazon Lightsail account so that you can use them with
  18  // your Lightsail container service. The log in credentials expire 12 hours after
  19  // they are created, at which point you will need to create a new set of log in
  20  // credentials.
  21  //
  22  // You can only push container images to the container service registry of your
  23  // Lightsail account. You cannot pull container images or perform any other
  24  // container image management actions on the container service registry.
  25  //
  26  // After you push your container images to the container image registry of your
  27  // Lightsail account, use the RegisterContainerImage action to register the pushed
  28  // images to a specific Lightsail container service.
  29  //
  30  // This action is not required if you install and use the Lightsail Control
  31  // (lightsailctl) plugin to push container images to your Lightsail container
  32  // service. For more information, see [Pushing and managing container images on your Amazon Lightsail container services]in the Amazon Lightsail Developer Guide.
  33  //
  34  // [Pushing and managing container images on your Amazon Lightsail container services]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-pushing-container-images
  35  func (c *Client) CreateContainerServiceRegistryLogin(ctx context.Context, params *CreateContainerServiceRegistryLoginInput, optFns ...func(*Options)) (*CreateContainerServiceRegistryLoginOutput, error) {
  36  	if params == nil {
  37  		params = &CreateContainerServiceRegistryLoginInput{}
  38  	}
  39  
  40  	result, metadata, err := c.invokeOperation(ctx, "CreateContainerServiceRegistryLogin", params, optFns, c.addOperationCreateContainerServiceRegistryLoginMiddlewares)
  41  	if err != nil {
  42  		return nil, err
  43  	}
  44  
  45  	out := result.(*CreateContainerServiceRegistryLoginOutput)
  46  	out.ResultMetadata = metadata
  47  	return out, nil
  48  }
  49  
  50  type CreateContainerServiceRegistryLoginInput struct {
  51  	noSmithyDocumentSerde
  52  }
  53  
  54  type CreateContainerServiceRegistryLoginOutput struct {
  55  
  56  	// An object that describes the log in information for the container service
  57  	// registry of your Lightsail account.
  58  	RegistryLogin *types.ContainerServiceRegistryLogin
  59  
  60  	// Metadata pertaining to the operation's result.
  61  	ResultMetadata middleware.Metadata
  62  
  63  	noSmithyDocumentSerde
  64  }
  65  
  66  func (c *Client) addOperationCreateContainerServiceRegistryLoginMiddlewares(stack *middleware.Stack, options Options) (err error) {
  67  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  68  		return err
  69  	}
  70  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateContainerServiceRegistryLogin{}, middleware.After)
  71  	if err != nil {
  72  		return err
  73  	}
  74  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateContainerServiceRegistryLogin{}, middleware.After)
  75  	if err != nil {
  76  		return err
  77  	}
  78  	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateContainerServiceRegistryLogin"); err != nil {
  79  		return fmt.Errorf("add protocol finalizers: %v", err)
  80  	}
  81  
  82  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  83  		return err
  84  	}
  85  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  86  		return err
  87  	}
  88  	if err = addClientRequestID(stack); err != nil {
  89  		return err
  90  	}
  91  	if err = addComputeContentLength(stack); err != nil {
  92  		return err
  93  	}
  94  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
  95  		return err
  96  	}
  97  	if err = addComputePayloadSHA256(stack); err != nil {
  98  		return err
  99  	}
 100  	if err = addRetry(stack, options); err != nil {
 101  		return err
 102  	}
 103  	if err = addRawResponseToMetadata(stack); err != nil {
 104  		return err
 105  	}
 106  	if err = addRecordResponseTiming(stack); err != nil {
 107  		return err
 108  	}
 109  	if err = addSpanRetryLoop(stack, options); err != nil {
 110  		return err
 111  	}
 112  	if err = addClientUserAgent(stack, options); err != nil {
 113  		return err
 114  	}
 115  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 116  		return err
 117  	}
 118  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 119  		return err
 120  	}
 121  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 122  		return err
 123  	}
 124  	if err = addTimeOffsetBuild(stack, c); err != nil {
 125  		return err
 126  	}
 127  	if err = addUserAgentRetryMode(stack, options); err != nil {
 128  		return err
 129  	}
 130  	if err = addCredentialSource(stack, options); err != nil {
 131  		return err
 132  	}
 133  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateContainerServiceRegistryLogin(options.Region), middleware.Before); err != nil {
 134  		return err
 135  	}
 136  	if err = addRecursionDetection(stack); err != nil {
 137  		return err
 138  	}
 139  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 140  		return err
 141  	}
 142  	if err = addResponseErrorMiddleware(stack); err != nil {
 143  		return err
 144  	}
 145  	if err = addRequestResponseLogging(stack, options); err != nil {
 146  		return err
 147  	}
 148  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 149  		return err
 150  	}
 151  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 152  		return err
 153  	}
 154  	if err = addInterceptAttempt(stack, options); err != nil {
 155  		return err
 156  	}
 157  	if err = addInterceptors(stack, options); err != nil {
 158  		return err
 159  	}
 160  	return nil
 161  }
 162  
 163  func newServiceMetadataMiddleware_opCreateContainerServiceRegistryLogin(region string) *awsmiddleware.RegisterServiceMetadata {
 164  	return &awsmiddleware.RegisterServiceMetadata{
 165  		Region:        region,
 166  		ServiceID:     ServiceID,
 167  		OperationName: "CreateContainerServiceRegistryLogin",
 168  	}
 169  }
 170