Skip to content

VPC Dual Stack: Add support for /vpcs/ipv6s and /vpcs/{id}/ipv6s#791

Merged
lgarber-akamai merged 4 commits intolinode:proj/vpc-dual-stackfrom
lgarber-akamai:new/vpc-dual-stack-ipv6s
Aug 6, 2025
Merged

VPC Dual Stack: Add support for /vpcs/ipv6s and /vpcs/{id}/ipv6s#791
lgarber-akamai merged 4 commits intolinode:proj/vpc-dual-stackfrom
lgarber-akamai:new/vpc-dual-stack-ipv6s

Conversation

@lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Jul 29, 2025

📝 Description

This pull request adds support for the /vpcs/ipv6s and /vpcs/{id}/ipv6s endpoints.

✔️ How to Test

The following test steps assume you have pulled down this PR locally.

Unit Testing

make test-unit

Integration Testing

NOTE: Ensure your local environment is pointing at an API instance with support for VPC Dual Stack. See TPT-3535 for details.

make TEST_ARGS="-run TestVPC" fixtures

Manual Testing

NOTE: Ensure your local environment is pointing at an API instance with support for VPC Dual Stack. See TPT-3535 for details.

  1. In a linodego sandbox environment (e.g. dx-devenv), run the following:
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/davecgh/go-spew/spew"
	"github.com/linode/linodego"
)

