aboutsummaryrefslogtreecommitdiff
path: root/generated.go
blob: a3dca80841d38c781476fd02081d31aad3b936f1 (plain)
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/*******************************************************************************
*
* THIS FILE IS AUTOGENERATED.
*
* Edit `generated.go.in` instead and run `make generate` to produce this file.
*
*******************************************************************************/

package schwift

import (
	"net/textproto"

	"github.com/majewsky/schwift/headers"
)

//AccountHeaders contains the headers for a schwift.Account instance.
//
//To read and write well-known headers, use the methods on this type.
//To read and write arbitary headers, use the methods on type Headers.
type AccountHeaders map[string]string

//Clear sets the value for the specified header to the empty string. When the
//Headers instance is then sent to the server with Update(), the server will
//delete the value for that header; cf. Del().
func (h AccountHeaders) Clear(key string) {
	h[textproto.CanonicalMIMEHeaderKey(key)] = ""
}

//Del deletes a key from the Headers instance. When the Headers instance
//is then sent to the server with Update(), Del() has different effects
//depending on context because of Swift's inconsistent API:
//
//For most writable attributes, a key which has been deleted with Del() will
//remain unchanged on the server. To remove the key on the server, use Clear()
//instead.
func (h AccountHeaders) Del(key string) {
	delete(h, textproto.CanonicalMIMEHeaderKey(key))
}

//Get returns the value for the specified header.
func (h AccountHeaders) Get(key string) string {
	return h[textproto.CanonicalMIMEHeaderKey(key)]
}

//Set sets a new value for the specified header. Any existing value will be
//overwritten.
func (h AccountHeaders) Set(key, value string) {
	h[textproto.CanonicalMIMEHeaderKey(key)] = value
}

//Validate returns headers.MalformedHeaderError if the value of any well-known
//header does not conform to its data type. This is called automatically by
//Schwift when preparing an AccountHeaders instance from a GET/HEAD response,
//so you usually do not need to do it yourself. You will get the validation error
//from the Account method doing the request, e.g. Headers().
func (h AccountHeaders) Validate() error {
	if err := h.BytesUsed().Validate(); err != nil {
		return err
	}
	if err := h.ContainerCount().Validate(); err != nil {
		return err
	}
	if err := h.QuotaBytes().Validate(); err != nil {
		return err
	}
	if err := h.ObjectCount().Validate(); err != nil {
		return err
	}
	if err := h.Timestamp().Validate(); err != nil {
		return err
	}
	return evadeGolintComplaint1()
}

//BytesUsed provides type-safe access to X-Account-Bytes-Used headers.
func (h AccountHeaders) BytesUsed() headers.Uint64Readonly {
	return headers.Uint64Readonly{
		Base: headers.Base{
			H: h,
			K: "X-Account-Bytes-Used",
		},
	}
}

//ContainerCount provides type-safe access to X-Account-Container-Count headers.
func (h AccountHeaders) ContainerCount() headers.Uint64Readonly {
	return headers.Uint64Readonly{
		Base: headers.Base{
			H: h,
			K: "X-Account-Container-Count",
		},
	}
}

//Metadata provides type-safe access to X-Account-Meta- headers.
func (h AccountHeaders) Metadata() headers.Metadata {
	return headers.Metadata{
		Base: headers.Base{
			H: h,
			K: "X-Account-Meta-",
		},
	}
}

//QuotaBytes provides type-safe access to X-Account-Meta-Quota-Bytes headers.
func (h AccountHeaders) QuotaBytes() headers.Uint64 {
	return headers.Uint64{
		Base: headers.Base{
			H: h,
			K: "X-Account-Meta-Quota-Bytes",
		},
	}
}

//TempURLKey2 provides type-safe access to X-Account-Meta-Temp-URL-Key-2 headers.
func (h AccountHeaders) TempURLKey2() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Account-Meta-Temp-URL-Key-2",
		},
	}
}

//TempURLKey provides type-safe access to X-Account-Meta-Temp-URL-Key headers.
func (h AccountHeaders) TempURLKey() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Account-Meta-Temp-URL-Key",
		},
	}
}

//ObjectCount provides type-safe access to X-Account-Object-Count headers.
func (h AccountHeaders) ObjectCount() headers.Uint64Readonly {
	return headers.Uint64Readonly{
		Base: headers.Base{
			H: h,
			K: "X-Account-Object-Count",
		},
	}
}

//Timestamp provides type-safe access to X-Timestamp headers.
func (h AccountHeaders) Timestamp() headers.UnixTimeReadonly {
	return headers.UnixTimeReadonly{
		Base: headers.Base{
			H: h,
			K: "X-Timestamp",
		},
	}
}

//ContainerHeaders contains the headers for a schwift.Container instance.
//
//To read and write well-known headers, use the methods on this type.
//To read and write arbitary headers, use the methods on type Headers.
type ContainerHeaders map[string]string

//Clear sets the value for the specified header to the empty string. When the
//Headers instance is then sent to the server with Update(), the server will
//delete the value for that header; cf. Del().
func (h ContainerHeaders) Clear(key string) {
	h[textproto.CanonicalMIMEHeaderKey(key)] = ""
}

