-
Notifications
You must be signed in to change notification settings - Fork 103
Nodebalancer VPC support #678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5cd1e22
Adding the funcs for the List VPC and Get VPC for Nodebalancers endpo…
komer3 230f4dc
Adding test cases - they don't work until we update some nodebalance…
komer3 e075874
IPv6 can sometime be empty so adding omiempty here
komer3 94aa731
add vpcs config during nodebalancer create
662422b
update node config as well
c42984f
Merge pull request #1 from rahulait/nb-vpc-updates
komer3 eff3930
add nb vpc test
1f6cf9d
Adding records for fixtures
komer3 66f7ae7
add generated fixtures
8bab48f
fix cleanup failures
4729ea7
Update the fixture for nb vpc list and get
komer3 e46f739
Merge branch 'main' into listnbvpc
komer3 2d5a46d
fix formatting
7b94319
Update nodebalancer_config_vpc.go
komer3 feb92c8
Fix naming
komer3 c3fe2ac
Adding disclaimer for letting users know this might not be available …
komer3 a5cae30
Remove use of pointers with VPC options
komer3 f4d576f
Merge branch 'main' into listnbvpc
komer3 50a2482
Merge branch 'main' into listnbvpc
zliang-akamai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package linodego | ||
|
|
||
| import ( | ||
| "context" | ||
| ) | ||
|
|
||
| // NodeBalancerVPCConfig objects represent a VPC config for a NodeBalancer | ||
komer3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type NodeBalancerVPCConfig struct { | ||
| ID int `json:"id"` | ||
| IPv4Range string `json:"ipv4_range"` | ||
| IPv6Range string `json:"ipv6_range,omitempty"` | ||
| NodeBalancerID int `json:"nodebalancer_id"` | ||
| SubnetID int `json:"subnet_id"` | ||
| VPCID int `json:"vpc_id"` | ||
| } | ||
|
|
||
| // ListNodeBalancerVPCConfigs lists NodeBalancer VPC configs | ||
| func (c *Client) ListNodeBalancerVPCConfigs(ctx context.Context, nodebalancerID int, opts *ListOptions) ([]NodeBalancerVPCConfig, error) { | ||
| return getPaginatedResults[NodeBalancerVPCConfig](ctx, c, formatAPIPath("nodebalancers/%d/vpcs", nodebalancerID), opts) | ||
| } | ||
|
|
||
| // GetNodeBalancerVPCConfig gets the NodeBalancer VPC config with the specified id | ||
| func (c *Client) GetNodeBalancerVPCConfig(ctx context.Context, nodebalancerID int, vpcID int) (*NodeBalancerVPCConfig, error) { | ||
| e := formatAPIPath("nodebalancers/%d/vpcs/%d", nodebalancerID, vpcID) | ||
| return doGETRequest[NodeBalancerVPCConfig](ctx, c, e) | ||
| } | ||
682 changes: 682 additions & 0 deletions
682
test/integration/fixtures/TestNodeBalancerVpcConfig_Get.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
619 changes: 619 additions & 0 deletions
619
test/integration/fixtures/TestNodeBalancerVpcConfig_List.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
546 changes: 546 additions & 0 deletions
546
test/integration/fixtures/TestNodeBalancer_With_VPC_Create.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package integration | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestNodeBalancerVPCConfig_List(t *testing.T) { | ||
| client, nodebalancer, teardown, err := setupNodeBalancerWithVPC(t, "fixtures/TestNodeBalancerVpcConfig_List") | ||
| if err != nil { | ||
| t.Errorf("Error setting up nodebalancer: %s", err) | ||
| } | ||
| defer teardown() | ||
|
|
||
| configs, err := client.ListNodeBalancerVPCConfigs(context.Background(), nodebalancer.ID, nil) | ||
| if err != nil { | ||
| t.Errorf("Error listing nodebalancer VPC configs: %s", err) | ||
| } | ||
|
|
||
| // We expect the list to be not empty and have at least one VPC config | ||
| require.NotEmpty(t, configs) | ||
| require.Len(t, configs, 1) | ||
| } | ||
|
|
||
| func TestNodeBalancerVPCConfig_Get(t *testing.T) { | ||
| client, nodebalancer, teardown, err := setupNodeBalancerWithVPC(t, "fixtures/TestNodeBalancerVpcConfig_Get") | ||
| if err != nil { | ||
| t.Errorf("Error setting up nodebalancer: %s", err) | ||
| } | ||
| defer teardown() | ||
|
|
||
| // Get the VPC config list for the nodebalancer (should only have one) | ||
| configs, err := client.ListNodeBalancerVPCConfigs(context.Background(), nodebalancer.ID, nil) | ||
| if err != nil { | ||
| t.Errorf("Error listing nodebalancer VPC configs: %s", err) | ||
| } | ||
| require.NotEmpty(t, configs) | ||
| require.Len(t, configs, 1) | ||
|
|
||
| // Get the VPC config by ID | ||
| config, err := client.GetNodeBalancerVPCConfig(context.Background(), nodebalancer.ID, configs[0].ID) | ||
| if err != nil { | ||
| t.Errorf("Error getting nodebalancer VPC config: %s", err) | ||
| } | ||
| require.NotNil(t, config) | ||
| require.Equal(t, configs[0].ID, config.ID) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.