-
-
Notifications
You must be signed in to change notification settings - Fork 326
/
cache_storage.go
216 lines (153 loc) · 6.31 KB
/
cache_storage.go
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// This file is generated by "./lib/proto/generate"
package proto
/*
CacheStorage
*/
// CacheStorageCacheID Unique identifier of the Cache object.
type CacheStorageCacheID string
// CacheStorageCachedResponseType type of HTTP response cached
type CacheStorageCachedResponseType string
const (
// CacheStorageCachedResponseTypeBasic enum const
CacheStorageCachedResponseTypeBasic CacheStorageCachedResponseType = "basic"
// CacheStorageCachedResponseTypeCors enum const
CacheStorageCachedResponseTypeCors CacheStorageCachedResponseType = "cors"
// CacheStorageCachedResponseTypeDefault enum const
CacheStorageCachedResponseTypeDefault CacheStorageCachedResponseType = "default"
// CacheStorageCachedResponseTypeError enum const
CacheStorageCachedResponseTypeError CacheStorageCachedResponseType = "error"
// CacheStorageCachedResponseTypeOpaqueResponse enum const
CacheStorageCachedResponseTypeOpaqueResponse CacheStorageCachedResponseType = "opaqueResponse"
// CacheStorageCachedResponseTypeOpaqueRedirect enum const
CacheStorageCachedResponseTypeOpaqueRedirect CacheStorageCachedResponseType = "opaqueRedirect"
)
// CacheStorageDataEntry Data entry.
type CacheStorageDataEntry struct {
// RequestURL Request URL.
RequestURL string `json:"requestURL"`
// RequestMethod Request method.
RequestMethod string `json:"requestMethod"`
// RequestHeaders Request headers
RequestHeaders []*CacheStorageHeader `json:"requestHeaders"`
// ResponseTime Number of seconds since epoch.
ResponseTime float64 `json:"responseTime"`
// ResponseStatus HTTP response status code.
ResponseStatus int `json:"responseStatus"`
// ResponseStatusText HTTP response status text.
ResponseStatusText string `json:"responseStatusText"`
// ResponseType HTTP response type
ResponseType CacheStorageCachedResponseType `json:"responseType"`
// ResponseHeaders Response headers
ResponseHeaders []*CacheStorageHeader `json:"responseHeaders"`
}
// CacheStorageCache Cache identifier.
type CacheStorageCache struct {
// CacheID An opaque unique id of the cache.
CacheID CacheStorageCacheID `json:"cacheId"`
// SecurityOrigin Security origin of the cache.
SecurityOrigin string `json:"securityOrigin"`
// CacheName The name of the cache.
CacheName string `json:"cacheName"`
}
// CacheStorageHeader ...
type CacheStorageHeader struct {
// Name ...
Name string `json:"name"`
// Value ...
Value string `json:"value"`
}
// CacheStorageCachedResponse Cached response
type CacheStorageCachedResponse struct {
// Body Entry content, base64-encoded.
Body []byte `json:"body"`
}
// CacheStorageDeleteCache Deletes a cache.
type CacheStorageDeleteCache struct {
// CacheID Id of cache for deletion.
CacheID CacheStorageCacheID `json:"cacheId"`
}
// ProtoReq name
func (m CacheStorageDeleteCache) ProtoReq() string { return "CacheStorage.deleteCache" }
// Call sends the request
func (m CacheStorageDeleteCache) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// CacheStorageDeleteEntry Deletes a cache entry.
type CacheStorageDeleteEntry struct {
// CacheID Id of cache where the entry will be deleted.
CacheID CacheStorageCacheID `json:"cacheId"`
// Request URL spec of the request.
Request string `json:"request"`
}
// ProtoReq name
func (m CacheStorageDeleteEntry) ProtoReq() string { return "CacheStorage.deleteEntry" }
// Call sends the request
func (m CacheStorageDeleteEntry) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// CacheStorageRequestCacheNames Requests cache names.
type CacheStorageRequestCacheNames struct {
// SecurityOrigin Security origin.
SecurityOrigin string `json:"securityOrigin"`
}
// ProtoReq name
func (m CacheStorageRequestCacheNames) ProtoReq() string { return "CacheStorage.requestCacheNames" }
// Call the request
func (m CacheStorageRequestCacheNames) Call(c Client) (*CacheStorageRequestCacheNamesResult, error) {
var res CacheStorageRequestCacheNamesResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CacheStorageRequestCacheNamesResult Requests cache names.
type CacheStorageRequestCacheNamesResult struct {
// Caches Caches for the security origin.
Caches []*CacheStorageCache `json:"caches"`
}
// CacheStorageRequestCachedResponse Fetches cache entry.
type CacheStorageRequestCachedResponse struct {
// CacheID Id of cache that contains the entry.
CacheID CacheStorageCacheID `json:"cacheId"`
// RequestURL URL spec of the request.
RequestURL string `json:"requestURL"`
// RequestHeaders headers of the request.
RequestHeaders []*CacheStorageHeader `json:"requestHeaders"`
}
// ProtoReq name
func (m CacheStorageRequestCachedResponse) ProtoReq() string {
return "CacheStorage.requestCachedResponse"
}
// Call the request
func (m CacheStorageRequestCachedResponse) Call(c Client) (*CacheStorageRequestCachedResponseResult, error) {
var res CacheStorageRequestCachedResponseResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CacheStorageRequestCachedResponseResult Fetches cache entry.
type CacheStorageRequestCachedResponseResult struct {
// Response Response read from the cache.
Response *CacheStorageCachedResponse `json:"response"`
}
// CacheStorageRequestEntries Requests data from cache.
type CacheStorageRequestEntries struct {
// CacheID ID of cache to get entries from.
CacheID CacheStorageCacheID `json:"cacheId"`
// SkipCount (optional) Number of records to skip.
SkipCount int `json:"skipCount,omitempty"`
// PageSize (optional) Number of records to fetch.
PageSize int `json:"pageSize,omitempty"`
// PathFilter (optional) If present, only return the entries containing this substring in the path
PathFilter string `json:"pathFilter,omitempty"`
}
// ProtoReq name
func (m CacheStorageRequestEntries) ProtoReq() string { return "CacheStorage.requestEntries" }
// Call the request
func (m CacheStorageRequestEntries) Call(c Client) (*CacheStorageRequestEntriesResult, error) {
var res CacheStorageRequestEntriesResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CacheStorageRequestEntriesResult Requests data from cache.
type CacheStorageRequestEntriesResult struct {
// CacheDataEntries Array of object store data entries.
CacheDataEntries []*CacheStorageDataEntry `json:"cacheDataEntries"`
// ReturnCount Count of returned entries from this storage. If pathFilter is empty, it
// is the count of all entries from this storage.
ReturnCount float64 `json:"returnCount"`
}