func main() {
	ctx := context.Background()

	client := linodego.NewClient(nil)
	client.SetToken(os.Getenv("LINODE_TOKEN"))
	client.SetAPIVersion("v4beta")

	vpc, err := client.CreateVPC(
		ctx,
		linodego.VPCCreateOptions{
			Label:  "linodego-test",
			Region: "pl-labkrk-2",
			IPv6: []linodego.VPCCreateOptionsIPv6{
				{
					Range: linodego.Pointer("/52"),
				},
			},
			Subnets: []linodego.VPCSubnetCreateOptions{
				{
					Label: "test-subnet",
					IPv4:  "10.0.0.0/24",
					IPv6: []linodego.VPCSubnetCreateOptionsIPv6{
						{
							Range: linodego.Pointer("/52"),
						},
					},
				},
			},
		},
	)
	if err != nil {
		log.Fatal(err)
	}

	_, err = client.CreateInstance(
		ctx,
		linodego.InstanceCreateOptions{
			Region:              vpc.Region,
			Type:                "g6-nanode-1",
			Label:               "linodego-test",
			InterfaceGeneration: linodego.GenerationLinode,
			LinodeInterfaces: []linodego.LinodeInterfaceCreateOptions{
				{
					VPC: &linodego.VPCInterfaceCreateOptions{
						SubnetID: vpc.Subnets[0].ID,
						IPv4: &linodego.VPCInterfaceIPv4CreateOptions{
							Ranges: []linodego.VPCInterfaceIPv4RangeCreateOptions{
								{
									Range: "/32",
								},
							},
						},
						IPv6: &linodego.VPCInterfaceIPv6CreateOptions{
							SLAAC: []linodego.VPCInterfaceIPv6SLAACCreateOptions{
								{
									Range: "auto",
								},
							},
							Ranges: []linodego.VPCInterfaceIPv6RangeCreateOptions{
								{
									Range: "auto",
								},
							},
							IsPublic: true,
						},
					},
				},
			},
		},
	)
	if err != nil {
		log.Fatal(err)
	}

	scopedIPv6Addresses, err := client.ListVPCIPv6Addresses(ctx, vpc.ID, nil)
	if err != nil {
		log.Fatal(err)
	}

	allIPv6Addresses, err := client.ListAllVPCIPv6Addresses(
		ctx,
		nil,
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("VPC:")
	spew.Dump(vpc)

	fmt.Println("\nScoped VPC IPv6 Addresses:")
	spew.Dump(scopedIPv6Addresses)

	fmt.Println("\nAll VPC IPv6 Addresses:")
	spew.Dump(allIPv6Addresses)
}
  1. Ensure the output looks similar to the following:

VPC:
(*linodego.VPC)(0x1400016ca00)({
 IPv6: ([]linodego.VPCIPv6Range) (len=1 cap=1) {
  (linodego.VPCIPv6Range) {
   Range: (string) (len=19) "2600:3c11:e4df::/52"
  }
 },
 Subnets: ([]linodego.VPCSubnet) (len=1 cap=1) {
  (linodego.VPCSubnet) {
   Label: (string) (len=11) "test-subnet",
   IPv4: (string) (len=11) "10.0.0.0/24",
   IPv6: ([]linodego.VPCIPv6Range) (len=1 cap=1) {
    (linodego.VPCIPv6Range) {
     Range: (string) (len=19) "2600:3c11:e4df::/52"
    }
   },
   ...
  }
 },
 ...
})

Scoped VPC IPv6 Addresses:
([]linodego.VPCIP) (len=2 cap=2) {
 (linodego.VPCIP) {
  Address: (*string)(<nil>),
  AddressRange: (*string)(<nil>),
  IPv6Range: (*string)(0x14000090730)((len=21) "2600:3c11:e4df:1::/64"),
  IPv6IsPublic: (*bool)(0x140000b170b)(true),
  IPv6Addresses: ([]linodego.VPCIPIPv6Address) (len=1 cap=1) {
   (linodego.VPCIPIPv6Address) {
    SLAACAddress: (string) (len=36) "2600:3c11:e4df:1:2000:e0ff:fe5a:2694"
   }
  },
  ...
 },
 (linodego.VPCIP) {
  Address: (*string)(<nil>),
  AddressRange: (*string)(<nil>),
  IPv6Range: (*string)(0x14000090760)((len=21) "2600:3c11:e4df:2::/64"),
  IPv6IsPublic: (*bool)(0x140000b171b)(true),
  IPv6Addresses: ([]linodego.VPCIPIPv6Address) {
  },
  ...
 }
}

All VPC IPv6 Addresses:
([]linodego.VPCIP) (len=2 cap=2) {
 (linodego.VPCIP) {
  Address: (*string)(<nil>),
  AddressRange: (*string)(<nil>),
  IPv6Range: (*string)(0x140001148f0)((len=21) "2600:3c11:e4df:1::/64"),
  IPv6IsPublic: (*bool)(0x1400010287b)(true),
  IPv6Addresses: ([]linodego.VPCIPIPv6Address) (len=1 cap=1) {
   (linodego.VPCIPIPv6Address) {
    SLAACAddress: (string) (len=36) "2600:3c11:e4df:1:2000:e0ff:fe5a:2694"
   }
  },
  ...
 },
 (linodego.VPCIP) {
  Address: (*string)(<nil>),
  AddressRange: (*string)(<nil>),
  IPv6Range: (*string)(0x14000114920)((len=21) "2600:3c11:e4df:2::/64"),
  IPv6IsPublic: (*bool)(0x1400010288b)(true),
  IPv6Addresses: ([]linodego.VPCIPIPv6Address) {
  },
  ...
 }
}

@lgarber-akamai lgarber-akamai added the new-feature for new features in the changelog. label Jul 29, 2025
@lgarber-akamai lgarber-akamai marked this pull request as ready for review July 29, 2025 18:32
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner July 29, 2025 18:32
@lgarber-akamai lgarber-akamai requested review from ezilber-akamai and jriddle-linode and removed request for a team July 29, 2025 18:32
Copy link
Contributor

@rahulait rahulait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works well locally!

@lgarber-akamai lgarber-akamai merged commit d156a23 into linode:proj/vpc-dual-stack Aug 6, 2025
10 checks passed
lgarber-akamai added a commit that referenced this pull request Aug 22, 2025
Implement support for VPC Dual Stack (#706)

Add support for /vpcs/ipv6s and /vpcs/{id}/ipv6s (#791)
lgarber-akamai added a commit that referenced this pull request Aug 25, 2025
* project: VPC Dual Stack

Implement support for VPC Dual Stack (#706)

Add support for /vpcs/ipv6s and /vpcs/{id}/ipv6s (#791)

* Remove .DS_Store

* Re-run final fixtures

* VPC Dual Stack: Add documentation and LA notices (#806)

* Add missing VPC Dual Stack docs and LA notices

* Fix spacing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants