api_op_GetDistributionBundles.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  // Returns the bundles that can be applied to your Amazon Lightsail content
  15  // delivery network (CDN) distributions.
  16  //
  17  // A distribution bundle specifies the monthly network transfer quota and monthly
  18  // cost of your distribution.
  19  func (c *Client) GetDistributionBundles(ctx context.Context, params *GetDistributionBundlesInput, optFns ...func(*Options)) (*GetDistributionBundlesOutput, error) {
  20  	if params == nil {
  21  		params = &GetDistributionBundlesInput{}
  22  	}
  23  
  24  	result, metadata, err := c.invokeOperation(ctx, "GetDistributionBundles", params, optFns, c.addOperationGetDistributionBundlesMiddlewares)
  25  	if err != nil {
  26  		return nil, err
  27  	}
  28  
  29  	out := result.(*GetDistributionBundlesOutput)
  30  	out.ResultMetadata = metadata
  31  	return out, nil
  32  }
  33  
  34  type GetDistributionBundlesInput struct {
  35  	noSmithyDocumentSerde
  36  }
  37  
  38  type GetDistributionBundlesOutput struct {
  39  
  40  	// An object that describes a distribution bundle.
  41  	Bundles []types.DistributionBundle
  42  
  43  	// Metadata pertaining to the operation's result.
  44  	ResultMetadata middleware.Metadata
  45  
  46  	noSmithyDocumentSerde
  47  }
  48  
  49  func (c *Client) addOperationGetDistributionBundlesMiddlewares(stack *middleware.Stack, options Options) (err error) {
  50  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  51  		return err
  52  	}
  53  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDistributionBundles{}, middleware.After)
  54  	if err != nil {
  55  		return err
  56  	}
  57  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDistributionBundles{}, middleware.After)
  58  	if err != nil {
  59  		return err
  60  	}
  61  	if err := addProtocolFinalizerMiddlewares(stack, options, "GetDistributionBundles"); err != nil {
  62  		return fmt.Errorf("add protocol finalizers: %v", err)
  63  	}
  64  
  65  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  66  		return err
  67  	}
  68  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  69  		return err
  70  	}
  71  	if err = addClientRequestID(stack); err != nil {
  72  		return err
  73  	}
  74  	if err = addComputeContentLength(stack); err != nil {
  75  		return err
  76  	}
  77  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
  78  		return err
  79  	}
  80  	if err = addComputePayloadSHA256(stack); err != nil {
  81  		return err
  82  	}
  83  	if err = addRetry(stack, options); err != nil {
  84  		return err
  85  	}
  86  	if err = addRawResponseToMetadata(stack); err != nil {
  87  		return err
  88  	}
  89  	if err = addRecordResponseTiming(stack); err != nil {
  90  		return err
  91  	}
  92  	if err = addSpanRetryLoop(stack, options); err != nil {
  93  		return err
  94  	}
  95  	if err = addClientUserAgent(stack, options); err != nil {
  96  		return err
  97  	}
  98  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
  99  		return err
 100  	}
 101  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 102  		return err
 103  	}
 104  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 105  		return err
 106  	}
 107  	if err = addTimeOffsetBuild(stack, c); err != nil {
 108  		return err
 109  	}
 110  	if err = addUserAgentRetryMode(stack, options); err != nil {
 111  		return err
 112  	}
 113  	if err = addCredentialSource(stack, options); err != nil {
 114  		return err
 115  	}
 116  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDistributionBundles(options.Region), middleware.Before); err != nil {
 117  		return err
 118  	}
 119  	if err = addRecursionDetection(stack); err != nil {
 120  		return err
 121  	}
 122  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 123  		return err
 124  	}
 125  	if err = addResponseErrorMiddleware(stack); err != nil {
 126  		return err
 127  	}
 128  	if err = addRequestResponseLogging(stack, options); err != nil {
 129  		return err
 130  	}
 131  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 132  		return err
 133  	}
 134  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 135  		return err
 136  	}
 137  	if err = addInterceptAttempt(stack, options); err != nil {
 138  		return err
 139  	}
 140  	if err = addInterceptors(stack, options); err != nil {
 141  		return err
 142  	}
 143  	return nil
 144  }
 145  
 146  func newServiceMetadataMiddleware_opGetDistributionBundles(region string) *awsmiddleware.RegisterServiceMetadata {
 147  	return &awsmiddleware.RegisterServiceMetadata{
 148  		Region:        region,
 149  		ServiceID:     ServiceID,
 150  		OperationName: "GetDistributionBundles",
 151  	}
 152  }
 153