Skip to content

Commit c2a8c6f

Browse files
Merge branch 'dev' into zhiwei/firewall-rules-version-fingerprint
2 parents 070ba92 + 4fec1e5 commit c2a8c6f

13 files changed

Lines changed: 235 additions & 15 deletions

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/objects/monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ class AlertDefinition(DerivedBase):
433433
"severity": Property(mutable=True),
434434
"type": Property(mutable=True),
435435
"status": Property(mutable=True),
436-
"has_more_resources": Property(), # Deprecated; use entities.has_more_resources.
437436
"rule_criteria": Property(mutable=True, json_object=RuleCriteria),
438437
"trigger_conditions": Property(
439438
mutable=True, json_object=TriggerConditions
@@ -449,6 +448,7 @@ class AlertDefinition(DerivedBase):
449448
"scope": Property(AlertScope),
450449
"regions": Property(mutable=True),
451450
"entities": Property(json_object=AlertEntities),
451+
"channel_ids": Property(mutable=True),
452452
}
453453

454454

linode_api4/objects/object_storage.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,8 @@ class ObjectStorageQuota(Base):
596596
"description": Property(),
597597
"quota_limit": Property(),
598598
"resource_metric": Property(),
599+
"quota_type": Property(),
600+
"has_usage": Property(),
599601
}
600602

601603
def usage(self):
@@ -614,3 +616,41 @@ def usage(self):
614616
)
615617

616618
return ObjectStorageQuotaUsage.from_json(result)
619+
620+
621+
class ObjectStorageGlobalQuota(Base):
622+
"""
623+
An account-level Object Storage quota.
624+
625+
API documentation: TBD
626+
"""
627+
628+
api_endpoint = "/object-storage/global-quotas/{quota_id}"
629+
id_attribute = "quota_id"
630+
631+
properties = {
632+
"quota_id": Property(identifier=True),
633+
"quota_type": Property(),
634+
"quota_name": Property(),
635+
"description": Property(),
636+
"resource_metric": Property(),
637+
"quota_limit": Property(),
638+
"has_usage": Property(),
639+
}
640+
641+
def usage(self):
642+
"""
643+
Gets usage data for a specific account-level Object Storage quota.
644+
645+
API documentation: https://techdocs.akamai.com/linode-api/reference/get-object-storage-global-quota-usage
646+
647+
:returns: The Object Storage Global Quota usage.
648+
:rtype: ObjectStorageQuotaUsage
649+
"""
650+
651+
result = self._client.get(
652+
f"{type(self).api_endpoint}/usage",
653+
model=self,
654+
)
655+
656+
return ObjectStorageQuotaUsage.from_json(result)

test/fixtures/monitor_alert-definitions.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"description": "A test alert for dbaas service",
1010
"scope": "entity",
1111
"regions": [],
12-
"entity_ids": ["13217"],
1312
"entities": {
1413
"url": "/monitor/services/dbaas/alert-definitions/12345/entities",
1514
"count": 1,
@@ -23,7 +22,6 @@
2322
"url": "/monitor/alert-channels/10000"
2423
}
2524
],
26-
"has_more_resources": false,
2725
"rule_criteria": null,
2826
"trigger_conditions": null,
2927
"class": "alert",

test/fixtures/monitor_services_dbaas_alert-definitions.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"description": "A test alert for dbaas service",
1010
"scope": "entity",
1111
"regions": [],
12-
"entity_ids": [
13-
"13217"
14-
],
1512
"entities": {
1613
"url": "/monitor/services/dbaas/alert-definitions/12345/entities",
1714
"count": 1,
@@ -25,7 +22,6 @@
2522
"url": "/monitor/alert-channels/10000"
2623
}
2724
],
28-
"has_more_resources": false,
2925
"rule_criteria": {
3026
"rules": [
3127
{

test/fixtures/monitor_services_dbaas_alert-definitions_12345.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"description": "A test alert for dbaas service",
88
"scope": "entity",
99
"regions": [],
10-
"entity_ids": [
11-
"13217"
12-
],
1310
"entities": {
1411
"url": "/monitor/services/dbaas/alert-definitions/12345/entities",
1512
"count": 1,
@@ -23,7 +20,6 @@
2320
"url": "/monitor/alert-channels/10000"
2421
}
2522
],
26-
"has_more_resources": false,
2723
"rule_criteria": {
2824
"rules": [
2925
{
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-access-keys-per-account",
5+
"quota_type": "obj-access-keys",
6+
"quota_name": "Object Storage Access Keys per Account",
7+
"description": "Maximum number of access keys this customer is allowed to have on their account.",
8+
"resource_metric": "access_key",
9+
"quota_limit": 100,
10+
"has_usage": true
11+
},
12+
{
13+
"quota_id": "obj-total-capacity-per-account",
14+
"quota_type": "obj-total-capacity",
15+
"quota_name": "Object Storage Total Capacity per Account",
16+
"description": "Maximum total storage capacity in bytes this customer is allowed on their account.",
17+
"resource_metric": "byte",
18+
"quota_limit": 1099511627776,
19+
"has_usage": true
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-access-keys-per-account",
3+
"quota_type": "obj-access-keys",
4+
"quota_name": "Object Storage Access Keys per Account",
5+
"description": "Maximum number of access keys this customer is allowed to have on their account.",
6+
"resource_metric": "access_key",
7+
"quota_limit": 100,
8+
"has_usage": true
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": 25
4+
}

test/fixtures/object-storage_quotas.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"endpoint_type": "E1",
88
"s3_endpoint": "us-iad-1.linodeobjects.com",
99
"quota_limit": 50,
10-
"resource_metric": "object"
10+
"resource_metric": "object",
11+
"quota_type": "obj-objects",
12+
"has_usage": true
1113
},
1214
{
1315
"quota_id": "obj-bucket-us-ord-1",
@@ -16,7 +18,9 @@
1618
"endpoint_type": "E1",
1719
"s3_endpoint": "us-iad-1.linodeobjects.com",
1820
"quota_limit": 50,
19-
"resource_metric": "bucket"
21+
"resource_metric": "bucket",
22+
"quota_type": "obj-bucket",
23+
"has_usage": true
2024
}
2125
],
2226
"page": 1,

0 commit comments

Comments
 (0)