Documentation ¶
Overview ¶
Package quotas provides the ability to retrieve and manage Networking quotas through the Neutron API.
Example to Get project quotas
projectID = "23d5d3f79dfa4f73b72b8b0b0063ec55" quotasInfo, err := quotas.Get(context.TODO(), networkClient, projectID).Extract() if err != nil { log.Fatal(err) } fmt.Printf("quotas: %#v\n", quotasInfo)
Example to Get a Detailed Quota Set
projectID = "23d5d3f79dfa4f73b72b8b0b0063ec55" quotasInfo, err := quotas.GetDetail(context.TODO(), networkClient, projectID).Extract() if err != nil { log.Fatal(err) } fmt.Printf("quotas: %#v\n", quotasInfo)
Example to Update project quotas
projectID = "23d5d3f79dfa4f73b72b8b0b0063ec55" updateOpts := quotas.UpdateOpts{ FloatingIP: gophercloud.IntToPointer(0), Network: gophercloud.IntToPointer(-1), Port: gophercloud.IntToPointer(5), RBACPolicy: gophercloud.IntToPointer(10), Router: gophercloud.IntToPointer(15), SecurityGroup: gophercloud.IntToPointer(20), SecurityGroupRule: gophercloud.IntToPointer(-1), Subnet: gophercloud.IntToPointer(25), SubnetPool: gophercloud.IntToPointer(0), Trunk: gophercloud.IntToPointer(0), } quotasInfo, err := quotas.Update(context.TODO(), networkClient, projectID) if err != nil { log.Fatal(err) } fmt.Printf("quotas: %#v\n", quotasInfo)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetDetailResult ¶
type GetDetailResult struct {
// contains filtered or unexported fields
}
GetDetailResult represents the detailed result of a get operation. Call its Extract method to interpret it as a Quota.
func GetDetail ¶
func GetDetail(ctx context.Context, client *gophercloud.ServiceClient, projectID string) (r GetDetailResult)
GetDetail returns detailed Networking Quotas for a project.
func (GetDetailResult) Extract ¶
func (r GetDetailResult) Extract() (*QuotaDetailSet, error)
Extract is a function that accepts a result and extracts a QuotaDetailSet resource.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a Quota.
type Quota ¶
type Quota struct { // FloatingIP represents a number of floating IPs. A "-1" value means no limit. FloatingIP int `json:"floatingip"` // Network represents a number of networks. A "-1" value means no limit. Network int `json:"network"` // Port represents a number of ports. A "-1" value means no limit. Port int `json:"port"` // RBACPolicy represents a number of RBAC policies. A "-1" value means no limit. RBACPolicy int `json:"rbac_policy"` // Router represents a number of routers. A "-1" value means no limit. Router int `json:"router"` // SecurityGroup represents a number of security groups. A "-1" value means no limit. SecurityGroup int `json:"security_group"` // SecurityGroupRule represents a number of security group rules. A "-1" value means no limit. SecurityGroupRule int `json:"security_group_rule"` // Subnet represents a number of subnets. A "-1" value means no limit. Subnet int `json:"subnet"` // SubnetPool represents a number of subnet pools. A "-1" value means no limit. SubnetPool int `json:"subnetpool"` // Trunk represents a number of trunks. A "-1" value means no limit. Trunk int `json:"trunk"` }
Quota contains Networking quotas for a project.
type QuotaDetail ¶
type QuotaDetail struct { // Used is the current number of provisioned/allocated resources of the // given type. Used int `json:"used"` // Reserved is a transitional state when a claim against quota has been made // but the resource is not yet fully online. Reserved int `json:"reserved"` // Limit is the maximum number of a given resource that can be // allocated/provisioned. This is what "quota" usually refers to. Limit int `json:"limit"` }
QuotaDetail is a set of details about a single operational limit that allows for control of networking usage.
func (*QuotaDetail) UnmarshalJSON ¶
func (q *QuotaDetail) UnmarshalJSON(b []byte) error
UnmarshalJSON overrides the default unmarshalling function to accept Reserved as a string.
Due to a bug in Neutron, under some conditions Reserved is returned as a string.
This method is left for compatibility with unpatched versions of Neutron.
type QuotaDetailSet ¶
type QuotaDetailSet struct { // FloatingIP represents a number of floating IPs. A "-1" value means no limit. FloatingIP QuotaDetail `json:"floatingip"` // Network represents a number of networks. A "-1" value means no limit. Network QuotaDetail `json:"network"` // Port represents a number of ports. A "-1" value means no limit. Port QuotaDetail `json:"port"` // RBACPolicy represents a number of RBAC policies. A "-1" value means no limit. RBACPolicy QuotaDetail `json:"rbac_policy"` // Router represents a number of routers. A "-1" value means no limit. Router QuotaDetail `json:"router"` // SecurityGroup represents a number of security groups. A "-1" value means no limit. SecurityGroup QuotaDetail `json:"security_group"` // SecurityGroupRule represents a number of security group rules. A "-1" value means no limit. SecurityGroupRule QuotaDetail `json:"security_group_rule"` // Subnet represents a number of subnets. A "-1" value means no limit. Subnet QuotaDetail `json:"subnet"` // SubnetPool represents a number of subnet pools. A "-1" value means no limit. SubnetPool QuotaDetail `json:"subnetpool"` // Trunk represents a number of trunks. A "-1" value means no limit. Trunk QuotaDetail `json:"trunk"` }
QuotaDetailSet represents details of both operational limits of Networking resources for a project and the current usage of those resources.
type UpdateOpts ¶
type UpdateOpts struct { // FloatingIP represents a number of floating IPs. A "-1" value means no limit. FloatingIP *int `json:"floatingip,omitempty"` // Network represents a number of networks. A "-1" value means no limit. Network *int `json:"network,omitempty"` // Port represents a number of ports. A "-1" value means no limit. Port *int `json:"port,omitempty"` // RBACPolicy represents a number of RBAC policies. A "-1" value means no limit. RBACPolicy *int `json:"rbac_policy,omitempty"` // Router represents a number of routers. A "-1" value means no limit. Router *int `json:"router,omitempty"` // SecurityGroup represents a number of security groups. A "-1" value means no limit. SecurityGroup *int `json:"security_group,omitempty"` // SecurityGroupRule represents a number of security group rules. A "-1" value means no limit. SecurityGroupRule *int `json:"security_group_rule,omitempty"` // Subnet represents a number of subnets. A "-1" value means no limit. Subnet *int `json:"subnet,omitempty"` // SubnetPool represents a number of subnet pools. A "-1" value means no limit. SubnetPool *int `json:"subnetpool,omitempty"` // Trunk represents a number of trunks. A "-1" value means no limit. Trunk *int `json:"trunk,omitempty"` }
UpdateOpts represents options used to update the Networking Quotas.
func (UpdateOpts) ToQuotaUpdateMap ¶
func (opts UpdateOpts) ToQuotaUpdateMap() (map[string]any, error)
ToQuotaUpdateMap builds a request body from UpdateOpts.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Quota.
func Update ¶
func Update(ctx context.Context, c *gophercloud.ServiceClient, projectID string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates an existing Networking Quotas using the values provided.