api_op_UpdateDistributionBundle.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  // Updates the bundle of your Amazon Lightsail content delivery network (CDN)
  15  // distribution.
  16  //
  17  // A distribution bundle specifies the monthly network transfer quota and monthly
  18  // cost of your distribution.
  19  //
  20  // Update your distribution's bundle if your distribution is going over its
  21  // monthly network transfer quota and is incurring an overage fee.
  22  //
  23  // You can update your distribution's bundle only one time within your monthly
  24  // Amazon Web Services billing cycle. To determine if you can update your
  25  // distribution's bundle, use the GetDistributions action. The ableToUpdateBundle
  26  // parameter in the result will indicate whether you can currently update your
  27  // distribution's bundle.
  28  func (c *Client) UpdateDistributionBundle(ctx context.Context, params *UpdateDistributionBundleInput, optFns ...func(*Options)) (*UpdateDistributionBundleOutput, error) {
  29  	if params == nil {
  30  		params = &UpdateDistributionBundleInput{}
  31  	}
  32  
  33  	result, metadata, err := c.invokeOperation(ctx, "UpdateDistributionBundle", params, optFns, c.addOperationUpdateDistributionBundleMiddlewares)
  34  	if err != nil {
  35  		return nil, err
  36  	}
  37  
  38  	out := result.(*UpdateDistributionBundleOutput)
  39  	out.ResultMetadata = metadata
  40  	return out, nil
  41  }
  42  
  43  type UpdateDistributionBundleInput struct {
  44  
  45  	// The bundle ID of the new bundle to apply to your distribution.
  46  	//
  47  	// Use the GetDistributionBundles action to get a list of distribution bundle IDs
  48  	// that you can specify.
  49  	BundleId *string
  50  
  51  	// The name of the distribution for which to update the bundle.
  52  	//
  53  	// Use the GetDistributions action to get a list of distribution names that you
  54  	// can specify.
  55  	DistributionName *string
  56  
  57  	noSmithyDocumentSerde
  58  }
  59  
  60  type UpdateDistributionBundleOutput struct {
  61  
  62  	// An object that describes the result of the action, such as the status of the
  63  	// request, the timestamp of the request, and the resources affected by the
  64  	// request.
  65  	Operation *types.Operation
  66  
  67  	// Metadata pertaining to the operation's result.
  68  	ResultMetadata middleware.Metadata
  69  
  70  	noSmithyDocumentSerde
  71  }
  72  
  73  func (c *Client) addOperationUpdateDistributionBundleMiddlewares(stack *middleware.Stack, options Options) (err error) {
  74  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  75  		return err
  76  	}
  77  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateDistributionBundle{}, middleware.After)
  78  	if err != nil {
  79  		return err
  80  	}
  81  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateDistributionBundle{}, middleware.After)
  82  	if err != nil {
  83  		return err
  84  	}
  85  	if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateDistributionBundle"); err != nil {
  86  		return fmt.Errorf("add protocol finalizers: %v", err)
  87  	}
  88  
  89  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  90  		return err
  91  	}
  92  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  93  		return err
  94  	}
  95  	if err = addClientRequestID(stack); err != nil {
  96  		return err
  97  	}
  98  	if err = addComputeContentLength(stack); err != nil {
  99  		return err
 100  	}
 101  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 102  		return err
 103  	}
 104  	if err = addComputePayloadSHA256(stack); err != nil {
 105  		return err
 106  	}
 107  	if err = addRetry(stack, options); err != nil {
 108  		return err
 109  	}
 110  	if err = addRawResponseToMetadata(stack); err != nil {
 111  		return err
 112  	}
 113  	if err = addRecordResponseTiming(stack); err != nil {
 114  		return err
 115  	}
 116  	if err = addSpanRetryLoop(stack, options); err != nil {
 117  		return err
 118  	}
 119  	if err = addClientUserAgent(stack, options); err != nil {
 120  		return err
 121  	}
 122  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 123  		return err
 124  	}
 125  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 126  		return err
 127  	}
 128  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 129  		return err
 130  	}
 131  	if err = addTimeOffsetBuild(stack, c); err != nil {
 132  		return err
 133  	}
 134  	if err = addUserAgentRetryMode(stack, options); err != nil {
 135  		return err
 136  	}
 137  	if err = addCredentialSource(stack, options); err != nil {
 138  		return err
 139  	}
 140  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateDistributionBundle(options.Region), middleware.Before); err != nil {
 141  		return err
 142  	}
 143  	if err = addRecursionDetection(stack); err != nil {
 144  		return err
 145  	}
 146  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 147  		return err
 148  	}
 149  	if err = addResponseErrorMiddleware(stack); err != nil {
 150  		return err
 151  	}
 152  	if err = addRequestResponseLogging(stack, options); err != nil {
 153  		return err
 154  	}
 155  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 156  		return err
 157  	}
 158  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 159  		return err
 160  	}
 161  	if err = addInterceptAttempt(stack, options); err != nil {
 162  		return err
 163  	}
 164  	if err = addInterceptors(stack, options); err != nil {
 165  		return err
 166  	}
 167  	return nil
 168  }
 169  
 170  func newServiceMetadataMiddleware_opUpdateDistributionBundle(region string) *awsmiddleware.RegisterServiceMetadata {
 171  	return &awsmiddleware.RegisterServiceMetadata{
 172  		Region:        region,
 173  		ServiceID:     ServiceID,
 174  		OperationName: "UpdateDistributionBundle",
 175  	}
 176  }
 177