traefik/vendor/github.com/exoscale/egoscale/limits.go

140 lines
9.5 KiB
Go
Raw Normal View History

package egoscale
// https://github.com/apache/cloudstack/blob/master/api/src/main/java/com/cloud/configuration/Resource.java
// ResourceTypeName represents the name of a resource type (for limits)
type ResourceTypeName string
const (
// VirtualMachineTypeName is the resource type name of a VM
VirtualMachineTypeName ResourceTypeName = "user_vm"
// IPAddressTypeName is the resource type name of an IP address
2018-09-14 08:06:03 +00:00
IPAddressTypeName ResourceTypeName = "public_ip"
// VolumeTypeName is the resource type name of a volume
2018-09-14 08:06:03 +00:00
VolumeTypeName ResourceTypeName = "volume"
// SnapshotTypeName is the resource type name of a snapshot
2018-09-14 08:06:03 +00:00
SnapshotTypeName ResourceTypeName = "snapshot"
// TemplateTypeName is the resource type name of a template
2018-09-14 08:06:03 +00:00
TemplateTypeName ResourceTypeName = "template"
// ProjectTypeName is the resource type name of a project
2018-09-14 08:06:03 +00:00
ProjectTypeName ResourceTypeName = "project"
// NetworkTypeName is the resource type name of a network
2018-09-14 08:06:03 +00:00
NetworkTypeName ResourceTypeName = "network"
// VPCTypeName is the resource type name of a VPC
2018-09-14 08:06:03 +00:00
VPCTypeName ResourceTypeName = "vpc"
// CPUTypeName is the resource type name of a CPU
2018-09-14 08:06:03 +00:00
CPUTypeName ResourceTypeName = "cpu"
// MemoryTypeName is the resource type name of Memory
2018-09-14 08:06:03 +00:00
MemoryTypeName ResourceTypeName = "memory"
// PrimaryStorageTypeName is the resource type name of primary storage
2018-09-14 08:06:03 +00:00
PrimaryStorageTypeName ResourceTypeName = "primary_storage"
// SecondaryStorageTypeName is the resource type name of secondary storage
2018-09-14 08:06:03 +00:00
SecondaryStorageTypeName ResourceTypeName = "secondary_storage"
)
// ResourceType represents the ID of a resource type (for limits)
2018-09-14 08:06:03 +00:00
type ResourceType string
const (
// VirtualMachineType is the resource type ID of a VM
2018-09-14 08:06:03 +00:00
VirtualMachineType ResourceType = "0"
// IPAddressType is the resource type ID of an IP address
2018-09-14 08:06:03 +00:00
IPAddressType ResourceType = "1"
// VolumeType is the resource type ID of a volume
2018-09-14 08:06:03 +00:00
VolumeType ResourceType = "2"
// SnapshotType is the resource type ID of a snapshot
2018-09-14 08:06:03 +00:00
SnapshotType ResourceType = "3"
// TemplateType is the resource type ID of a template
2018-09-14 08:06:03 +00:00
TemplateType ResourceType = "4"
// ProjectType is the resource type ID of a project
2018-09-14 08:06:03 +00:00
ProjectType ResourceType = "5"
// NetworkType is the resource type ID of a network
2018-09-14 08:06:03 +00:00
NetworkType ResourceType = "6"
// VPCType is the resource type ID of a VPC
2018-09-14 08:06:03 +00:00
VPCType ResourceType = "7"
// CPUType is the resource type ID of a CPU
2018-09-14 08:06:03 +00:00
CPUType ResourceType = "8"
// MemoryType is the resource type ID of Memory
2018-09-14 08:06:03 +00:00
MemoryType ResourceType = "9"
// PrimaryStorageType is the resource type ID of primary storage
2018-09-14 08:06:03 +00:00
PrimaryStorageType ResourceType = "10"
// SecondaryStorageType is the resource type ID of secondary storage
2018-09-14 08:06:03 +00:00
SecondaryStorageType ResourceType = "11"
)
2018-09-14 08:06:03 +00:00
// ResourceLimit represents the limit on a particular resource
type ResourceLimit struct {
Account string `json:"account,omitempty" doc:"the account of the resource limit"`
Domain string `json:"domain,omitempty" doc:"the domain name of the resource limit"`
DomainID string `json:"domainid,omitempty" doc:"the domain ID of the resource limit"`
Max int64 `json:"max,omitempty" doc:"the maximum number of the resource. A -1 means the resource currently has no limit."`
ResourceType ResourceType `json:"resourcetype,omitempty" doc:"resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values."`
ResourceTypeName string `json:"resourcetypename,omitempty" doc:"resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage."`
}
2018-09-14 08:06:03 +00:00
// APILimit represents the limit count
type APILimit struct {
Account string `json:"account,omitempty" doc:"the account name of the api remaining count"`
Accountid string `json:"accountid,omitempty" doc:"the account uuid of the api remaining count"`
APIAllowed int `json:"apiAllowed,omitempty" doc:"currently allowed number of apis"`
APIIssued int `json:"apiIssued,omitempty" doc:"number of api already issued"`
ExpireAfter int64 `json:"expireAfter,omitempty" doc:"seconds left to reset counters"`
}
2018-09-14 08:06:03 +00:00
// ListResourceLimits lists the resource limits
type ListResourceLimits struct {
Account string `json:"account,omitempty" doc:"list resources by account. Must be used with the domainId parameter."`
DomainID string `json:"domainid,omitempty" doc:"list only resources belonging to the domain specified"`
ID int64 `json:"id,omitempty" doc:"Lists resource limits by ID."`
IsRecursive *bool `json:"isrecursive,omitempty" doc:"defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves."`
Keyword string `json:"keyword,omitempty" doc:"List by keyword"`
ListAll *bool `json:"listall,omitempty" doc:"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"`
Page int `json:"page,omitempty"`
PageSize int `json:"pagesize,omitempty"`
ResourceType ResourceType `json:"resourcetype,omitempty" doc:"Type of resource. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses an account can own. 2 - Volume. Number of disk volumes an account can own. 3 - Snapshot. Number of snapshots an account can own. 4 - Template. Number of templates an account can register/create. 5 - Project. Number of projects an account can own. 6 - Network. Number of networks an account can own. 7 - VPC. Number of VPC an account can own. 8 - CPU. Number of CPU an account can allocate for his resources. 9 - Memory. Amount of RAM an account can allocate for his resources. 10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. 11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. 12 - Elastic IP. Number of public elastic IP addresses an account can own. 13 - SMTP. If the account is allowed SMTP outbound traffic."`
ResourceTypeName string `json:"resourcetypename,omitempty" doc:"Type of resource (wins over resourceType if both are provided). Values are: user_vm - Instance. Number of instances a user can create. public_ip - IP. Number of public IP addresses an account can own. volume - Volume. Number of disk volumes an account can own. snapshot - Snapshot. Number of snapshots an account can own. template - Template. Number of templates an account can register/create. project - Project. Number of projects an account can own. network - Network. Number of networks an account can own. vpc - VPC. Number of VPC an account can own. cpu - CPU. Number of CPU an account can allocate for his resources. memory - Memory. Amount of RAM an account can allocate for his resources. primary_storage - PrimaryStorage. Total primary storage space (in GiB) a user can use. secondary_storage - SecondaryStorage. Total secondary storage space (in GiB) a user can use. public_elastic_ip - IP. Number of public elastic IP addresses an account can own. smtp - SG. If the account is allowed SMTP outbound traffic."`
_ bool `name:"listResourceLimits" description:"Lists resource limits."`
}
// ListResourceLimitsResponse represents a list of resource limits
type ListResourceLimitsResponse struct {
Count int `json:"count"`
ResourceLimit []ResourceLimit `json:"resourcelimit"`
}
2018-09-14 08:06:03 +00:00
func (ListResourceLimits) response() interface{} {
return new(ListResourceLimitsResponse)
}
// UpdateResourceLimit updates the resource limit
type UpdateResourceLimit struct {
Account string `json:"account,omitempty" doc:"Update resource for a specified account. Must be used with the domainId parameter."`
DomainID string `json:"domainid,omitempty" doc:"Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain."`
Max int64 `json:"max,omitempty" doc:"Maximum resource limit."`
ResourceType ResourceType `json:"resourcetype" doc:"Type of resource to update. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create. 3 - Snapshot. Number of snapshots a user can create. 4 - Template. Number of templates that a user can register/create. 6 - Network. Number of guest network a user can create. 7 - VPC. Number of VPC a user can create. 8 - CPU. Total number of CPU cores a user can use. 9 - Memory. Total Memory (in MB) a user can use. 10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. 11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use."`
_ bool `name:"updateResourceLimit" description:"Updates resource limits for an account or domain."`
}
// UpdateResourceLimitResponse represents an updated resource limit
type UpdateResourceLimitResponse struct {
ResourceLimit ResourceLimit `json:"resourcelimit"`
}
func (UpdateResourceLimit) response() interface{} {
return new(UpdateResourceLimitResponse)
}
// GetAPILimit gets API limit count for the caller
type GetAPILimit struct {
_ bool `name:"getApiLimit" description:"Get API limit count for the caller"`
}
// GetAPILimitResponse represents the limits towards the API call
type GetAPILimitResponse struct {
APILimit APILimit `json:"apilimit"`
}
func (GetAPILimit) response() interface{} {
return new(GetAPILimitResponse)
}