api_op_GetDistributionLatestCacheReset.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/smithy-go/middleware"
  10  	smithyhttp "github.com/aws/smithy-go/transport/http"
  11  	"time"
  12  )
  13  
  14  // Returns the timestamp and status of the last cache reset of a specific Amazon
  15  // Lightsail content delivery network (CDN) distribution.
  16  func (c *Client) GetDistributionLatestCacheReset(ctx context.Context, params *GetDistributionLatestCacheResetInput, optFns ...func(*Options)) (*GetDistributionLatestCacheResetOutput, error) {
  17  	if params == nil {
  18  		params = &GetDistributionLatestCacheResetInput{}
  19  	}
  20  
  21  	result, metadata, err := c.invokeOperation(ctx, "GetDistributionLatestCacheReset", params, optFns, c.addOperationGetDistributionLatestCacheResetMiddlewares)
  22  	if err != nil {
  23  		return nil, err
  24  	}
  25  
  26  	out := result.(*GetDistributionLatestCacheResetOutput)
  27  	out.ResultMetadata = metadata
  28  	return out, nil
  29  }
  30  
  31  type GetDistributionLatestCacheResetInput struct {
  32  
  33  	// The name of the distribution for which to return the timestamp of the last
  34  	// cache reset.
  35  	//
  36  	// Use the GetDistributions action to get a list of distribution names that you
  37  	// can specify.
  38  	//
  39  	// When omitted, the response includes the latest cache reset timestamp of all
  40  	// your distributions.
  41  	DistributionName *string
  42  
  43  	noSmithyDocumentSerde
  44  }
  45  
  46  type GetDistributionLatestCacheResetOutput struct {
  47  
  48  	// The timestamp of the last cache reset ( 1479734909.17 ) in Unix time format.
  49  	CreateTime *time.Time
  50  
  51  	// The status of the last cache reset.
  52  	Status *string
  53  
  54  	// Metadata pertaining to the operation's result.
  55  	ResultMetadata middleware.Metadata
  56  
  57  	noSmithyDocumentSerde
  58  }
  59  
  60  func (c *Client) addOperationGetDistributionLatestCacheResetMiddlewares(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_serializeOpGetDistributionLatestCacheReset{}, middleware.After)
  65  	if err != nil {
  66  		return err
  67  	}
  68  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDistributionLatestCacheReset{}, middleware.After)
  69  	if err != nil {
  70  		return err
  71  	}
  72  	if err := addProtocolFinalizerMiddlewares(stack, options, "GetDistributionLatestCacheReset"); 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 = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDistributionLatestCacheReset(options.Region), middleware.Before); err != nil {
 128  		return err
 129  	}
 130  	if err = addRecursionDetection(stack); err != nil {
 131  		return err
 132  	}
 133  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 134  		return err
 135  	}
 136  	if err = addResponseErrorMiddleware(stack); err != nil {
 137  		return err
 138  	}
 139  	if err = addRequestResponseLogging(stack, options); err != nil {
 140  		return err
 141  	}
 142  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 143  		return err
 144  	}
 145  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 146  		return err
 147  	}
 148  	if err = addInterceptAttempt(stack, options); err != nil {
 149  		return err
 150  	}
 151  	if err = addInterceptors(stack, options); err != nil {
 152  		return err
 153  	}
 154  	return nil
 155  }
 156  
 157  func newServiceMetadataMiddleware_opGetDistributionLatestCacheReset(region string) *awsmiddleware.RegisterServiceMetadata {
 158  	return &awsmiddleware.RegisterServiceMetadata{
 159  		Region:        region,
 160  		ServiceID:     ServiceID,
 161  		OperationName: "GetDistributionLatestCacheReset",
 162  	}
 163  }
 164