api_op_DetachCertificateFromDistribution.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  // Detaches an SSL/TLS certificate from your Amazon Lightsail content delivery
  15  // network (CDN) distribution.
  16  //
  17  // After the certificate is detached, your distribution stops accepting traffic
  18  // for all of the domains that are associated with the certificate.
  19  func (c *Client) DetachCertificateFromDistribution(ctx context.Context, params *DetachCertificateFromDistributionInput, optFns ...func(*Options)) (*DetachCertificateFromDistributionOutput, error) {
  20  	if params == nil {
  21  		params = &DetachCertificateFromDistributionInput{}
  22  	}
  23  
  24  	result, metadata, err := c.invokeOperation(ctx, "DetachCertificateFromDistribution", params, optFns, c.addOperationDetachCertificateFromDistributionMiddlewares)
  25  	if err != nil {
  26  		return nil, err
  27  	}
  28  
  29  	out := result.(*DetachCertificateFromDistributionOutput)
  30  	out.ResultMetadata = metadata
  31  	return out, nil
  32  }
  33  
  34  type DetachCertificateFromDistributionInput struct {
  35  
  36  	// The name of the distribution from which to detach the certificate.
  37  	//
  38  	// Use the GetDistributions action to get a list of distribution names that you
  39  	// can specify.
  40  	//
  41  	// This member is required.
  42  	DistributionName *string
  43  
  44  	noSmithyDocumentSerde
  45  }
  46  
  47  type DetachCertificateFromDistributionOutput struct {
  48  
  49  	// An object that describes the result of the action, such as the status of the
  50  	// request, the timestamp of the request, and the resources affected by the
  51  	// request.
  52  	Operation *types.Operation
  53  
  54  	// Metadata pertaining to the operation's result.
  55  	ResultMetadata middleware.Metadata
  56  
  57  	noSmithyDocumentSerde
  58  }
  59  
  60  func (c *Client) addOperationDetachCertificateFromDistributionMiddlewares(stack *middleware.Stack, options Options) (err error) {
  61  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  62  		return err
  63  	}
  64  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetachCertificateFromDistribution{}, middleware.After)
  65  	if err != nil {
  66  		return err
  67  	}
  68  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetachCertificateFromDistribution{}, middleware.After)
  69  	if err != nil {
  70  		return err
  71  	}
  72  	if err := addProtocolFinalizerMiddlewares(stack, options, "DetachCertificateFromDistribution"); err != nil {
  73  		return fmt.Errorf("add protocol finalizers: %v", err)
  74  	}
  75  
  76  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  77  		return err
  78  	}
  79  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  80  		return err
  81  	}
  82  	if err = addClientRequestID(stack); err != nil {
  83  		return err
  84  	}
  85  	if err = addComputeContentLength(stack); err != nil {
  86  		return err
  87  	}
  88  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
  89  		return err
  90  	}
  91  	if err = addComputePayloadSHA256(stack); err != nil {
  92  		return err
  93  	}
  94  	if err = addRetry(stack, options); err != nil {
  95  		return err
  96  	}
  97  	if err = addRawResponseToMetadata(stack); err != nil {
  98  		return err
  99  	}
 100  	if err = addRecordResponseTiming(stack); err != nil {
 101  		return err
 102  	}
 103  	if err = addSpanRetryLoop(stack, options); err != nil {
 104  		return err
 105  	}
 106  	if err = addClientUserAgent(stack, options); err != nil {
 107  		return err
 108  	}
 109  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 110  		return err
 111  	}
 112  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 113  		return err
 114  	}
 115  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 116  		return err
 117  	}
 118  	if err = addTimeOffsetBuild(stack, c); err != nil {
 119  		return err
 120  	}
 121  	if err = addUserAgentRetryMode(stack, options); err != nil {
 122  		return err
 123  	}
 124  	if err = addCredentialSource(stack, options); err != nil {
 125  		return err
 126  	}
 127  	if err = addOpDetachCertificateFromDistributionValidationMiddleware(stack); err != nil {
 128  		return err
 129  	}
 130  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetachCertificateFromDistribution(options.Region), middleware.Before); err != nil {
 131  		return err
 132  	}
 133  	if err = addRecursionDetection(stack); err != nil {
 134  		return err
 135  	}
 136  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 137  		return err
 138  	}
 139  	if err = addResponseErrorMiddleware(stack); err != nil {
 140  		return err
 141  	}
 142  	if err = addRequestResponseLogging(stack, options); err != nil {
 143  		return err
 144  	}
 145  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 146  		return err
 147  	}
 148  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 149  		return err
 150  	}
 151  	if err = addInterceptAttempt(stack, options); err != nil {
 152  		return err
 153  	}
 154  	if err = addInterceptors(stack, options); err != nil {
 155  		return err
 156  	}
 157  	return nil
 158  }
 159  
 160  func newServiceMetadataMiddleware_opDetachCertificateFromDistribution(region string) *awsmiddleware.RegisterServiceMetadata {
 161  	return &awsmiddleware.RegisterServiceMetadata{
 162  		Region:        region,
 163  		ServiceID:     ServiceID,
 164  		OperationName: "DetachCertificateFromDistribution",
 165  	}
 166  }
 167