-
Notifications
You must be signed in to change notification settings - Fork 2
/
ipaddress.go
71 lines (56 loc) · 1.95 KB
/
ipaddress.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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type IpAddress struct {
Id string `json:"id,omitempty" path:"id,omitempty" url:"id,omitempty"`
AssociatedWith string `json:"associated_with,omitempty" path:"associated_with,omitempty" url:"associated_with,omitempty"`
GroupId int64 `json:"group_id,omitempty" path:"group_id,omitempty" url:"group_id,omitempty"`
IpAddresses []string `json:"ip_addresses,omitempty" path:"ip_addresses,omitempty" url:"ip_addresses,omitempty"`
}
func (i IpAddress) Identifier() interface{} {
return i.Id
}
type IpAddressCollection []IpAddress
type IpAddressListParams struct {
Action string `url:"action,omitempty" required:"false" json:"action,omitempty" path:"action"`
ListParams
}
type IpAddressGetActiveParams struct {
Action string `url:"action,omitempty" required:"false" json:"action,omitempty" path:"action"`
ListParams
}
type IpAddressGetExavaultReservedParams struct {
Action string `url:"action,omitempty" required:"false" json:"action,omitempty" path:"action"`
ListParams
}
type IpAddressGetReservedParams struct {
Action string `url:"action,omitempty" required:"false" json:"action,omitempty" path:"action"`
ListParams
}
func (i *IpAddress) UnmarshalJSON(data []byte) error {
type ipAddress IpAddress
var v ipAddress
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*i = IpAddress(v)
return nil
}
func (i *IpAddressCollection) UnmarshalJSON(data []byte) error {
type ipAddresss IpAddressCollection
var v ipAddresss
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*i = IpAddressCollection(v)
return nil
}
func (i *IpAddressCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*i))
for i, v := range *i {
ret[i] = v
}
return &ret
}