limits

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Sentinel = -1

Variables

This section is empty.

Functions

func ExtractLimitResultsInto

func ExtractLimitResultsInto(r pagination.Page, v interface{}) error

Types

type CreateOpts

type CreateOpts struct {
	Description     string `json:"description" required:"true" validate:"required"`
	RequestedQuotas Limit  `json:"requested_quotas" required:"true" validate:"required"`
}

func NewCreateOpts

func NewCreateOpts(description string) CreateOpts

func (CreateOpts) ToLimitCreateMap

func (opts CreateOpts) ToLimitCreateMap() (map[string]interface{}, error)

ToLimitCreateMap builds a request body from ReplaceOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToLimitCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult represents the result of a create operation. Call its Extract method to interpret it as a LimitResponse.

func Create

Create accepts a ReplaceOpts struct and creates a new quota using the values provided.

func (CreateResult) Extract

func (r CreateResult) Extract() (*LimitResponse, error)

Extract is a function that accepts a result and extracts a limit response resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type DeleteResult

type DeleteResult struct {
	gcorecloud.ErrResult
}

DeleteResult represents the result of an delete operation. Call its ExtractErr to get operation error.

func Delete

func Delete(c *gcorecloud.ServiceClient, id int) (r DeleteResult)

Delete deleted limit request

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 LimitResponse.

func Get

func Get(c *gcorecloud.ServiceClient, id int) (r GetResult)

Get retrieves a specific quota based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a limit response resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type Limit

type Limit struct {
	ProjectCountLimit         int `json:"project_count_limit" validate:"gte=-1"`
	VMCountLimit              int `json:"vm_count_limit" validate:"gte=-1"`
	CPUCountLimit             int `json:"cpu_count_limit" validate:"gte=-1"`
	RAMLimit                  int `json:"ram_limit" validate:"gte=-1"`
	VolumeCountLimit          int `json:"volume_count_limit" validate:"gte=-1"`
	VolumeSizeLimit           int `json:"volume_size_limit" validate:"gte=-1"`
	VolumeSnapshotsCountLimit int `json:"volume_snapshots_count_limit" validate:"gte=-1"`
	VolumeSnapshotsSizeLimit  int `json:"volume_snapshots_size_limit" validate:"gte=-1"`
	ImageCountLimit           int `json:"image_count_limit" validate:"gte=-1"`
	ImageSizeLimit            int `json:"image_size_limit" validate:"gte=-1"`
	NetworkCountLimit         int `json:"network_count_limit" validate:"gte=-1"`
	SubnetCountLimit          int `json:"subnet_count_limit" validate:"gte=-1"`
	FloatingCountLimit        int `json:"floating_count_limit" validate:"gte=-1"`
	RouterCountLimit          int `json:"router_count_limit" validate:"gte=-1"`
	FirewallCountLimit        int `json:"firewall_count_limit" validate:"gte=-1"`
	LoadbalancerCountLimit    int `json:"loadbalancer_count_limit" validate:"gte=-1"`
	ExternalIPCountLimit      int `json:"external_ip_count_limit" validate:"gte=-1"`
	ClusterCountLimit         int `json:"cluster_count_limit" validate:"gte=-1"`
}

Limit represents a limit structure.

func NewLimit

func NewLimit() Limit

func (Limit) ToRequestMap

func (opts Limit) ToRequestMap() map[string]interface{}

type LimitResponse

type LimitResponse struct {
	ID        int                       `json:"id"`
	ClientID  int                       `json:"client_id"`
	Limits    string                    `json:"limits"`
	Status    types.LimitRequestStatus  `json:"status"`
	CreatedAt gcorecloud.JSONRFC3339NoZ `json:"created_at"`
}

func ExtractLimitResults

func ExtractLimitResults(r pagination.Page) ([]LimitResponse, error)

ExtractLimitResult accepts a Page struct, specifically a LimitResultPage struct, and extracts the elements into a slice of LimitResponse structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

type LimitResultPage

type LimitResultPage struct {
	pagination.LinkedPageBase
}

LimitResultPage is the page returned by a pager when traversing over a collection of limit requests.

func (LimitResultPage) IsEmpty

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

IsEmpty checks whether a LimitResultPage struct is empty.

func (LimitResultPage) NextPageURL

func (r LimitResultPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of limit requests has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type StatusOpts

type StatusOpts struct {
	Status types.LimitRequestStatus `json:"status" required:"true" validate:"required,enum"`
}

StatusOpts represents options used to status a limit request.

func (StatusOpts) ToLimitStatusMap

func (opts StatusOpts) ToLimitStatusMap() (map[string]interface{}, error)

ToLimitStatusMap builds a request body from StatusOpts.

func (StatusOpts) Validate

func (opts StatusOpts) Validate() error

type StatusOptsBuilder

type StatusOptsBuilder interface {
	ToLimitStatusMap() (map[string]interface{}, error)
}

StatusOptsBuilder allows extensions to add additional parameters to the Status request.

type UpdateOpts

type UpdateOpts struct {
	Limit
}

UpdateOpts represents options used to update a limit request.

func NewUpdateOpts

func NewUpdateOpts() UpdateOpts

func (UpdateOpts) ToLimitUpdateMap

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

ToLimitUpdateMap builds a request body from UpdateOpts.

func (UpdateOpts) Validate

func (opts UpdateOpts) Validate() error

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToLimitUpdateMap() (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 LimitResponse.

func Status

Status accepts a StatusOpts struct and statuss an existing quota using the values provided.

func Update

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

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a limit response resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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