Skip to content

Commit af272cd

Browse files
Merge branch 'dev' into zhiwei/lock-doc-links
2 parents 33c6ac5 + 1a32329 commit af272cd

24 files changed

Lines changed: 510 additions & 124 deletions

.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@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # pin@release/v1.13.0
31+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # pin@release/v1.14.0

linode_api4/groups/linode.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ def instance_create(
322322
:param firewall: The firewall to attach this Linode to.
323323
:type firewall: int or Firewall
324324
:param disk_encryption: The disk encryption policy for this Linode.
325-
NOTE: Disk encryption may not currently be available to all users.
326325
:type disk_encryption: InstanceDiskEncryptionType or str
327326
:param interfaces: An array of Network Interfaces to add to this Linode’s Configuration Profile.
328327
At least one and up to three Interface objects can exist in this array.

linode_api4/groups/monitor.py

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
from typing import Any, Optional
1+
from typing import Any, Optional, Union
22

33
from linode_api4 import PaginatedList
44
from linode_api4.errors import UnexpectedResponseError
55
from linode_api4.groups import Group
66
from linode_api4.objects import (
77
AlertChannel,
88
AlertDefinition,
9+
AlertDefinitionEntity,
10+
AlertScope,
911
MonitorDashboard,
1012
MonitorMetricsDefinition,
1113
MonitorService,
@@ -221,6 +223,8 @@ def create_alert_definition(
221223
trigger_conditions: dict,
222224
entity_ids: Optional[list[str]] = None,
223225
description: Optional[str] = None,
226+
scope: Optional[Union[AlertScope, str]] = None,
227+
regions: Optional[list[str]] = None,
224228
) -> AlertDefinition:
225229
"""
226230
Create a new alert definition for a given service type.
@@ -252,6 +256,10 @@ def create_alert_definition(
252256
:type entity_ids: Optional[list[str]]
253257
:param description: (Optional) Longer description for the alert definition.
254258
:type description: Optional[str]
259+
:param scope: (Optional) Alert scope (for example: `account`, `entity`, or `region`). Defaults to `entity`.
260+
:type scope: Optional[Union[AlertScope, str]]
261+
:param regions: (Optional) Regions to monitor.
262+
:type regions: Optional[list[str]]
255263
256264
:returns: The newly created :class:`AlertDefinition`.
257265
:rtype: AlertDefinition
@@ -267,10 +275,15 @@ def create_alert_definition(
267275
"rule_criteria": rule_criteria,
268276
"trigger_conditions": trigger_conditions,
269277
}
270-
if description is not None:
271-
params["description"] = description
278+
272279
if entity_ids is not None:
273280
params["entity_ids"] = entity_ids
281+
if description is not None:
282+
params["description"] = description
283+
if scope is not None:
284+
params["scope"] = scope
285+
if regions is not None:
286+
params["regions"] = regions
274287

275288
# API will validate service_type and return an error if missing
276289
result = self.client.post(
@@ -284,3 +297,38 @@ def create_alert_definition(
284297
)
285298

286299
return AlertDefinition(self.client, result["id"], service_type, result)
300+
301+
def alert_definition_entities(
302+
self,
303+
service_type: str,
304+
id: int,
305+
*filters,
306+
) -> PaginatedList:
307+
"""
308+
List entities associated with a specific alert definition.
309+
310+
This endpoint supports pagination fields (`page`, `page_size`) in the API.
311+
312+
.. note:: This endpoint is in beta and requires using the v4beta base URL.
313+
314+
API Documentation: TODO
315+
316+
:param service_type: Service type for the alert definition (e.g. `dbaas`).
317+
:type service_type: str
318+
:param id: Alert definition identifier.
319+
:type id: int
320+
:param filters: Optional filter expressions to apply to the collection.
321+
See :doc:`Filtering Collections</linode_api4/objects/filtering>`.
322+
323+
:returns: A paginated list of entities associated with the alert definition.
324+
:rtype: PaginatedList[AlertDefinitionEntity]
325+
"""
326+
327+
endpoint = (
328+
f"/monitor/services/{service_type}/alert-definitions/{id}/entities"
329+
)
330+
return self.client._get_and_filter(
331+
AlertDefinitionEntity,
332+
*filters,
333+
endpoint=endpoint,
334+
)

linode_api4/groups/object_storage.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
ObjectStorageACL,
2020
ObjectStorageBucket,
2121
ObjectStorageCluster,
22+
ObjectStorageGlobalQuota,
2223
ObjectStorageKeyPermission,
2324
ObjectStorageKeys,
2425
ObjectStorageQuota,
@@ -533,3 +534,18 @@ def quotas(self, *filters):
533534
:rtype: PaginatedList of ObjectStorageQuota
534535
"""
535536
return self.client._get_and_filter(ObjectStorageQuota, *filters)
537+
538+
def global_quotas(self, *filters):
539+
"""
540+
Lists the active account-level Object Storage quotas applied to your account.
541+
542+
API Documentation: TBD
543+
544+
:param filters: Any number of filters to apply to this query.
545+
See :doc:`Filtering Collections</linode_api4/objects/filtering>`
546+
for more details on filtering.
547+
548+
:returns: A list of account-level Object Storage Quotas that matched the query.
549+
:rtype: PaginatedList of ObjectStorageGlobalQuota
550+
"""
551+
return self.client._get_and_filter(ObjectStorageGlobalQuota, *filters)

linode_api4/groups/volume.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def create(self, label, region=None, linode=None, size=20, **kwargs):
4848
:type tags: list[str]
4949
:param encryption: Whether the new Volume should opt in or out of disk encryption.
5050
:type encryption: str
51-
Note: Block Storage Disk Encryption is not currently available to all users.
5251
:returns: The new Volume.
5352
:rtype: Volume
5453
"""

linode_api4/objects/linode.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,6 @@ def disk_create(
14481448
should already be set up, see :any:`ProfileGroup.ssh_keys`
14491449
for details.
14501450
:param disk_encryption: The disk encryption policy for this Linode.
1451-
NOTE: Disk encryption may not currently be available to all users.
14521451
:type disk_encryption: InstanceDiskEncryptionType or str
14531452
:param stackscript: A StackScript object, or the ID of one, to deploy to this
14541453
disk. Requires deploying a compatible image.
@@ -1642,7 +1641,6 @@ def rebuild(
16421641
the key.
16431642
:type authorized_keys: list or str
16441643
:param disk_encryption: The disk encryption policy for this Linode.
1645-
NOTE: Disk encryption may not currently be available to all users.
16461644
:type disk_encryption: InstanceDiskEncryptionType or str
16471645
16481646
:returns: The newly generated password, if one was not provided
@@ -2057,8 +2055,6 @@ def interface_create(
20572055
Creates a new interface under this Linode.
20582056
Linode interfaces are not interchangeable with Config interfaces.
20592057
2060-
NOTE: Linode interfaces may not currently be available to all users.
2061-
20622058
API Documentation: https://techdocs.akamai.com/linode-api/reference/post-linode-interface
20632059
20642060
Example: Creating a simple public interface for this Linode::
@@ -2134,8 +2130,6 @@ def interfaces_settings(self) -> LinodeInterfacesSettings:
21342130
"""
21352131
The settings for all interfaces under this Linode.
21362132
2137-
NOTE: Linode interfaces may not currently be available to all users.
2138-
21392133
:returns: The settings for instance-level interface settings for this Linode.
21402134
:rtype: LinodeInterfacesSettings
21412135
"""
@@ -2204,8 +2198,6 @@ def upgrade_interfaces(
22042198
NOTE: If dry_run is True, interfaces in the result will be
22052199
of type MappedObject rather than LinodeInterface.
22062200
2207-
NOTE: Linode interfaces may not currently be available to all users.
2208-
22092201
API Documentation: https://techdocs.akamai.com/linode-api/reference/post-upgrade-linode-interfaces
22102202
22112203
:param config: The configuration profile the legacy interfaces to

0 commit comments

Comments
 (0)