Skip to content

Commit

Permalink
Merge pull request #8 from AniJ98/ipreservation-remainingendpoints
Browse files Browse the repository at this point in the history
Changed struct name from LinodeReserveIPOptions to AllocateReserveIPO…
  • Loading branch information
AniJ98 authored Nov 18, 2024
2 parents 73a1b3b + 4af2cc7 commit 0a45fcd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions network_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type LinodeIPAssignment struct {
LinodeID int `json:"linode_id"`
}

type LinodeReserveIPOptions struct {
type AllocateReserveIPOptions struct {
Type string `json:"type"`
Public bool `json:"public"`
Reserved bool `json:"reserved,omitempty"`
Expand Down Expand Up @@ -100,7 +100,7 @@ func (c *Client) ShareIPAddresses(ctx context.Context, opts IPAddressesShareOpti

// 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 LinodeReserveIPOptions) (*InstanceIP, error) {
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 {
Expand Down
30 changes: 15 additions & 15 deletions test/integration/network_ips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 1: Valid request

opts := LinodeReserveIPOptions{
opts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: true,
Expand All @@ -534,7 +534,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {
}

// Scenario 2: Non-owned Linode
nonOwnedLinodeOpts := LinodeReserveIPOptions{
nonOwnedLinodeOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: true,
Expand All @@ -548,7 +548,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 3: Omit Linode ID

omitLinodeIDOpts := LinodeReserveIPOptions{
omitLinodeIDOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: true,
Expand All @@ -564,7 +564,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 4: Account at reserved IP limit

resLimitoOpts := linodego.LinodeReserveIPOptions{
resLimitoOpts := linodego.AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: true,
Expand All @@ -581,7 +581,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// // Scenario 5: Linode at IPMax limit

// opts = linodego.LinodeReserveIPOptions{
// opts = linodego.AllocateReserveIPOptions{
// Type: "ipv4",
// Public: true,
// Reserved: true,
Expand All @@ -595,7 +595,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 6: Omit Region

omitRegionOpts := LinodeReserveIPOptions{
omitRegionOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: true,
Expand All @@ -614,7 +614,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 7: Omit both Region and Linode ID

omitRegionAndLinodeIDopts := LinodeReserveIPOptions{
omitRegionAndLinodeIDopts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: true,
Expand All @@ -627,7 +627,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 8: Reserved true, Public false

publicFalseOpts := LinodeReserveIPOptions{
publicFalseOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: false,
Reserved: true,
Expand All @@ -641,7 +641,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 9: Reserved false

reservedFalseOpts := LinodeReserveIPOptions{
reservedFalseOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: false,
Expand All @@ -660,7 +660,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 10: Omit Reserved field

omitReservedOpts := LinodeReserveIPOptions{
omitReservedOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Region: instance.Region,
Expand All @@ -678,7 +678,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 11: Omit Linode ID, Reserved false

omitOpts := LinodeReserveIPOptions{
omitOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: false,
Expand All @@ -691,7 +691,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 12: Omit Linode ID and Reserved fields

omitIDResopts := LinodeReserveIPOptions{
omitIDResopts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Region: instance.Region,
Expand All @@ -703,7 +703,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 13: Reserved true, Type IPv6

typeIPv6opts := LinodeReserveIPOptions{
typeIPv6opts := AllocateReserveIPOptions{
Type: "ipv6",
Public: true,
Reserved: true,
Expand All @@ -717,7 +717,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 14: Reserved false, Type IPv6

resFalseIPv6opts := LinodeReserveIPOptions{
resFalseIPv6opts := AllocateReserveIPOptions{
Type: "ipv6",
Public: true,
Reserved: false,
Expand All @@ -731,7 +731,7 @@ func TestIPAddress_Instance_Allocate(t *testing.T) {

// Scenario 15: Region mismatch

regionMismatchOpts := LinodeReserveIPOptions{
regionMismatchOpts := AllocateReserveIPOptions{
Type: "ipv4",
Public: true,
Reserved: true,
Expand Down

0 comments on commit 0a45fcd

Please sign in to comment.