Documentation
¶
Overview ¶
Package qos provides information and interaction with the QoS specifications for the Openstack Blockstorage service.
Example to create a QoS specification
createOpts := qos.CreateOpts{
Name: "test",
Consumer: qos.ConsumerFront,
Specs: map[string]string{
"read_iops_sec": "20000",
},
}
test, err := qos.Create(client, createOpts).Extract()
if err != nil {
log.Fatal(err)
}
fmt.Printf("QoS: %+v\n", test)
Example to delete a QoS specification
qosID := "d6ae28ce-fcb5-4180-aa62-d260a27e09ae"
deleteOpts := qos.DeleteOpts{
Force: false,
}
err = qos.Delete(client, qosID, deleteOpts).ExtractErr()
if err != nil {
log.Fatal(err)
}
Example to list QoS specifications
listOpts := qos.ListOpts{}
allPages, err := qos.List(client, listOpts).AllPages()
if err != nil {
panic(err)
}
allQoS, err := qos.ExtractQoS(allPages)
if err != nil {
panic(err)
}
for _, qos := range allQoS {
fmt.Printf("List: %+v\n", qos)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶ added in v0.19.0
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List instructs OpenStack to provide a list of QoS. You may provide criteria by which List curtails its results for easier processing.
Types ¶
type CreateOpts ¶
type CreateOpts struct {
// The name of the QoS spec
Name string `json:"name"`
// The consumer of the QoS spec. Possible values are
// both, front-end, back-end.
Consumer QoSConsumer `json:"consumer,omitempty"`
// Specs is a collection of miscellaneous key/values used to set
// specifications for the QoS
Specs map[string]string `json:"-"`
}
CreateOpts contains options for creating a QoS specification. This object is passed to the qos.Create function.
func (CreateOpts) ToQoSCreateMap ¶
func (opts CreateOpts) ToQoSCreateMap() (map[string]interface{}, error)
ToQoSCreateMap assembles a request body based on the contents of a CreateOpts.
type CreateOptsBuilder ¶
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult contains the response body and error from a Create request.
func Create ¶
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create will create a new QoS based on the values in CreateOpts. To extract the QoS object from the response, call the Extract method on the CreateResult.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(qos interface{}) error
ExtractInto converts our response data into a QoS struct
type DeleteOpts ¶
type DeleteOpts struct {
// Delete a QoS specification even if it is in-use
Force bool `q:"force"`
}
DeleteOpts contains options for deleting a QoS. This object is passed to the qos.Delete function.
func (DeleteOpts) ToQoSDeleteQuery ¶
func (opts DeleteOpts) ToQoSDeleteQuery() (string, error)
ToQoSDeleteQuery formats a DeleteOpts into a query string.
type DeleteOptsBuilder ¶
DeleteOptsBuilder allows extensions to add additional parameters to the Delete request.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult contains the response body and error from a Delete request.
func Delete ¶
func Delete(client *gophercloud.ServiceClient, id string, opts DeleteOptsBuilder) (r DeleteResult)
Delete will delete the existing QoS with the provided ID.
type ListOpts ¶ added in v0.19.0
type ListOpts struct {
// Sort is Comma-separated list of sort keys and optional sort
// directions in the form of < key > [: < direction > ]. A valid
//direction is asc (ascending) or desc (descending).
Sort string `q:"sort"`
// Marker and Limit control paging.
// Marker instructs List where to start listing from.
Marker string `q:"marker"`
// Limit instructs List to refrain from sending excessively large lists of
// QoS.
Limit int `q:"limit"`
}
func (ListOpts) ToQoSListQuery ¶ added in v0.19.0
ToQoSListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶ added in v0.19.0
ListOptsBuilder allows extensions to add additional parameters to the List request.
type QoS ¶
type QoS struct {
// Name is the name of the QoS.
Name string `json:"name"`
// Unique identifier for the QoS.
ID string `json:"id"`
// Consumer of QoS
Consumer string `json:"consumer"`
// Arbitrary key-value pairs defined by the user.
Specs map[string]string `json:"specs"`
}
QoS contains all the information associated with an OpenStack QoS specification.
func ExtractQoS ¶ added in v0.19.0
func ExtractQoS(r pagination.Page) ([]QoS, error)
ExtractQoS provides access to the list of qos in a page acquired from the List operation.
type QoSConsumer ¶
type QoSConsumer string
const ( ConsumerFront QoSConsumer = "front-end" ConsumberBack QoSConsumer = "back-end" ConsumerBoth QoSConsumer = "both" )
type QoSPage ¶ added in v0.19.0
type QoSPage struct {
pagination.LinkedPageBase
}
func (QoSPage) NextPageURL ¶ added in v0.19.0
NextPageURL uses the response's embedded link reference to navigate to the next page of results.