Skip to content

Commit 2252d29

Browse files
Merge dev into proj/nat-service-for-vpc
2 parents 203a4d9 + eec49c9 commit 2252d29

58 files changed

Lines changed: 1654 additions & 233 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ jobs:
5959
runs-on: ubuntu-latest
6060
strategy:
6161
matrix:
62-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
62+
python-version: ['3.11', '3.12', '3.13', '3.14', '3.15']
6363
steps:
6464
- uses: actions/checkout@v7
6565
- uses: actions/setup-python@v7
6666
with:
6767
python-version: ${{ matrix.python-version }}
6868
- name: Run tests
6969
run: |
70-
pip install ".[test]"
71-
tox
70+
pip install ".[unit-test]"
71+
make test-unit

‎.github/workflows/e2e-test.yml‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ on:
4141
python-version:
4242
description: 'Specify the Python version to use for running tests. Leave empty to use the default Python version configured in the environment'
4343
required: false
44-
run-eol-python-version:
45-
description: 'Indicates whether to run tests using an End-of-Life (EOL) Python version. Defaults to "false". Choose "true" to include tests for deprecated Python versions'
46-
required: false
47-
default: 'false'
48-
type: choice
49-
options:
50-
- 'true'
51-
- 'false'
5244
test_report_upload:
5345
description: 'Indicates whether to upload the test report to object storage. Defaults to "false"'
5446
type: choice
@@ -63,8 +55,7 @@ on:
6355
- dev
6456

6557
env:
66-
DEFAULT_PYTHON_VERSION: "3.13"
67-
EOL_PYTHON_VERSION: "3.10"
58+
DEFAULT_PYTHON_VERSION: "3.11"
6859
EXIT_STATUS: 0
6960

7061
jobs:
@@ -89,7 +80,7 @@ jobs:
8980
- name: Setup Python
9081
uses: actions/setup-python@v7
9182
with:
92-
python-version: ${{ inputs.run-eol-python-version == 'true' && env.EOL_PYTHON_VERSION || inputs.python-version || env.DEFAULT_PYTHON_VERSION }}
83+
python-version: ${{ inputs.python-version || env.DEFAULT_PYTHON_VERSION }}
9384

9485
- name: Install Python deps
9586
run: pip install -U setuptools wheel boto3 certifi

‎.github/workflows/publish-pypi.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
LINODE_SDK_VERSION: ${{ github.event.release.tag_name }}
2929

3030
- name: Publish the release artifacts to PyPI
31-
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # pin@release/v1.14.2
31+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # pin@release/v1.14.3

‎.github/workflows/release-cross-repo-test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Set up Python
2828
uses: actions/setup-python@v7
2929
with:
30-
python-version: '3.10'
30+
python-version: '3.13'
3131

3232
- name: Checkout ansible repo
3333
uses: actions/checkout@v7

‎AGENTS.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
## Source of Truth
44

55
- This is the official synchronous Python SDK for the Linode API. Supported
6-
Python versions come from [pyproject.toml](pyproject.toml) (`>=3.10`); do not
7-
infer support from the older environment names still present in [tox.ini](tox.ini).
6+
Python versions come from [pyproject.toml](pyproject.toml) (`>=3.11`).
87
- Make changes only in canonical source trees such as `linode_api4/`, `test/`,
98
`docs/`, `examples/`, and `.github/`. Do not edit generated copies or output in
109
`build/`, `dist/`, `docs/build/`, `docs/_build/`, or `linode_api4.egg-info/`.

‎README.rst‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,13 @@ Tests
102102
-----
103103

104104
Tests live in the ``test`` directory. When invoking tests, make sure you are
105-
in the root directory of this project. To run the full suite across all
106-
supported python versions, use tox_:
105+
in the root directory of this project. Install unit-test dependencies and run
106+
the mocked unit suite with:
107107

108108
.. code-block:: shell
109109
110-
tox
111-
112-
Running tox also runs pylint and coverage reports.
110+
python3 -m pip install -e ".[unit-test]"
111+
make test-unit
113112
114113
The test suite uses fixtures stored as JSON in ``test/fixtures``. These files
115114
contain sanitized JSON responses from the API - the file name is the URL called
@@ -131,8 +130,6 @@ from the api base url that should be returned, for example::
131130
linode = self.client.linode.instance_create('g6-standard-2', 'us-east')
132131
self.assertEqual(linode.id, 123) # passes
133132

134-
.. _tox: http://tox.readthedocs.io
135-
136133

137134
Integration Tests
138135
-----------------

