quotasets

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package quotasets enables retrieving and managing Block Storage quotas.

Example to Get a Quota Set

quotaset, err := quotasets.Get(blockStorageClient, "project-id").Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", quotaset)

Example to Get Quota Set Usage

quotaset, err := quotasets.GetUsage(blockStorageClient, "project-id").Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", quotaset)

Example to Update a Quota Set

updateOpts := quotasets.UpdateOpts{
	Volumes: gophercloud.IntToPointer(100),
}

quotaset, err := quotasets.Update(blockStorageClient, "project-id", updateOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", quotaset)

Example to Delete a Quota Set

err := quotasets.Delete(blockStorageClient, "project-id").ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult is the response from a Delete operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Delete

func Delete(client *gophercloud.ServiceClient, projectID string) (r DeleteResult)

Resets the quotas for the given tenant to their default values.

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

GetResult is the response from a Get operation. Call its Extract method to interpret it as a QuotaSet.

func Get

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

Get returns public data about a previously created QuotaSet.

func GetDefaults

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

GetDefaults returns public data about the project's default block storage quotas.

func (GetResult) Extract

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

Extract is a method that attempts to interpret any QuotaSet resource response as a QuotaSet struct.

type GetUsageResult

type GetUsageResult struct {
	// contains filtered or unexported fields
}

GetUsageResult is the response from a Get operation. Call its Extract method to interpret it as a QuotaSet.

func GetUsage

func GetUsage(client *gophercloud.ServiceClient, projectID string) (r GetUsageResult)

GetUsage returns detailed public data about a previously created QuotaSet.

func (GetUsageResult) Extract

func (r GetUsageResult) Extract() (QuotaUsageSet, error)

Extract is a method that attempts to interpret any QuotaUsageSet resource response as a set of QuotaUsageSet structs.

type QuotaSet

type QuotaSet struct {
	// ID is project associated with this QuotaSet.
	ID string `json:"id"`

	// Volumes is the number of volumes that are allowed for each project.
	Volumes int `json:"volumes"`

	// Snapshots is the number of snapshots that are allowed for each project.
	Snapshots int `json:"snapshots"`

	// Gigabytes is the size (GB) of volumes and snapshots that are allowed for
	// each project.
	Gigabytes int `json:"gigabytes"`

	// PerVolumeGigabytes is the size (GB) of volumes and snapshots that are
	// allowed for each project and the specifed volume type.
	PerVolumeGigabytes int `json:"per_volume_gigabytes"`

	// Backups is the number of backups that are allowed for each project.
	Backups int `json:"backups"`

	// BackupGigabytes is the size (GB) of backups that are allowed for each
	// project.
	BackupGigabytes int `json:"backup_gigabytes"`

	// Groups is the number of groups that are allowed for each project.
	Groups int `json:"groups,omitempty"`
}

QuotaSet is a set of operational limits that allow for control of block storage usage.

func ExtractQuotaSets

func ExtractQuotaSets(r pagination.Page) ([]QuotaSet, error)

ExtractQuotaSets interprets a page of results as a slice of QuotaSets.

type QuotaSetPage

type QuotaSetPage struct {
	pagination.SinglePageBase
}

QuotaSetPage stores a single page of all QuotaSet results from a List call.

func (QuotaSetPage) IsEmpty

func (r QuotaSetPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a QuotaSetsetPage is empty.

type QuotaUsage

type QuotaUsage struct {
	// InUse is the current number of provisioned resources of the given type.
	InUse int `json:"in_use"`

	// Allocated is the current number of resources of a given type allocated
	// for use.  It is only available when nested quota is enabled.
	Allocated int `json:"allocated"`

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

QuotaUsage is a set of details about a single operational limit that allows for control of block storage usage.

type QuotaUsageSet

type QuotaUsageSet struct {
	// ID is the project ID associated with this QuotaUsageSet.
	ID string `json:"id"`

	// Volumes is the volume usage information for this project, including
	// in_use, limit, reserved and allocated attributes. Note: allocated
	// attribute is available only when nested quota is enabled.
	Volumes QuotaUsage `json:"volumes"`

	// Snapshots is the snapshot usage information for this project, including
	// in_use, limit, reserved and allocated attributes. Note: allocated
	// attribute is available only when nested quota is enabled.
	Snapshots QuotaUsage `json:"snapshots"`

	// Gigabytes is the size (GB) usage information of volumes and snapshots
	// for this project, including in_use, limit, reserved and allocated
	// attributes. Note: allocated attribute is available only when nested
	// quota is enabled.
	Gigabytes QuotaUsage `json:"gigabytes"`

	// PerVolumeGigabytes is the size (GB) usage information for each volume,
	// including in_use, limit, reserved and allocated attributes. Note:
	// allocated attribute is available only when nested quota is enabled and
	// only limit is meaningful here.
	PerVolumeGigabytes QuotaUsage `json:"per_volume_gigabytes"`

	// Backups is the backup usage information for this project, including
	// in_use, limit, reserved and allocated attributes. Note: allocated
	// attribute is available only when nested quota is enabled.
	Backups QuotaUsage `json:"backups"`

	// BackupGigabytes is the size (GB) usage information of backup for this
	// project, including in_use, limit, reserved and allocated attributes.
	// Note: allocated attribute is available only when nested quota is
	// enabled.
	BackupGigabytes QuotaUsage `json:"backup_gigabytes"`

	// Groups is the number of groups that are allowed for each project.
	// Note: allocated attribute is available only when nested quota is
	// enabled.
	Groups QuotaUsage `json:"groups"`
}

QuotaUsageSet represents details of both operational limits of block storage resources and the current usage of those resources.

type UpdateOpts

type UpdateOpts struct {
	// Volumes is the number of volumes that are allowed for each project.
	Volumes *int `json:"volumes,omitempty"`

	// Snapshots is the number of snapshots that are allowed for each project.
	Snapshots *int `json:"snapshots,omitempty"`

	// Gigabytes is the size (GB) of volumes and snapshots that are allowed for
	// each project.
	Gigabytes *int `json:"gigabytes,omitempty"`

	// PerVolumeGigabytes is the size (GB) of volumes and snapshots that are
	// allowed for each project and the specifed volume type.
	PerVolumeGigabytes *int `json:"per_volume_gigabytes,omitempty"`

	// Backups is the number of backups that are allowed for each project.
	Backups *int `json:"backups,omitempty"`

	// BackupGigabytes is the size (GB) of backups that are allowed for each
	// project.
	BackupGigabytes *int `json:"backup_gigabytes,omitempty"`

	// Groups is the number of groups that are allowed for each project.
	Groups *int `json:"groups,omitempty"`

	// Force will update the quotaset even if the quota has already been used
	// and the reserved quota exceeds the new quota.
	Force bool `json:"force,omitempty"`
}

Options for Updating the quotas of a Tenant. All int-values are pointers so they can be nil if they are not needed. You can use gopercloud.IntToPointer() for convenience

func (UpdateOpts) ToBlockStorageQuotaUpdateMap

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

ToBlockStorageQuotaUpdateMap builds the update options into a serializable format.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	// Extra specific name to prevent collisions with interfaces for other quotas
	// (e.g. neutron)
	ToBlockStorageQuotaUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder enables extensins to add parameters to the update request.

type UpdateResult

type UpdateResult struct {
	// contains filtered or unexported fields
}

UpdateResult is the response from a Update operation. Call its Extract method to interpret it as a QuotaSet.

func Update

func Update(client *gophercloud.ServiceClient, projectID string, opts UpdateOptsBuilder) (r UpdateResult)

Updates the quotas for the given projectID and returns the new QuotaSet.

func (UpdateResult) Extract

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

Extract is a method that attempts to interpret any QuotaSet resource response as a QuotaSet struct.

Directories

Path Synopsis
quotasets unit tests
quotasets unit tests

Jump to

Keyboard shortcuts

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