allocations

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 3 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Allocating AllocationState = "allocating"
	Active                     = "active"
	Error                      = "error"
)

Functions

func ExtractAllocationsInto

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

func List

List makes a request against the API to list allocations accessible to you.

Types

type Allocation

type Allocation struct {
	// The UUID for the resource.
	UUID string `json:"uuid"`

	// A list of UUIDs of the nodes that are candidates for this allocation.
	CandidateNodes []string `json:"candidate_nodes"`

	// The error message for the allocation if it is in the error state, null otherwise.
	LastError string `json:"last_error"`

	// The unique name of the allocation.
	Name string `json:"name"`

	// The UUID of the node assigned to the allocation. Will be null if a node is not yet assigned.
	NodeUUID string `json:"node_uuid"`

	// The current state of the allocation. One of: allocation, active, error
	State string `json:"state"`

	// The resource class requested for the allocation.
	ResourceClass string `json:"resource_class"`

	// The list of the traits requested for the allocation.
	Traits []string `json:"traits"`

	// A set of one or more arbitrary metadata key and value pairs.
	Extra map[string]string `json:"extra"`

	// The UTC date and time when the resource was created, ISO 8601 format.
	CreatedAt time.Time `json:"created_at"`

	// The UTC date and time when the resource was updated, ISO 8601 format. May be “null”.
	UpdatedAt time.Time `json:"updated_at"`

	// A list of relative links. Includes the self and bookmark links.
	Links []interface{} `json:"links"`
}

func ExtractAllocations

func ExtractAllocations(r pagination.Page) ([]Allocation, error)

ExtractAllocations interprets the results of a single page from a List() call, producing a slice of Allocation entities.

type AllocationPage

type AllocationPage struct {
	pagination.LinkedPageBase
}

AllocationPage abstracts the raw results of making a List() request against the API.

func (AllocationPage) IsEmpty

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

IsEmpty returns true if a page contains no Allocation results.

func (AllocationPage) NextPageURL

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

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

type AllocationState

type AllocationState string

type CreateOpts

type CreateOpts struct {
	// The requested resource class for the allocation.
	ResourceClass string `json:"resource_class" required:"true"`

	// The list of nodes (names or UUIDs) that should be considered for this allocation. If not provided, all available nodes will be considered.
	CandidateNodes []string `json:"candidate_nodes,omitempty"`

	// The unique name of the Allocation.
	Name string `json:"name,omitempty"`

	// The list of requested traits for the allocation.
	Traits []string `json:"traits,omitempty"`

	// The UUID for the resource.
	UUID string `json:"uuid,omitempty"`

	// A set of one or more arbitrary metadata key and value pairs.
	Extra map[string]string `json:"extra,omitempty"`
}

CreateOpts specifies allocation creation parameters

func (CreateOpts) ToAllocationCreateMap

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

ToAllocationCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToAllocationCreateMap() (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 is the response from a Create operation.

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create requests a node to be created

func (CreateResult) Extract

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

func (CreateResult) ExtractInto

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

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

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

func Delete

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

Delete requests the deletion of an allocation

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

func Get

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

Get requests the details of an allocation by ID.

func (GetResult) Extract

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

func (GetResult) ExtractInto

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

type ListOpts

type ListOpts struct {
	// Filter the list of allocations by the node UUID or name.
	Node string `q:"node"`

	// Filter the list of returned nodes, and only return the ones with the specified resource class.
	ResourceClass string `q:"resource_class"`

	// Filter the list of allocations by the allocation state, one of active, allocating or error.
	State AllocationState `q:"state"`

	// One or more fields to be returned in the response.
	Fields []string `q:"fields"`

	// Requests a page size of items.
	Limit int `q:"limit"`

	// The ID of the last-seen item
	Marker string `q:"marker"`

	// Sorts the response by the requested sort direction.
	// Valid value is asc (ascending) or desc (descending). Default is asc.
	SortDir string `q:"sort_dir"`

	// Sorts the response by the this attribute value. Default is id.
	SortKey string `q:"sort_key"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToAllocationListQuery

func (opts ListOpts) ToAllocationListQuery() (string, error)

ToAllocationListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToAllocationListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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