quotasets

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Overview

Package quotasets enables retrieving and managing Compute quotas.

Example to Get a Quota Set

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

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

Example to Get a Detailed Quota Set

quotaset, err := quotasets.GetDetail(computeClient, "tenant-id").Extract()
if err != nil {
	panic(err)
}

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

Example to Update a Quota Set

updateOpts := quotasets.UpdateOpts{
	FixedIPs: gophercloud.IntToPointer(100),
	Cores:    gophercloud.IntToPointer(64),
}

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Absolute

type Absolute struct {
	MaxServerMeta           int `json:"maxServerMeta"`
	MaxPersonality          int `json:"maxPersonality"`
	TotalServerGroupsUsed   int `json:"totalServerGroupsUsed"`
	MaxImageMeta            int `json:"maxImageMeta"`
	MaxPersonalitySize      int `json:"maxPersonalitySize"`
	MaxTotalRAMSize         int `json:"maxTotalRAMSize"`
	MaxTotalKeypairs        int `json:"maxTotalKeypairs"`
	MaxSecurityGroupRules   int `json:"maxSecurityGroupRules"`
	MaxServerGroups         int `json:"maxServerGroups"`
	TotalCoresUsed          int `json:"totalCoresUsed"`
	TotalRAMUsed            int `json:"totalRAMUsed"`
	MaxSecurityGroups       int `json:"maxSecurityGroups"`
	TotalFloatingIpsUsed    int `json:"totalFloatingIpsUsed"`
	TotalInstancesUsed      int `json:"totalInstancesUsed"`
	TotalSecurityGroupsUsed int `json:"totalSecurityGroupsUsed"`
	MaxTotalFloatingIps     int `json:"maxTotalFloatingIps"`
	MaxTotalInstances       int `json:"maxTotalInstances"`
	MaxTotalCores           int `json:"maxTotalCores"`
	MaxServerGroupMembers   int `json:"maxServerGroupMembers"`
}

type DeleteResult

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

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

func Delete

func Delete(client *gophercloud.ServiceClient, tenantID string) (res DeleteResult)

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

func (DeleteResult) Extract

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

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

type GetDefaultResult

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

func GetDefault

func GetDefault(client *gophercloud.ServiceClient, ProjectID string) GetDefaultResult

func (GetDefaultResult) Extract

func (r GetDefaultResult) Extract() (QuotaSet, error)

type GetDetailResult

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

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

func GetDetail

func GetDetail(client *gophercloud.ServiceClient, tenantID string) GetDetailResult

GetDetail returns detailed public data about a previously created QuotaSet.

func (GetDetailResult) Extract

func (r GetDetailResult) Extract() (QuotaDetailSet, error)

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

type GetLimitResult

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

func GetLimits

func GetLimits(client *gophercloud.ServiceClient) GetLimitResult

GetLimits returns limits public data about a previously created QuotaSet.

func (GetLimitResult) Extract

func (r GetLimitResult) Extract() (Limits, error)

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, tenantID string) GetResult

Get returns public data about a previously created QuotaSet.

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 Limits

type Limits struct {
	Rate     []int    `json:"rate"`
	Absolute Absolute `json:"absolute"`
}

type QuotaDefaultSet

type QuotaDefaultSet struct {
	// ID is the tenant ID associated with this QuotaDetailSet.
	ID string `json:"id"`

	// FixedIPs is number of fixed ips alloted this QuotaDetailSet.
	FixedIPs QuotaDetail `json:"fixed_ips"`

	// FloatingIPs is number of floating ips alloted this QuotaDetailSet.
	FloatingIPs QuotaDetail `json:"floating_ips"`

	// InjectedFileContentBytes is the allowed bytes for each injected file.
	InjectedFileContentBytes QuotaDetail `json:"injected_file_content_bytes"`

	// InjectedFilePathBytes is allowed bytes for each injected file path.
	InjectedFilePathBytes QuotaDetail `json:"injected_file_path_bytes"`

	// InjectedFiles is the number of injected files allowed for each project.
	InjectedFiles QuotaDetail `json:"injected_files"`

	// KeyPairs is number of ssh keypairs.
	KeyPairs QuotaDetail `json:"key_pairs"`

	// MetadataItems is number of metadata items allowed for each instance.
	MetadataItems QuotaDetail `json:"metadata_items"`

	// RAM is megabytes allowed for each instance.
	RAM QuotaDetail `json:"ram"`

	// SecurityGroupRules is number of security group rules allowed for each
	// security group.
	SecurityGroupRules QuotaDetail `json:"security_group_rules"`

	// SecurityGroups is the number of security groups allowed for each project.
	SecurityGroups QuotaDetail `json:"security_groups"`

	// Cores is number of instance cores allowed for each project.
	Cores QuotaDetail `json:"cores"`

	// Instances is number of instances allowed for each project.
	Instances QuotaDetail `json:"instances"`

	// ServerGroups is the number of ServerGroups allowed for the project.
	ServerGroups QuotaDetail `json:"server_groups"`

	// ServerGroupMembers is the number of members for each ServerGroup.
	ServerGroupMembers QuotaDetail `json:"server_group_members"`
}

type QuotaDetail

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

	// 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 compute usage.