‎linode_api4/groups/linode.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from linode_api4.objects.filtering import Filter
1919
from linode_api4.objects.linode import (
2020
Backup,
21+
InstanceACLPAlertsOptions,
2122
InstancePlacementGroupAssignment,
2223
InterfaceGeneration,
2324
NetworkInterface,
@@ -96,7 +97,6 @@ def stackscripts(self, *filters, **kwargs):
9697
:returns: A list of StackScripts matching the query.
9798
:rtype: PaginatedList of StackScript
9899
"""
99-
# python2 can't handle *args and a single keyword argument, so this is a workaround
100100
if "mine_only" in kwargs:
101101
if kwargs["mine_only"]:
102102
new_filter = Filter({"mine": True})
@@ -167,6 +167,9 @@ def instance_create(
167167
boot_size: Optional[int] = None,
168168
authorized_users: Optional[List[str]] = None,
169169
ipv4: Optional[List[str]] = None,
170+
alerts: Optional[
171+
Union[Dict[str, Any], InstanceACLPAlertsOptions]
172+
] = None,
170173
**kwargs,
171174
):
172175
"""
@@ -359,6 +362,9 @@ def instance_create(
359362
:param ipv4: A list of reserved IPv4 addresses to assign to this Instance.
360363
NOTE: Reserved IP feature may not currently be available to all users.
361364
:type ipv4: list[str]
365+
:param alerts: ACLP alerts available to define during instance creation.
366+
This is v4beta only and may not be available to all users.
367+
:type alerts: dict[str, Any] or InstanceACLPAlertsOptions
362368
363369
:returns: A new Instance object
364370
:rtype: Instance
@@ -385,6 +391,7 @@ def instance_create(
385391
"image": image,
386392
"root_pass": root_pass,
387393
"authorized_keys": load_and_validate_keys(authorized_keys),
394+
"alerts": alerts,
388395
"authorized_users": authorized_users,
389396
# These will automatically be flattened below
390397
"firewall_id": firewall,

‎linode_api4/groups/monitor.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
AkamaiObjectStorageLogsDestinationDetails,
2323
CustomHTTPSLogsDestinationDetails,
2424
LogsStreamDetails,
25+
LogsStreamQuota,
2526
)
2627

2728
__all__ = [
@@ -625,3 +626,18 @@ def stream_create(
625626
)
626627

627628
return LogsStream(self.client, result["id"], result)
629+
630+
def stream_quotas(self) -> PaginatedList:
631+
"""
632+
Retrieve quota definitions available for the authenticated account's streams.
633+
634+
This reads from ``/monitor/streams/quotas`` on the API v4 endpoint.
635+
636+
API Documentation: TODO
637+
638+
:returns: A paginated list of stream quota definitions.
639+
:rtype: PaginatedList[LogsStreamQuota]
640+
"""
641+
return self.client._get_objects(
642+
"/monitor/streams/quotas", LogsStreamQuota
643+
)

‎linode_api4/groups/nodebalancer.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,27 @@ def create(self, region, **kwargs):
3535
:param ipv4: A reserved IPv4 address to assign to this NodeBalancer.
3636
NOTE: Reserved IP feature may not currently be available to all users.
3737
:type ipv4: str
38+
:param type: The NodeBalancer type. Supported values include
39+
``common``, ``premium``, ``premium_40gb``, and
40+
``enterprise``. This cannot be changed after creation.
41+
NOTE: Creating premium or enterprise NodeBalancers may not
42+
currently be available to all users.
43+
:type type: str
44+
:param backend_connectivity: How this NodeBalancer communicates with
45+
backends (``legacy``, ``ipv6``, or ``vpc``). If omitted,
46+
the API infers a value from ``vpcs`` or config nodes, or
47+
returns ``undefined`` until the first node is added.
48+
``undefined`` cannot be sent by clients. This cannot be
49+
changed after creation.
50+
NOTE: This field may not currently be available to all users.
51+
:type backend_connectivity: NodeBalancerBackendConnectivity | str
52+
:param vpcs: VPC attachments for this NodeBalancer. Required when
53+
``backend_connectivity`` is ``vpc``.
54+
:type vpcs: list[dict]
55+
:param configs: NodeBalancer configs and optional nodes to create
56+
with this NodeBalancer. Node addresses must match the
57+
selected or inferred backend connectivity.
58+
:type configs: list[dict]
3859
3960
:returns: The new NodeBalancer
4061
:rtype: NodeBalancer

‎linode_api4/groups/vpc.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
VPCIPv6RangeOptions,
1212
)
1313
from linode_api4.objects.base import _flatten_request_body_recursive
14+
from linode_api4.objects.vpc import VPCType
1415
from linode_api4.paginated_list import PaginatedList
1516
from linode_api4.util import drop_null_keys
1617

@@ -44,6 +45,7 @@ def create(
4445
subnets: Optional[List[Dict[str, Any]]] = None,
4546
ipv6: Optional[List[Union[VPCIPv6RangeOptions, Dict[str, Any]]]] = None,
4647
ipv4: Optional[List[Union[VPCIPv4RangeOptions, Dict[str, Any]]]] = None,
48+
vpc_type: Optional[Union[VPCType, str]] = None,
4749
**kwargs,
4850
) -> VPC:
4951
"""
@@ -61,6 +63,11 @@ def create(
6163
:type subnets: List[Dict[str, Any]]
6264
:param ipv6: The IPv6 address ranges for this VPC.
6365
:type ipv6: List[Union[VPCIPv6RangeOptions, Dict[str, Any]]]
66+
:param vpc_type: The type of VPC to create. Defaults to ``regular`` on
67+
the API side. Set to ``rdma`` to create a GPUDirect
68+
RDMA VPC (requires the ``GPUDirect RDMA`` account
69+
capability).
70+
:type vpc_type: Optional[Union[VPCType, str]]
6471
:param ipv4: The IPv4 address ranges for this VPC. Note that IPv4 VPCs may not currently be available to all users.
6572
:type ipv4: List[Union[VPCIPv4RangeOptions, Dict[str, Any]]]
6673
@@ -73,6 +80,8 @@ def create(
7380
"description": description,
7481
"ipv4": ipv4,
7582
"ipv6": ipv6,
83+
"subnets": subnets,
84+
"vpc_type": vpc_type,
7685
}
7786

7887
if subnets is not None and len(subnets) > 0:

0 commit comments

Comments
 (0)