File: cache_settings.go

package info (click to toggle)
golang-github-akamai-akamaiopen-edgegrid-golang 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,408 kB
  • sloc: sh: 532; makefile: 3
file content (54 lines) | stat: -rw-r--r-- 2,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package apiendpoints

type CacheSettings struct {
	Enabled           bool                  `json:"enabled"`
	Option            string                `json:"option"`
	MaxAge            *MaxAge               `json:"maxAge"`
	ServeStale        bool                  `json:"serveStale"`
	DownstreamCaching DownstreamCaching     `json:"downstreamCaching"`
	ErrorCaching      ErrorCaching          `json:"errorCaching"`
	Resources         map[int]CacheResource `json:"resources"`
}

type DownstreamCaching struct {
	Option        string  `json:"option"`
	Lifetime      string  `json:"lifetime"`
	MaxAge        *MaxAge `json:"maxAge"`
	Headers       string  `json:"headers"`
	MarkAsPrivate bool    `json:"markAsPrivate"`
}

type ErrorCaching struct {
	Enabled       bool    `json:"enabled"`
	MaxAge        *MaxAge `json:"maxAge"`
	PreserveStale bool    `json:"preserveStale"`
}

type MaxAge struct {
	Duration int    `json:"duration"`
	Unit     string `json:"unit"`
}

type CacheResource struct {
	ResourceSettings
	Option     CacheResourceOptionValue `json:"option"`
	MaxAge     *MaxAge                  `json:"maxAge"`
	ServeStale bool                     `json:"serveStale"`
}

type MaxAgeUnitValue string
type CacheResourceOptionValue string

const (
	MaxAgeUnitSeconds MaxAgeUnitValue = "SECONDS"
	MaxAgeUnitMinutes MaxAgeUnitValue = "MINUTES"
	MaxAgeUnitHours   MaxAgeUnitValue = "HOURS"
	MaxAgeUnitDays    MaxAgeUnitValue = "DAYS"

	CacheResourceOptionCache                             CacheResourceOptionValue = "CACHE"
	CacheResourceOptionBypassCache                       CacheResourceOptionValue = "BYPASS_CACHE"
	CacheResourceOptionNoStore                           CacheResourceOptionValue = "NO_STORE"
	CacheResourceOptionHonorOriginCacheControl           CacheResourceOptionValue = "HONOR_ORIGIN_CACHE_CONTROL"
	CacheResourceOptionHonorOriginExpires                CacheResourceOptionValue = "HONOR_ORIGIN_EXPIRES"
	CacheResourceOptionHonorOriginCacheControlAndExpires CacheResourceOptionValue = "HONOR_ORIGIN_CACHE_CONTROL_AND_EXPIRES"
)