Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions object_storage_quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type ObjectStorageQuota struct {
Description string `json:"description"`
QuotaLimit int `json:"quota_limit"`
ResourceMetric string `json:"resource_metric"`
QuotaType string `json:"quota_type"`
HasUsage bool `json:"has_usage"`
}

// ObjectStorageQuotaUsage is the usage data for a specific Object Storage related quota on your account.
Expand All @@ -21,6 +23,23 @@ type ObjectStorageQuotaUsage struct {
Usage *int `json:"usage"`
}

// ObjectStorageGlobalQuota represents global/account-level Object Storage quota information.
type ObjectStorageGlobalQuota struct {
QuotaID string `json:"quota_id"`
QuotaName string `json:"quota_name"`
QuotaType string `json:"quota_type"`
Description string `json:"description"`
QuotaLimit int `json:"quota_limit"`
ResourceMetric string `json:"resource_metric"`
HasUsage bool `json:"has_usage"`
}

// ObjectStorageGlobalQuotaUsage is the usage data for a specific global/account-level Object Storage quota.
type ObjectStorageGlobalQuotaUsage struct {
QuotaLimit int `json:"quota_limit"`
Usage *int `json:"usage"`
}

// ListObjectStorageQuotas lists the active ObjectStorage-related quotas applied to your account.
func (c *Client) ListObjectStorageQuotas(ctx context.Context, opts *ListOptions) ([]ObjectStorageQuota, error) {
return getPaginatedResults[ObjectStorageQuota](ctx, c, formatAPIPath("object-storage/quotas"), opts)
Expand All @@ -37,3 +56,20 @@ func (c *Client) GetObjectStorageQuotaUsage(ctx context.Context, quotaID string)
e := formatAPIPath("object-storage/quotas/%s/usage", quotaID)
return doGETRequest[ObjectStorageQuotaUsage](ctx, c, e)
}

// ListObjectStorageGlobalQuotas lists the global/account-level ObjectStorage-related quotas applied to your account.
func (c *Client) ListObjectStorageGlobalQuotas(ctx context.Context, opts *ListOptions) ([]ObjectStorageGlobalQuota, error) {
return getPaginatedResults[ObjectStorageGlobalQuota](ctx, c, formatAPIPath("object-storage/global-quotas"), opts)
}

// GetObjectStorageGlobalQuota gets information about a specific global/account-level ObjectStorage-related quota on your account.
func (c *Client) GetObjectStorageGlobalQuota(ctx context.Context, quotaID string) (*ObjectStorageGlobalQuota, error) {
e := formatAPIPath("object-storage/global-quotas/%s", quotaID)
return doGETRequest[ObjectStorageGlobalQuota](ctx, c, e)
}

