forked from Ivasoft/traefik
Update lego
This commit is contained in:
committed by
Traefiker Bot
parent
0a89cccdc0
commit
73e0561610
40
vendor/github.com/linode/linodego/network_ips.go
generated
vendored
40
vendor/github.com/linode/linodego/network_ips.go
generated
vendored
@@ -2,6 +2,7 @@ package linodego
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,18 @@ type IPAddressesPagedResponse struct {
|
||||
Data []InstanceIP `json:"data"`
|
||||
}
|
||||
|
||||
// IPAddressUpdateOptions fields are those accepted by UpdateToken
|
||||
type IPAddressUpdateOptions struct {
|
||||
// The reverse DNS assigned to this address. For public IPv4 addresses, this will be set to a default value provided by Linode if set to nil.
|
||||
RDNS *string `json:"rdns"`
|
||||
}
|
||||
|
||||
// GetUpdateOptions converts a IPAddress to IPAddressUpdateOptions for use in UpdateIPAddress
|
||||
func (i InstanceIP) GetUpdateOptions() (o IPAddressUpdateOptions) {
|
||||
o.RDNS = copyString(&i.RDNS)
|
||||
return
|
||||
}
|
||||
|
||||
// endpoint gets the endpoint URL for IPAddress
|
||||
func (IPAddressesPagedResponse) endpoint(c *Client) string {
|
||||
endpoint, err := c.IPAddresses.Endpoint()
|
||||
@@ -48,3 +61,30 @@ func (c *Client) GetIPAddress(ctx context.Context, id string) (*InstanceIP, erro
|
||||
}
|
||||
return r.Result().(*InstanceIP), nil
|
||||
}
|
||||
|
||||
// UpdateIPAddress updates the IPAddress with the specified id
|
||||
func (c *Client) UpdateIPAddress(ctx context.Context, id string, updateOpts IPAddressUpdateOptions) (*InstanceIP, error) {
|
||||
var body string
|
||||
e, err := c.IPAddresses.Endpoint()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e = fmt.Sprintf("%s/%s", e, id)
|
||||
|
||||
req := c.R(ctx).SetResult(&InstanceIP{})
|
||||
|
||||
if bodyData, err := json.Marshal(updateOpts); err == nil {
|
||||
body = string(bodyData)
|
||||
} else {
|
||||
return nil, NewError(err)
|
||||
}
|
||||
|
||||
r, err := coupleAPIErrors(req.
|
||||
SetBody(body).
|
||||
Put(e))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r.Result().(*InstanceIP), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user