Skip to content

Commit 24dd9e4

Browse files
Merge branch 'dev' into proj/enhanced-interfaces
2 parents 6e9a204 + 3a1ec42 commit 24dd9e4

File tree

12 files changed

+210
-7
lines changed

12 files changed

+210
-7
lines changed

.github/workflows/e2e-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ jobs:
232232
steps:
233233
- name: Notify Slack
234234
id: main_message
235-
uses: slackapi/slack-github-action@v2.0.0
235+
uses: slackapi/slack-github-action@v2.1.0
236236
with:
237237
method: chat.postMessage
238238
token: ${{ secrets.SLACK_BOT_TOKEN }}
@@ -264,7 +264,7 @@ jobs:
264264
265265
- name: Test summary thread
266266
if: success()
267-
uses: slackapi/slack-github-action@v2.0.0
267+
uses: slackapi/slack-github-action@v2.1.0
268268
with:
269269
method: chat.postMessage
270270
token: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/nightly-smoke-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545

4646
- name: Notify Slack
4747
if: always() && github.repository == 'linode/linode_api4-python'
48-
uses: slackapi/slack-github-action@v2.0.0
48+
uses: slackapi/slack-github-action@v2.1.0
4949
with:
5050
method: chat.postMessage
5151
token: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/publish-pypi.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ on:
55
types: [ published ]
66
jobs:
77
pypi-release:
8+
permissions:
9+
# IMPORTANT: this permission is mandatory for trusted publishing
10+
id-token: write
811
runs-on: ubuntu-latest
12+
environment: pypi-release
913
steps:
1014
- name: Checkout
1115
uses: actions/checkout@v4
@@ -25,5 +29,3 @@ jobs:
2529

2630
- name: Publish the release artifacts to PyPI
2731
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # pin@release/v1.12.4
28-
with:
29-
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/release-notify-slack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- name: Notify Slack - Main Message
1313
id: main_message
14-
uses: slackapi/slack-github-action@v2.0.0
14+
uses: slackapi/slack-github-action@v2.1.0
1515
with:
1616
method: chat.postMessage
1717
token: ${{ secrets.SLACK_BOT_TOKEN }}

linode_api4/groups/object_storage.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ObjectStorageCluster,
2222
ObjectStorageKeyPermission,
2323
ObjectStorageKeys,
24+
ObjectStorageQuota,
2425
)
2526
from linode_api4.util import drop_null_keys
2627

@@ -517,3 +518,18 @@ def object_url_create(
517518
)
518519

519520
return MappedObject(**result)
521+
522+
def quotas(self, *filters):
523+
"""
524+
Lists the active ObjectStorage-related quotas applied to your account.
525+
526+
API Documentation: https://techdocs.akamai.com/linode-api/reference/get-object-storage-quotas
527+
528+
:param filters: Any number of filters to apply to this query.
529+
See :doc:`Filtering Collections</linode_api4/objects/filtering>`
530+
for more details on filtering.
531+
532+
:returns: A list of Object Storage Quotas that matched the query.
533+
:rtype: PaginatedList of ObjectStorageQuota
534+
"""
535+
return self.client._get_and_filter(ObjectStorageQuota, *filters)

linode_api4/objects/object_storage.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ class ObjectStorageEndpoint(JSONObject):
5151
s3_endpoint: Optional[str] = None
5252

5353

54+
@dataclass
55+
class ObjectStorageQuotaUsage(JSONObject):
56+
"""
57+
ObjectStorageQuotaUsage contains the fields of an object storage quota usage information.
58+
"""
59+
60+
quota_limit: int = 0
61+
usage: int = 0
62+
63+
5464
class ObjectStorageType(Base):
5565
"""
5666
An ObjectStorageType represents the structure of a valid Object Storage type.
@@ -566,3 +576,41 @@ class ObjectStorageKeys(Base):
566576
"limited": Property(),
567577
"regions": Property(unordered=True),
568578
}
579+
580+
581+
class ObjectStorageQuota(Base):
582+
"""
583+
An Object Storage related quota information on your account.
584+
585+
API documentation: https://techdocs.akamai.com/linode-api/reference/get-object-storage-quota
586+
"""
587+
588+
api_endpoint = "/object-storage/quotas/{quota_id}"
589+
id_attribute = "quota_id"
590+
591+
properties = {
592+
"quota_id": Property(identifier=True),
593+
"quota_name": Property(),
594+
"endpoint_type": Property(),
595+
"s3_endpoint": Property(),
596+
"description": Property(),
597+
"quota_limit": Property(),
598+
"resource_metric": Property(),
599+
}
600+
601+
def usage(self):
602+
"""
603+
Gets usage data for a specific ObjectStorage Quota resource you can have on your account and the current usage for that resource.
604+
605+
API documentation: https://techdocs.akamai.com/linode-api/reference/get-object-storage-quota-usage
606+
607+
:returns: The Object Storage Quota usage.
608+
:rtype: ObjectStorageQuotaUsage
609+
"""
610+
611+
result = self._client.get(
612+
f"{type(self).api_endpoint}/usage",
613+
model=self,
614+
)
615+
616+
return ObjectStorageQuotaUsage.from_json(result)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"data": [
3+
{
4+
"quota_id": "obj-objects-us-ord-1",
5+
"quota_name": "Object Storage Maximum Objects",
6+
"description": "Maximum number of Objects this customer is allowed to have on this endpoint.",
7+
"endpoint_type": "E1",
8+
"s3_endpoint": "us-iad-1.linodeobjects.com",
9+
"quota_limit": 50,
10+
"resource_metric": "object"
11+
},
12+
{
13+
"quota_id": "obj-bucket-us-ord-1",
14+
"quota_name": "Object Storage Maximum Buckets",
15+
"description": "Maximum number of buckets this customer is allowed to have on this endpoint.",
16+
"endpoint_type": "E1",
17+
"s3_endpoint": "us-iad-1.linodeobjects.com",
18+
"quota_limit": 50,
19+
"resource_metric": "bucket"
20+
}
21+
],
22+
"page": 1,
23+
"pages": 1,
24+
"results": 2
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"quota_id": "obj-objects-us-ord-1",
3+
"quota_name": "Object Storage Maximum Objects",
4+
"description": "Maximum number of Objects this customer is allowed to have on this endpoint.",
5+
"endpoint_type": "E1",
6+
"s3_endpoint": "us-iad-1.linodeobjects.com",
7+
"quota_limit": 50,
8+
"resource_metric": "object"
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"quota_limit": 100,
3+
"usage": 10
4+
}

test/integration/models/lke/test_lke.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ def _to_comparable(p: LKENodePool) -> Dict[str, Any]:
208208

209209
assert _to_comparable(cluster.pools[0]) == _to_comparable(pool)
210210

211-
assert pool.disk_encryption == InstanceDiskEncryptionType.disabled
211+
assert pool.disk_encryption in (
212+
InstanceDiskEncryptionType.enabled,
213+
InstanceDiskEncryptionType.disabled,
214+
)
212215

213216

214217
def test_cluster_dashboard_url_view(lke_cluster):

0 commit comments

Comments
 (0)