github.com/Files-com/files-sdk-go/v3@v3.1.81/ipaddress/client.go (about) 1 package ip_address 2 3 import ( 4 files_sdk "github.com/Files-com/files-sdk-go/v3" 5 lib "github.com/Files-com/files-sdk-go/v3/lib" 6 listquery "github.com/Files-com/files-sdk-go/v3/listquery" 7 ) 8 9 type Client struct { 10 files_sdk.Config 11 } 12 13 type Iter struct { 14 *files_sdk.Iter 15 *Client 16 } 17 18 func (i *Iter) Reload(opts ...files_sdk.RequestResponseOption) files_sdk.IterI { 19 return &Iter{Iter: i.Iter.Reload(opts...).(*files_sdk.Iter), Client: i.Client} 20 } 21 22 func (i *Iter) IpAddress() files_sdk.IpAddress { 23 return i.Current().(files_sdk.IpAddress) 24 } 25 26 func (c *Client) List(params files_sdk.IpAddressListParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 27 i := &Iter{Iter: &files_sdk.Iter{}, Client: c} 28 path, err := lib.BuildPath("/ip_addresses", params) 29 if err != nil { 30 return i, err 31 } 32 i.ListParams = ¶ms 33 list := files_sdk.IpAddressCollection{} 34 i.Query = listquery.Build(c.Config, path, &list, opts...) 35 return i, nil 36 } 37 38 func List(params files_sdk.IpAddressListParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 39 return (&Client{}).List(params, opts...) 40 } 41 42 func (i *Iter) PublicIpAddress() files_sdk.PublicIpAddress { 43 return i.Current().(files_sdk.PublicIpAddress) 44 } 45 46 func (c *Client) GetSmartfileReserved(params files_sdk.IpAddressGetSmartfileReservedParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 47 i := &Iter{Iter: &files_sdk.Iter{}, Client: c} 48 path, err := lib.BuildPath("/ip_addresses/smartfile-reserved", params) 49 if err != nil { 50 return i, err 51 } 52 i.ListParams = ¶ms 53 list := files_sdk.PublicIpAddressCollection{} 54 i.Query = listquery.Build(c.Config, path, &list, opts...) 55 return i, nil 56 } 57 58 func GetSmartfileReserved(params files_sdk.IpAddressGetSmartfileReservedParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 59 return (&Client{}).GetSmartfileReserved(params, opts...) 60 } 61 62 func (c *Client) GetExavaultReserved(params files_sdk.IpAddressGetExavaultReservedParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 63 i := &Iter{Iter: &files_sdk.Iter{}, Client: c} 64 path, err := lib.BuildPath("/ip_addresses/exavault-reserved", params) 65 if err != nil { 66 return i, err 67 } 68 i.ListParams = ¶ms 69 list := files_sdk.PublicIpAddressCollection{} 70 i.Query = listquery.Build(c.Config, path, &list, opts...) 71 return i, nil 72 } 73 74 func GetExavaultReserved(params files_sdk.IpAddressGetExavaultReservedParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 75 return (&Client{}).GetExavaultReserved(params, opts...) 76 } 77 78 func (c *Client) GetReserved(params files_sdk.IpAddressGetReservedParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 79 i := &Iter{Iter: &files_sdk.Iter{}, Client: c} 80 path, err := lib.BuildPath("/ip_addresses/reserved", params) 81 if err != nil { 82 return i, err 83 } 84 i.ListParams = ¶ms 85 list := files_sdk.PublicIpAddressCollection{} 86 i.Query = listquery.Build(c.Config, path, &list, opts...) 87 return i, nil 88 } 89 90 func GetReserved(params files_sdk.IpAddressGetReservedParams, opts ...files_sdk.RequestResponseOption) (*Iter, error) { 91 return (&Client{}).GetReserved(params, opts...) 92 }