| 1 |
package fastly |
| 2 |
|
| 3 |
import ( |
| 4 |
"bytes" |
| 5 |
"encoding" |
| 6 |
) |
| 7 |
|
| 8 |
type BatchOperation string |
| 9 |
|
| 10 |
const ( |
| 11 |
CreateBatchOperation BatchOperation = "create" |
| 12 |
UpdateBatchOperation BatchOperation = "update" |
| 13 |
UpsertBatchOperation BatchOperation = "upsert" |
| 14 |
DeleteBatchOperation BatchOperation = "delete" |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
BatchModifyMaximumOperations = 1000 |
| 19 |
|
| 20 |
|
| 21 |
MaximumDictionarySize = 10000 |
| 22 |
|
| 23 |
|
| 24 |
MaximumACLSize = 10000 |
| 25 |
) |
| 26 |
|
| 27 |
type statusResp struct { |
| 28 |
Status string |
| 29 |
Msg string |
| 30 |
} |
| 31 |
|
| 32 |
func (t *statusResp) Ok() bool { |
| 33 |
return t.Status == "ok" |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
var ( |
| 38 |
_ encoding.TextMarshaler = new(Compatibool) |
| 39 |
_ encoding.TextUnmarshaler = new(Compatibool) |
| 40 |
) |
| 41 |
|
| 42 |
|
| 43 |
func CBool(b bool) *Compatibool { |
| 44 |
c := Compatibool(b) |
| 45 |
return &c |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
type Compatibool bool |
| 51 |
|
| 52 |
|
| 53 |
func (b Compatibool) MarshalText() ([]byte, error) { |
| 54 |
if b { |
| 55 |
return []byte("1"), nil |
| 56 |
} |
| 57 |
return []byte("0"), nil |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
func (b *Compatibool) UnmarshalText(t []byte) error { |
| 62 |
if bytes.Equal(t, []byte("1")) { |
| 63 |
*b = Compatibool(true) |
| 64 |
} |
| 65 |
return nil |
| 66 |
} |