vpc_ips.go raw

   1  package linodego
   2  
   3  import (
   4  	"context"
   5  	"fmt"
   6  )
   7  
   8  // ListAllVPCIPAddresses gets the list of all IP addresses of all VPCs in the Linode account.
   9  func (c *Client) ListAllVPCIPAddresses(
  10  	ctx context.Context, opts *ListOptions,
  11  ) ([]VPCIP, error) {
  12  	return getPaginatedResults[VPCIP](ctx, c, "vpcs/ips", opts)
  13  }
  14  
  15  // ListVPCIPAddresses gets the list of all IP addresses of a specific VPC.
  16  func (c *Client) ListVPCIPAddresses(
  17  	ctx context.Context, vpcID int, opts *ListOptions,
  18  ) ([]VPCIP, error) {
  19  	return getPaginatedResults[VPCIP](ctx, c, fmt.Sprintf("vpcs/%d/ips", vpcID), opts)
  20  }
  21  
  22  // ListAllVPCIPv6Addresses gets a list of all IPv6 addresses related to all VPCs
  23  // accessible by the current Linode account.
  24  // NOTE: IPv6 VPCs may not currently be available to all users.
  25  func (c *Client) ListAllVPCIPv6Addresses(
  26  	ctx context.Context, opts *ListOptions,
  27  ) ([]VPCIP, error) {
  28  	return getPaginatedResults[VPCIP](ctx, c, "vpcs/ipv6s", opts)
  29  }
  30  
  31  // ListVPCIPv6Addresses gets the list of all IPv6 addresses of a specific VPC.
  32  // NOTE: IPv6 VPCs may not currently be available to all users.
  33  func (c *Client) ListVPCIPv6Addresses(
  34  	ctx context.Context, vpcID int, opts *ListOptions,
  35  ) ([]VPCIP, error) {
  36  	return getPaginatedResults[VPCIP](ctx, c, fmt.Sprintf("vpcs/%d/ipv6s", vpcID), opts)
  37  }
  38