quotas

package
v0.0.0-...-cd80d89 Latest Latest
Warning

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

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

Documentation

Overview

Package quotas provides the ability to retrieve and manage Trove 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{
		Backups: gophercloud.IntToPointer(20),
		Instances: gophercloud.IntToPointer(20),
		Ram: gophercloud.IntToPointer(20),
		Volumes: gophercloud.IntToPointer(20),
    }
    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 {
	// Backups represents the number of  backups. A "-1" value means no limit.
	Backups int `json:"backups,omitempty"`

	// Instances represents the number of instances. A "-1" value means no limit.
	Instances int `json:"instances"`

	// Ram represents the number of ram. A "-1" value means no limit.
	Ram int `json:"ram"`

	// Volumes represents the number of volumes. A "-1" value means no limit.
	Volumes int `json:"volumes"`
}

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 {
	// Backups represents the number of  backups. A "-1" value means no limit.
	Backups int `json:"backups,omitempty"`

	// Instances represents the number of instances. A "-1" value means no limit.
	Instances int `json:"instances"`

	// Ram represents the number of ram. A "-1" value means no limit.
	Ram int `json:"ram"`

	// Volumes represents the number of volumes. A "-1" value means no limit.
	Volumes int `json:"volumes"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL