quotas

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 2 Imported by: 13

Documentation

Overview

Package quotas provides the ability to retrieve and manage Load Balancer quotas

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{
		Loadbalancer:  gophercloud.IntToPointer(20),
		Listener:      gophercloud.IntToPointer(40),
		Member:        gophercloud.IntToPointer(200),
		Pool:          gophercloud.IntToPointer(20),
		Healthmonitor: gophercloud.IntToPointer(1),
		L7Policy:      gophercloud.IntToPointer(50),
		L7Rule:        gophercloud.IntToPointer(100),
    }
    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 load balancer 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 {
	// Loadbalancer represents the number of load balancers. A "-1" value means no limit.
	Loadbalancer int `json:"-"`

	// Listener represents the number of listeners. A "-1" value means no limit.
	Listener int `json:"listener"`

	// Member represents the number of members. A "-1" value means no limit.
	Member int `json:"member"`

	// Poool represents the number of pools. A "-1" value means no limit.
	Pool int `json:"pool"`

	// HealthMonitor represents the number of healthmonitors. A "-1" value means no limit.
	Healthmonitor int `json:"-"`

	// L7Policy represents the number of l7policies. A "-1" value means no limit.
	L7Policy int `json:"l7policy"`

	// L7Rule represents the number of l7rules. A "-1" value means no limit.
	L7Rule int `json:"l7rule"`
}

Quota contains load balancer quotas for a project.

func (*Quota) UnmarshalJSON

func (r *Quota) UnmarshalJSON(b []byte) error

UnmarshalJSON provides backwards compatibility to OpenStack APIs which still return the deprecated `load_balancer` or `health_monitor` as quota values instead of `loadbalancer` and `healthmonitor`.

type UpdateOpts

type UpdateOpts struct {
	// Loadbalancer represents the number of load balancers. A "-1" value means no limit.
	Loadbalancer *int `json:"loadbalancer,omitempty"`

	// Listener represents the number of listeners. A "-1" value means no limit.
	Listener *int `json:"listener,omitempty"`

	// Member represents the number of members. A "-1" value means no limit.
	Member *int `json:"member,omitempty"`

	// Poool represents the number of pools. A "-1" value means no limit.
	Pool *int `json:"pool,omitempty"`

	// HealthMonitor represents the number of healthmonitors. A "-1" value means no limit.
	Healthmonitor *int `json:"healthmonitor,omitempty"`

	// L7Policy represents the number of l7policies. A "-1" value means no limit.
	L7Policy *int `json:"l7policy,omitempty"`

	// L7Rule represents the number of l7rules. A "-1" value means no limit.
	L7Rule *int `json:"l7rule,omitempty"`
}

UpdateOpts represents options used to update the load balancer 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 load balancer 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
y or Y : Canonical URL