github.com/akamai/AkamaiOPEN-edgegrid-golang@v1.2.2/api-endpoints-v2/cache_settings.go (about)

     1  package apiendpoints
     2  
     3  type CacheSettings struct {
     4  	Enabled           bool                  `json:"enabled"`
     5  	Option            string                `json:"option"`
     6  	MaxAge            *MaxAge               `json:"maxAge"`
     7  	ServeStale        bool                  `json:"serveStale"`
     8  	DownstreamCaching DownstreamCaching     `json:"downstreamCaching"`
     9  	ErrorCaching      ErrorCaching          `json:"errorCaching"`
    10  	Resources         map[int]CacheResource `json:"resources"`
    11  }
    12  
    13  type DownstreamCaching struct {
    14  	Option        string  `json:"option"`
    15  	Lifetime      string  `json:"lifetime"`
    16  	MaxAge        *MaxAge `json:"maxAge"`
    17  	Headers       string  `json:"headers"`
    18  	MarkAsPrivate bool    `json:"markAsPrivate"`
    19  }
    20  
    21  type ErrorCaching struct {
    22  	Enabled       bool    `json:"enabled"`
    23  	MaxAge        *MaxAge `json:"maxAge"`
    24  	PreserveStale bool    `json:"preserveStale"`
    25  }
    26  
    27  type MaxAge struct {
    28  	Duration int    `json:"duration"`
    29  	Unit     string `json:"unit"`
    30  }
    31  
    32  type CacheResource struct {
    33  	ResourceSettings
    34  	Option     CacheResourceOptionValue `json:"option"`
    35  	MaxAge     *MaxAge                  `json:"maxAge"`
    36  	ServeStale bool                     `json:"serveStale"`
    37  }
    38  
    39  type MaxAgeUnitValue string
    40  type CacheResourceOptionValue string
    41  
    42  const (
    43  	MaxAgeUnitSeconds MaxAgeUnitValue = "SECONDS"
    44  	MaxAgeUnitMinutes MaxAgeUnitValue = "MINUTES"
    45  	MaxAgeUnitHours   MaxAgeUnitValue = "HOURS"
    46  	MaxAgeUnitDays    MaxAgeUnitValue = "DAYS"
    47  
    48  	CacheResourceOptionCache                             CacheResourceOptionValue = "CACHE"
    49  	CacheResourceOptionBypassCache                       CacheResourceOptionValue = "BYPASS_CACHE"
    50  	CacheResourceOptionNoStore                           CacheResourceOptionValue = "NO_STORE"
    51  	CacheResourceOptionHonorOriginCacheControl           CacheResourceOptionValue = "HONOR_ORIGIN_CACHE_CONTROL"
    52  	CacheResourceOptionHonorOriginExpires                CacheResourceOptionValue = "HONOR_ORIGIN_EXPIRES"
    53  	CacheResourceOptionHonorOriginCacheControlAndExpires CacheResourceOptionValue = "HONOR_ORIGIN_CACHE_CONTROL_AND_EXPIRES"
    54  )