api_op_AttachLoadBalancerTlsCertificate.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  // Attaches a Transport Layer Security (TLS) certificate to your load balancer.
  15  // TLS is just an updated, more secure version of Secure Socket Layer (SSL).
  16  //
  17  // Once you create and validate your certificate, you can attach it to your load
  18  // balancer. You can also use this API to rotate the certificates on your account.
  19  // Use the AttachLoadBalancerTlsCertificate action with the non-attached
  20  // certificate, and it will replace the existing one and become the attached
  21  // certificate.
  22  //
  23  // The AttachLoadBalancerTlsCertificate operation supports tag-based access
  24  // control via resource tags applied to the resource identified by load balancer
  25  // name . For more information, see the [Amazon Lightsail Developer Guide].
  26  //
  27  // [Amazon Lightsail Developer Guide]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-controlling-access-using-tags
  28  func (c *Client) AttachLoadBalancerTlsCertificate(ctx context.Context, params *AttachLoadBalancerTlsCertificateInput, optFns ...func(*Options)) (*AttachLoadBalancerTlsCertificateOutput, error) {
  29  	if params == nil {
  30  		params = &AttachLoadBalancerTlsCertificateInput{}
  31  	}
  32  
  33  	result, metadata, err := c.invokeOperation(ctx, "AttachLoadBalancerTlsCertificate", params, optFns, c.addOperationAttachLoadBalancerTlsCertificateMiddlewares)
  34  	if err != nil {
  35  		return nil, err
  36  	}
  37  
  38  	out := result.(*AttachLoadBalancerTlsCertificateOutput)
  39  	out.ResultMetadata = metadata
  40  	return out, nil
  41  }
  42  
  43  type AttachLoadBalancerTlsCertificateInput struct {
  44  
  45  	// The name of your SSL/TLS certificate.
  46  	//
  47  	// This member is required.
  48  	CertificateName *string
  49  
  50  	// The name of the load balancer to which you want to associate the SSL/TLS
  51  	// certificate.
  52  	//
  53  	// This member is required.
  54  	LoadBalancerName *string
  55  
  56  	noSmithyDocumentSerde
  57  }
  58  
  59  type AttachLoadBalancerTlsCertificateOutput struct {
  60  
  61  	// An array of objects that describe the result of the action, such as the status
  62  	// of the request, the timestamp of the request, and the resources affected by the
  63  	// request.
  64  	//
  65  	// These SSL/TLS certificates are only usable by Lightsail load balancers. You
  66  	// can't get the certificate and use it for another purpose.
  67  	Operations []types.Operation
  68  
  69  	// Metadata pertaining to the operation's result.
  70  	ResultMetadata middleware.Metadata
  71  
  72  	noSmithyDocumentSerde
  73  }
  74  
  75  func (c *Client) addOperationAttachLoadBalancerTlsCertificateMiddlewares(stack *middleware.Stack, options Options) (err error) {
  76  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  77  		return err
  78  	}
  79  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpAttachLoadBalancerTlsCertificate{}, middleware.After)
  80  	if err != nil {
  81  		return err
  82  	}
  83  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAttachLoadBalancerTlsCertificate{}, middleware.After)
  84  	if err != nil {
  85  		return err
  86  	}
  87  	if err := addProtocolFinalizerMiddlewares(stack, options, "AttachLoadBalancerTlsCertificate"); err != nil {
  88  		return fmt.Errorf("add protocol finalizers: %v", err)
  89  	}
  90  
  91  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  92  		return err
  93  	}
  94  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  95  		return err
  96  	}
  97  	if err = addClientRequestID(stack); err != nil {
  98  		return err
  99  	}
 100  	if err = addComputeContentLength(stack); err != nil {
 101  		return err
 102  	}
 103  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 104  		return err
 105  	}
 106  	if err = addComputePayloadSHA256(stack); err != nil {
 107  		return err
 108  	}
 109  	if err = addRetry(stack, options); err != nil {
 110  		return err
 111  	}
 112  	if err = addRawResponseToMetadata(stack); err != nil {
 113  		return err
 114  	}
 115  	if err = addRecordResponseTiming(stack); err != nil {
 116  		return err
 117  	}
 118  	if err = addSpanRetryLoop(stack, options); err != nil {
 119  		return err
 120  	}
 121  	if err = addClientUserAgent(stack, options); err != nil {
 122  		return err
 123  	}
 124  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 125  		return err
 126  	}
 127  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 128  		return err
 129  	}
 130  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 131  		return err
 132  	}
 133  	if err = addTimeOffsetBuild(stack, c); err != nil {
 134  		return err
 135  	}
 136  	if err = addUserAgentRetryMode(stack, options); err != nil {
 137  		return err
 138  	}
 139  	if err = addCredentialSource(stack, options); err != nil {
 140  		return err
 141  	}
 142  	if err = addOpAttachLoadBalancerTlsCertificateValidationMiddleware(stack); err != nil {
 143  		return err
 144  	}
 145  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAttachLoadBalancerTlsCertificate(options.Region), middleware.Before); err != nil {
 146  		return err
 147  	}
 148  	if err = addRecursionDetection(stack); err != nil {
 149  		return err
 150  	}
 151  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 152  		return err
 153  	}
 154  	if err = addResponseErrorMiddleware(stack); err != nil {
 155  		return err
 156  	}
 157  	if err = addRequestResponseLogging(stack, options); err != nil {
 158  		return err
 159  	}
 160  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 161  		return err
 162  	}
 163  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 164  		return err
 165  	}
 166  	if err = addInterceptAttempt(stack, options); err != nil {
 167  		return err
 168  	}
 169  	if err = addInterceptors(stack, options); err != nil {
 170  		return err
 171  	}
 172  	return nil
 173  }
 174  
 175  func newServiceMetadataMiddleware_opAttachLoadBalancerTlsCertificate(region string) *awsmiddleware.RegisterServiceMetadata {
 176  	return &awsmiddleware.RegisterServiceMetadata{
 177  		Region:        region,
 178  		ServiceID:     ServiceID,
 179  		OperationName: "AttachLoadBalancerTlsCertificate",
 180  	}
 181  }
 182