-
Notifications
You must be signed in to change notification settings - Fork 83
TPT-4278: python-sdk: Implement support for Reserved IP for IPv4 #672
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
base: proj/reserved-ips
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import sys | ||
| import os | ||
|
|
||
| # Ensure the repo root is on sys.path so that `from test.unit.base import ...` | ||
| # works regardless of which directory pytest is invoked from. | ||
| sys.path.insert(0, os.path.dirname(__file__)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ def create( | |
| domains=None, | ||
| nodebalancers=None, | ||
| volumes=None, | ||
| reserved_ipv4_addresses=None, | ||
| entities=[], | ||
| ): | ||
|
Comment on lines
36
to
37
|
||
| """ | ||
|
|
@@ -61,6 +62,9 @@ def create( | |
| :param volumes: A list of Volumes to apply this Tag to upon | ||
| creation | ||
| :type volumes: list of Volumes or list of int | ||
| :param reserved_ipv4_addresses: A list of reserved IPv4 addresses to apply | ||
| this Tag to upon creation. | ||
| :type reserved_ipv4_addresses: list of str | ||
|
|
||
| :returns: The new Tag | ||
| :rtype: Tag | ||
|
|
@@ -103,6 +107,7 @@ def create( | |
| "nodebalancers": nodebalancer_ids or None, | ||
| "domains": domain_ids or None, | ||
| "volumes": volume_ids or None, | ||
| "reserved_ipv4_addresses": reserved_ipv4_addresses or None, | ||
| } | ||
|
|
||
| result = self.client.post("/tags", data=params) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [pytest] | ||
| testpaths = test | ||
| markers = | ||
| smoke: mark a test as a smoke test | ||
| flaky: mark a test as a flaky test for rerun | ||
| python_files = *_test.py test_*.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ip_allocate's docstring describes required arguments (linode required when reserved=False; region or linode required when reserved=True), but the implementation never validates these combinations. This allows requests to be sent withoutlinode_id/region(or withregionwhilereservedis False), which will fail at the API with a less actionable error. Add explicit argument validation (raiseValueError) to enforce the documented contract before building/sending the request body.