object_storage_quota.go raw

   1  package linodego
   2  
   3  import (
   4  	"context"
   5  )
   6  
   7  // ObjectStorageQuota represents a Object Storage related quota information on your account.
   8  type ObjectStorageQuota struct {
   9  	QuotaID        string `json:"quota_id"`
  10  	QuotaName      string `json:"quota_name"`
  11  	EndpointType   string `json:"endpoint_type"`
  12  	S3Endpoint     string `json:"s3_endpoint"`
  13  	Description    string `json:"description"`
  14  	QuotaLimit     int    `json:"quota_limit"`
  15  	ResourceMetric string `json:"resource_metric"`
  16  }
  17  
  18  // ObjectStorageQuotaUsage is the usage data for a specific Object Storage related quota on your account.
  19  type ObjectStorageQuotaUsage struct {
  20  	QuotaLimit int  `json:"quota_limit"`
  21  	Usage      *int `json:"usage"`
  22  }
  23  
  24  // ListObjectStorageQuotas lists the active ObjectStorage-related quotas applied to your account.
  25  func (c *Client) ListObjectStorageQuotas(ctx context.Context, opts *ListOptions) ([]ObjectStorageQuota, error) {
  26  	return getPaginatedResults[ObjectStorageQuota](ctx, c, formatAPIPath("object-storage/quotas"), opts)
  27  }
  28  
  29  // GetObjectStorageQuota gets information about a specific ObjectStorage-related quota on your account.
  30  func (c *Client) GetObjectStorageQuota(ctx context.Context, quotaID string) (*ObjectStorageQuota, error) {
  31  	e := formatAPIPath("object-storage/quotas/%s", quotaID)
  32  	return doGETRequest[ObjectStorageQuota](ctx, c, e)
  33  }
  34  
  35  // GetObjectStorageQuotaUsage gets usage data for a specific ObjectStorage Quota resource you can have on your account and the current usage for that resource.
  36  func (c *Client) GetObjectStorageQuotaUsage(ctx context.Context, quotaID string) (*ObjectStorageQuotaUsage, error) {
  37  	e := formatAPIPath("object-storage/quotas/%s/usage", quotaID)
  38  	return doGETRequest[ObjectStorageQuotaUsage](ctx, c, e)
  39  }
  40