-
Notifications
You must be signed in to change notification settings - Fork 2
/
publicipaddress.go
47 lines (37 loc) · 1.23 KB
/
publicipaddress.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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type PublicIpAddress struct {
IpAddress string `json:"ip_address,omitempty" path:"ip_address"`
ServerName string `json:"server_name,omitempty" path:"server_name"`
FtpEnabled string `json:"ftp_enabled,omitempty" path:"ftp_enabled"`
SftpEnabled string `json:"sftp_enabled,omitempty" path:"sftp_enabled"`
}
type PublicIpAddressCollection []PublicIpAddress
func (p *PublicIpAddress) UnmarshalJSON(data []byte) error {
type publicIpAddress PublicIpAddress
var v publicIpAddress
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*p = PublicIpAddress(v)
return nil
}
func (p *PublicIpAddressCollection) UnmarshalJSON(data []byte) error {
type publicIpAddresss PublicIpAddressCollection
var v publicIpAddresss
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*p = PublicIpAddressCollection(v)
return nil
}
func (p *PublicIpAddressCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*p))
for i, v := range *p {
ret[i] = v
}
return &ret
}