type QuotaDetailSet

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

	// FixedIPs is number of fixed ips alloted this QuotaDetailSet.
	FixedIPs QuotaDetail `json:"fixed_ips"`

	// FloatingIPs is number of floating ips alloted this QuotaDetailSet.
	FloatingIPs QuotaDetail `json:"floating_ips"`

	// InjectedFileContentBytes is the allowed bytes for each injected file.
	InjectedFileContentBytes QuotaDetail `json:"injected_file_content_bytes"`

	// InjectedFilePathBytes is allowed bytes for each injected file path.
	InjectedFilePathBytes QuotaDetail `json:"injected_file_path_bytes"`

	// InjectedFiles is the number of injected files allowed for each project.
	InjectedFiles QuotaDetail `json:"injected_files"`

	// KeyPairs is number of ssh keypairs.
	KeyPairs QuotaDetail `json:"key_pairs"`

	// MetadataItems is number of metadata items allowed for each instance.
	MetadataItems QuotaDetail `json:"metadata_items"`

	// RAM is megabytes allowed for each instance.
	RAM QuotaDetail `json:"ram"`

	// SecurityGroupRules is number of security group rules allowed for each
	// security group.
	SecurityGroupRules QuotaDetail `json:"security_group_rules"`

	// SecurityGroups is the number of security groups allowed for each project.
	SecurityGroups QuotaDetail `json:"security_groups"`

	// Cores is number of instance cores allowed for each project.
	Cores QuotaDetail `json:"cores"`

	// Instances is number of instances allowed for each project.
	Instances QuotaDetail `json:"instances"`

	// ServerGroups is the number of ServerGroups allowed for the project.
	ServerGroups QuotaDetail `json:"server_groups"`

	// ServerGroupMembers is the number of members for each ServerGroup.
	ServerGroupMembers QuotaDetail `json:"server_group_members"`
}

QuotaDetailSet represents details of both operational limits of compute resources and the current usage of those resources.

type QuotaSet

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

	// FixedIPs is number of fixed ips alloted this QuotaSet.
	FixedIPs int `json:"fixed_ips"`

	// FloatingIPs is number of floating ips alloted this QuotaSet.
	FloatingIPs int `json:"floating_ips"`

	// InjectedFileContentBytes is the allowed bytes for each injected file.
	InjectedFileContentBytes int `json:"injected_file_content_bytes"`

	// InjectedFilePathBytes is allowed bytes for each injected file path.
	InjectedFilePathBytes int `json:"injected_file_path_bytes"`

	// InjectedFiles is the number of injected files allowed for each project.
	InjectedFiles int `json:"injected_files"`

	// KeyPairs is number of ssh keypairs.
	KeyPairs int `json:"key_pairs"`

	// MetadataItems is number of metadata items allowed for each instance.
	MetadataItems int `json:"metadata_items"`

	// RAM is megabytes allowed for each instance.
	RAM int `json:"ram"`

	// SecurityGroupRules is number of security group rules allowed for each
	// security group.
	SecurityGroupRules int `json:"security_group_rules"`

	// SecurityGroups is the number of security groups allowed for each project.
	SecurityGroups int `json:"security_groups"`

	// Cores is number of instance cores allowed for each project.
	Cores int `json:"cores"`

	// Instances is number of instances allowed for each project.
	Instances int `json:"instances"`

	// ServerGroups is the number of ServerGroups allowed for the project.
	ServerGroups int `json:"server_groups"`

	// ServerGroupMembers is the number of members for each ServerGroup.
	ServerGroupMembers int `json:"server_group_members"`
}

QuotaSet is a set of operational limits that allow for control of compute 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 (page QuotaSetPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a QuotaSetsetPage is empty.

type UpdateOpts

type UpdateOpts struct {
	// FixedIPs is number of fixed ips alloted this quota_set.
	FixedIPs *int `json:"fixed_ips,omitempty"`

	// FloatingIPs is number of floating ips alloted this quota_set.
	FloatingIPs *int `json:"floating_ips,omitempty"`

	// InjectedFileContentBytes is content bytes allowed for each injected file.
	InjectedFileContentBytes *int `json:"injected_file_content_bytes,omitempty"`

	// InjectedFilePathBytes is allowed bytes for each injected file path.
	InjectedFilePathBytes *int `json:"injected_file_path_bytes,omitempty"`

	// InjectedFiles is injected files allowed for each project.
	InjectedFiles *int `json:"injected_files,omitempty"`

	// KeyPairs is number of ssh keypairs.
	KeyPairs *int `json:"key_pairs,omitempty"`

	// MetadataItems is number of metadata items allowed for each instance.
	MetadataItems *int `json:"metadata_items,omitempty"`

	// RAM is megabytes allowed for each instance.
	RAM *int `json:"ram,omitempty"`

	// SecurityGroupRules is rules allowed for each security group.
	SecurityGroupRules *int `json:"security_group_rules,omitempty"`

	// SecurityGroups security groups allowed for each project.
	SecurityGroups *int `json:"security_groups,omitempty"`

	// Cores is number of instance cores allowed for each project.
	Cores *int `json:"cores,omitempty"`

	// Instances is number of instances allowed for each project.
	Instances *int `json:"instances,omitempty"`

	// Number of ServerGroups allowed for the project.
	ServerGroups *int `json:"server_groups,omitempty"`

	// Max number of Members for each ServerGroup.
	ServerGroupMembers *int `json:"server_group_members,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) ToComputeQuotaUpdateMap

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

ToComputeQuotaUpdateMap 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)
	ToComputeQuotaUpdateMap() (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, tenantID string, opts UpdateOptsBuilder) (res UpdateResult)

Updates the quotas for the given tenantID 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