//Del deletes a key from the Headers instance. When the Headers instance
//is then sent to the server with Update(), Del() has different effects
//depending on context because of Swift's inconsistent API:
//
//For most writable attributes, a key which has been deleted with Del() will
//remain unchanged on the server. To remove the key on the server, use Clear()
//instead.
func (h ContainerHeaders) Del(key string) {
	delete(h, textproto.CanonicalMIMEHeaderKey(key))
}

//Get returns the value for the specified header.
func (h ContainerHeaders) Get(key string) string {
	return h[textproto.CanonicalMIMEHeaderKey(key)]
}

//Set sets a new value for the specified header. Any existing value will be
//overwritten.
func (h ContainerHeaders) Set(key, value string) {
	h[textproto.CanonicalMIMEHeaderKey(key)] = value
}

//Validate returns headers.MalformedHeaderError if the value of any well-known
//header does not conform to its data type. This is called automatically by
//Schwift when preparing an ContainerHeaders instance from a GET/HEAD response,
//so you usually do not need to do it yourself. You will get the validation error
//from the Container method doing the request, e.g. Headers().
func (h ContainerHeaders) Validate() error {
	if err := h.BytesUsed().Validate(); err != nil {
		return err
	}
	if err := h.BytesUsedQuota().Validate(); err != nil {
		return err
	}
	if err := h.ObjectCountQuota().Validate(); err != nil {
		return err
	}
	if err := h.ObjectCount().Validate(); err != nil {
		return err
	}
	if err := h.Timestamp().Validate(); err != nil {
		return err
	}
	return evadeGolintComplaint1()
}

//BytesUsed provides type-safe access to X-Container-Bytes-Used headers.
func (h ContainerHeaders) BytesUsed() headers.Uint64Readonly {
	return headers.Uint64Readonly{
		Base: headers.Base{
			H: h,
			K: "X-Container-Bytes-Used",
		},
	}
}

//Metadata provides type-safe access to X-Container-Meta- headers.
func (h ContainerHeaders) Metadata() headers.Metadata {
	return headers.Metadata{
		Base: headers.Base{
			H: h,
			K: "X-Container-Meta-",
		},
	}
}

//BytesUsedQuota provides type-safe access to X-Container-Meta-Quota-Bytes headers.
func (h ContainerHeaders) BytesUsedQuota() headers.Uint64 {
	return headers.Uint64{
		Base: headers.Base{
			H: h,
			K: "X-Container-Meta-Quota-Bytes",
		},
	}
}

//ObjectCountQuota provides type-safe access to X-Container-Meta-Quota-Count headers.
func (h ContainerHeaders) ObjectCountQuota() headers.Uint64 {
	return headers.Uint64{
		Base: headers.Base{
			H: h,
			K: "X-Container-Meta-Quota-Count",
		},
	}
}

//TempURLKey2 provides type-safe access to X-Container-Meta-Temp-URL-Key-2 headers.
func (h ContainerHeaders) TempURLKey2() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Container-Meta-Temp-URL-Key-2",
		},
	}
}

//TempURLKey provides type-safe access to X-Container-Meta-Temp-URL-Key headers.
func (h ContainerHeaders) TempURLKey() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Container-Meta-Temp-URL-Key",
		},
	}
}

//ObjectCount provides type-safe access to X-Container-Object-Count headers.
func (h ContainerHeaders) ObjectCount() headers.Uint64Readonly {
	return headers.Uint64Readonly{
		Base: headers.Base{
			H: h,
			K: "X-Container-Object-Count",
		},
	}
}

//ReadACL provides type-safe access to X-Container-Read headers.
func (h ContainerHeaders) ReadACL() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Container-Read",
		},
	}
}

//SyncKey provides type-safe access to X-Container-Sync-Key headers.
func (h ContainerHeaders) SyncKey() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Container-Sync-Key",
		},
	}
}

//SyncTo provides type-safe access to X-Container-Sync-To headers.
func (h ContainerHeaders) SyncTo() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Container-Sync-To",
		},
	}
}

//WriteACL provides type-safe access to X-Container-Write headers.
func (h ContainerHeaders) WriteACL() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Container-Write",
		},
	}
}

//HistoryLocation provides type-safe access to X-History-Location headers.
func (h ContainerHeaders) HistoryLocation() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-History-Location",
		},
	}
}

//StoragePolicy provides type-safe access to X-Storage-Policy headers.
func (h ContainerHeaders) StoragePolicy() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Storage-Policy",
		},
	}
}

//Timestamp provides type-safe access to X-Timestamp headers.
func (h ContainerHeaders) Timestamp() headers.UnixTimeReadonly {
	return headers.UnixTimeReadonly{
		Base: headers.Base{
			H: h,
			K: "X-Timestamp",
		},
	}
}

//VersionsLocation provides type-safe access to X-Versions-Location headers.
func (h ContainerHeaders) VersionsLocation() headers.String {
	return headers.String{
		Base: headers.Base{
			H: h,
			K: "X-Versions-Location",
		},
	}
}

func evadeGolintComplaint1() error {
	return nil
}