quotas

package
Version: v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

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(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),
}
quotasInfo, err := quotas.Update(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 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.

func Get

func Get(client *gophercloud.ServiceClient, projectID string) (r GetResult)

Get returns Networking Quotas for a project.

func (GetResult) Extract

func (r GetResult) Extract() (*Quota, error)

Extract is a function that accepts a result and extracts a Quota resource.

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"`
}

Quota contains Networking quotas for a project.

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"`
}

UpdateOpts represents options used to update the Networking Quotas.

func (UpdateOpts) ToQuotaUpdateMap

func (opts UpdateOpts) ToQuotaUpdateMap() (map[string]interface{}, error)

ToQuotaUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToQuotaUpdateMap() (map[string]interface{}, error)
}

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(c *gophercloud.ServiceClient, projectID string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates an existing Networking Quotas using the values provided.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Quota, error)

Extract is a function that accepts a result and extracts a Quota resource.

Directories

Path Synopsis
quotas unit tests
quotas unit tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL