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)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 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.
type QoSConsumer ¶
type QoSConsumer string
const ( ConsumerFront QoSConsumer = "front-end" ConsumberBack QoSConsumer = "back-end" ConsumerBoth QoSConsumer = "both" )