Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/go-resty/re…
Browse files Browse the repository at this point in the history
…sty/v2-2.16.2
  • Loading branch information
jriddle-linode authored Nov 25, 2024
2 parents 1238073 + 90fe250 commit 23cd6da
Show file tree
Hide file tree
Showing 12 changed files with 8,392 additions and 968 deletions.
22 changes: 21 additions & 1 deletion network_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
// 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"`
Reserved *bool `json:"reserved,omitempty"`
RDNS *string `json:"rdns,omitempty"`
}

// LinodeIPAssignment stores an assignment between an IP address and a Linode instance.
Expand All @@ -16,6 +17,14 @@ type LinodeIPAssignment struct {
LinodeID int `json:"linode_id"`
}

type AllocateReserveIPOptions struct {
Type string `json:"type"`
Public bool `json:"public"`
Reserved bool `json:"reserved,omitempty"`
Region string `json:"region,omitempty"`
LinodeID int `json:"linode_id,omitempty"`
}

// LinodesAssignIPsOptions fields are those accepted by InstancesAssignIPs.
type LinodesAssignIPsOptions struct {
Region string `json:"region"`
Expand Down Expand Up @@ -88,3 +97,14 @@ func (c *Client) ShareIPAddresses(ctx context.Context, opts IPAddressesShareOpti
_, err := doPOSTRequest[InstanceIP](ctx, c, e, opts)
return err
}

// AllocateReserveIP allocates a new IPv4 address to the Account, with the option to reserve it
// and optionally assign it to a Linode.
func (c *Client) AllocateReserveIP(ctx context.Context, opts AllocateReserveIPOptions) (*InstanceIP, error) {
e := "networking/ips"
result, err := doPOSTRequest[InstanceIP](ctx, c, e, opts)
if err != nil {
return nil, err
}
return result, nil
}
Loading

0 comments on commit 23cd6da

Please sign in to comment.