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