// GetObjectStorageGlobalQuotaUsage gets usage data for a specific global/account-level ObjectStorage quota resource.
func (c *Client) GetObjectStorageGlobalQuotaUsage(ctx context.Context, quotaID string) (*ObjectStorageGlobalQuotaUsage, error) {
e := formatAPIPath("object-storage/global-quotas/%s/usage", quotaID)
return doGETRequest[ObjectStorageGlobalQuotaUsage](ctx, c, e)
}
130 changes: 130 additions & 0 deletions test/integration/fixtures/TestObjectStorageGlobalQuotaUsage_Get.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/object-storage/global-quotas?page=1
method: GET
response:
body: '{"data": [{"quota_id": "keys", "quota_name": "Number of Access Keys", "quota_type":
"keys", "description": "Current number of access keys per account", "quota_limit":
100, "resource_metric": "key", "has_usage": true}], "page": 1, "pages": 1, "results":
1}'
headers:
Access-Control-Allow-Credentials:
- "true"
Access-Control-Allow-Headers:
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter
Access-Control-Allow-Methods:
- HEAD, GET, OPTIONS, POST, PUT, DELETE
Access-Control-Allow-Origin:
- '*'
Access-Control-Expose-Headers:
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
Akamai-Internal-Account:
- '*'
Cache-Control:
- max-age=0, no-cache, no-store
Connection:
- keep-alive
Content-Length:
- "255"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Wed, 18 Feb 2026 07:24:58 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization, X-Filter
- Authorization, X-Filter
X-Accepted-Oauth-Scopes:
- object_storage:read_only
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
- DENY
X-Oauth-Scopes:
- '*'
X-Ratelimit-Limit:
- "1840"
X-Xss-Protection:
- 1; mode=block
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/object-storage/global-quotas/keys/usage
method: GET
response:
body: '{"quota_limit": 100, "usage": 0}'
headers:
Access-Control-Allow-Credentials:
- "true"
Access-Control-Allow-Headers:
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter
Access-Control-Allow-Methods:
- HEAD, GET, OPTIONS, POST, PUT, DELETE
Access-Control-Allow-Origin:
- '*'
Access-Control-Expose-Headers:
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
Akamai-Internal-Account:
- '*'
Cache-Control:
- max-age=0, no-cache, no-store
Connection:
- keep-alive
Content-Length:
- "32"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Wed, 18 Feb 2026 07:24:59 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization, X-Filter
- Authorization, X-Filter
X-Accepted-Oauth-Scopes:
- object_storage:read_only
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
- DENY
X-Oauth-Scopes:
- '*'
X-Ratelimit-Limit:
- "1840"
X-Xss-Protection:
- 1; mode=block
status: 200 OK
code: 200
duration: ""
132 changes: 132 additions & 0 deletions test/integration/fixtures/TestObjectStorageGlobalQuotas_Get.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/object-storage/global-quotas?page=1
method: GET
response:
body: '{"data": [{"quota_id": "keys", "quota_name": "Number of Access Keys", "quota_type":
"keys", "description": "Current number of access keys per account", "quota_limit":
100, "resource_metric": "key", "has_usage": true}], "page": 1, "pages": 1, "results":
1}'
headers:
Access-Control-Allow-Credentials:
- "true"
Access-Control-Allow-Headers:
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter
Access-Control-Allow-Methods:
- HEAD, GET, OPTIONS, POST, PUT, DELETE
Access-Control-Allow-Origin:
- '*'
Access-Control-Expose-Headers:
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
Akamai-Internal-Account:
- '*'
Cache-Control:
- max-age=0, no-cache, no-store
Connection:
- keep-alive
Content-Length:
- "255"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Wed, 18 Feb 2026 07:24:08 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization, X-Filter
- Authorization, X-Filter
X-Accepted-Oauth-Scopes:
- object_storage:read_only
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
- DENY
X-Oauth-Scopes:
- '*'
X-Ratelimit-Limit:
- "1840"
X-Xss-Protection:
- 1; mode=block
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/object-storage/global-quotas/keys
method: GET
response:
body: '{"quota_id": "keys", "quota_name": "Number of Access Keys", "quota_type":
"keys", "description": "Current number of access keys per account", "quota_limit":
100, "resource_metric": "key", "has_usage": true}'
headers:
Access-Control-Allow-Credentials:
- "true"
Access-Control-Allow-Headers:
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter
Access-Control-Allow-Methods:
- HEAD, GET, OPTIONS, POST, PUT, DELETE
Access-Control-Allow-Origin:
- '*'
Access-Control-Expose-Headers:
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
Akamai-Internal-Account:
- '*'
Cache-Control:
- max-age=0, no-cache, no-store
Connection:
- keep-alive
Content-Length:
- "206"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Wed, 18 Feb 2026 07:24:08 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization, X-Filter
- Authorization, X-Filter
X-Accepted-Oauth-Scopes:
- object_storage:read_only
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
- DENY
X-Oauth-Scopes:
- '*'
X-Ratelimit-Limit:
- "1840"
X-Xss-Protection:
- 1; mode=block
status: 200 OK
code: 200
duration: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/object-storage/global-quotas?page=1
method: GET
response:
body: '{"data": [{"quota_id": "keys", "quota_name": "Number of Access Keys", "quota_type":
"keys", "description": "Current number of access keys per account", "quota_limit":
100, "resource_metric": "key", "has_usage": true}], "page": 1, "pages": 1, "results":
1}'
headers:
Access-Control-Allow-Credentials:
- "true"
Access-Control-Allow-Headers:
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter
Access-Control-Allow-Methods:
- HEAD, GET, OPTIONS, POST, PUT, DELETE
Access-Control-Allow-Origin:
- '*'
Access-Control-Expose-Headers:
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status
Akamai-Internal-Account:
- '*'
Cache-Control:
- max-age=0, no-cache, no-store
Connection:
- keep-alive
Content-Length:
- "255"
Content-Security-Policy:
- default-src 'none'
Content-Type:
- application/json
Expires:
- Wed, 18 Feb 2026 07:24:08 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization, X-Filter
- Authorization, X-Filter
X-Accepted-Oauth-Scopes:
- object_storage:read_only
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
- DENY
X-Oauth-Scopes:
- '*'
X-Ratelimit-Limit:
- "1840"
X-Xss-Protection:
- 1; mode=block
status: 200 OK
code: 200
duration: ""
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ interactions:
body: '{"quota_id": "obj-objects-us-ord-1.linodeobjects.com", "quota_name": "max_objects",
"endpoint_type": "E1", "s3_endpoint": "us-ord-1.linodeobjects.com", "description":
"Maximum number of objects this customer is allowed to have on this endpoint",
"quota_limit": 100000000, "resource_metric": "object"}'
"quota_limit": 100000000, "resource_metric": "object", "quota_type": "obj-objects",
"has_usage": true}'
headers:
Access-Control-Allow-Credentials:
- "true"
Expand Down
Loading