aboutsummaryrefslogtreecommitdiff
path: root/headers.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-02-05 23:23:48 +0100
committerStefan Majewsky <majewsky@gmx.net>2018-02-05 23:23:48 +0100
commitf78c5a59a8fd198603199ddcfb5b29315d556f58 (patch)
tree193f2795128638324a856f7c4c1c7dc29d15ff1f /headers.go
parent09597ccf1693b1ac7999030c1a2c37d9373dfe7b (diff)
downloadgo-schwift-f78c5a59a8fd198603199ddcfb5b29315d556f58.tar.gz
add type-safe accessors for most container headers
Diffstat (limited to 'headers.go')
-rw-r--r--headers.go34
1 files changed, 25 insertions, 9 deletions
diff --git a/headers.go b/headers.go
index 2d81ddf..fe8fa38 100644
--- a/headers.go
+++ b/headers.go
@@ -35,13 +35,14 @@ import (
//Set(), Del(), Clear() methods on this type.
type AccountHeaders struct {
headers.Headers
- BytesUsed headers.Uint64Readonly `schwift:"X-Account-Bytes-Used"`
- ContainerCount headers.Uint64Readonly `schwift:"X-Account-Container-Count"`
- Metadata headers.Metadata `schwift:"X-Account-Meta-"`
- ObjectCount headers.Uint64Readonly `schwift:"X-Account-Object-Count"`
- QuotaBytes headers.Uint64 `schwift:"X-Account-Meta-Quota-Bytes"`
- TempURLKey headers.String `schwift:"X-Account-Meta-Temp-URL-Key"`
- TempURLKey2 headers.String `schwift:"X-Account-Meta-Temp-URL-Key-2"`
+ BytesUsed headers.Uint64Readonly `schwift:"X-Account-Bytes-Used"`
+ ContainerCount headers.Uint64Readonly `schwift:"X-Account-Container-Count"`
+ Metadata headers.Metadata `schwift:"X-Account-Meta-"`
+ ObjectCount headers.Uint64Readonly `schwift:"X-Account-Object-Count"`
+ QuotaBytes headers.Uint64 `schwift:"X-Account-Meta-Quota-Bytes"`
+ TempURLKey headers.String `schwift:"X-Account-Meta-Temp-URL-Key"`
+ TempURLKey2 headers.String `schwift:"X-Account-Meta-Temp-URL-Key-2"`
+ Timestamp headers.UnixTimeReadonly `schwift:"X-Timestamp"`
//forbid initialization as struct literal (must use NewAccountHeaders)
initialized bool
}
@@ -77,8 +78,23 @@ func (ah AccountHeaders) Validate() error {
//Set(), Del(), Clear() methods on this type.
type ContainerHeaders struct {
headers.Headers
- Metadata headers.Metadata `schwift:"X-Container-Meta-"`
- //TODO map well-known headers
+ BytesUsed headers.Uint64Readonly `schwift:"X-Container-Bytes-Used"`
+ BytesUsedQuota headers.Uint64 `schwift:"X-Container-Meta-Quota-Bytes"`
+ HistoryLocation headers.String `schwift:"X-History-Location"`
+ Metadata headers.Metadata `schwift:"X-Container-Meta-"`
+ ObjectCount headers.Uint64Readonly `schwift:"X-Container-Object-Count"`
+ ObjectCountQuota headers.Uint64 `schwift:"X-Container-Meta-Quota-Count"`
+ ReadACL headers.String `schwift:"X-Container-Read"`
+ //StoragePolicy can only be set in a PUT request.
+ StoragePolicy headers.String `schwift:"X-Storage-Policy"`
+ SyncKey headers.String `schwift:"X-Container-Sync-Key"`
+ SyncTo headers.String `schwift:"X-Container-Sync-To"`
+ TempURLKey2 headers.String `schwift:"X-Container-Meta-Temp-URL-Key-2"`
+ TempURLKey headers.String `schwift:"X-Container-Meta-Temp-URL-Key"`
+ Timestamp headers.UnixTimeReadonly `schwift:"X-Timestamp"`
+ VersionsLocation headers.String `schwift:"X-Versions-Location"`
+ WriteACL headers.String `schwift:"X-Container-Write"`
+ //TODO map X-Container-Meta-Access-Control-* (requires new data types)
//forbid initialization as struct literal (must use NewContainerHeaders)
initialized bool
}