v2

package
v0.0.0-...-b5648fb Latest Latest
Warning

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

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

Documentation

Overview

Package volume implements a client library for accessing OpenStack Volume service

Volumes and VolumeDetails can be retrieved using the api.

In addition more complex filtering and sort queries can by using the VolumeQueryParameters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailResponse

type DetailResponse struct {
	ID              string               `json:"id"`
	Attachments     []map[string]string  `json:"attachments"`
	Links           []map[string]string  `json:"links"`
	Metadata        map[string]string    `json:"metadata"`
	Protected       bool                 `json:"protected"`
	Status          string               `json:"status"`
	MigrationStatus string               `json:"migration_status"`
	UserID          string               `json:"user_id"`
	Encrypted       bool                 `json:"encrypted"`
	Multiattach     bool                 `json:"multiattach"`
	CreatedAt       util.RFC8601DateTime `json:"created_at"`
	Description     string               `json:"description"`
	Volume_type     string               `json:"volume_type"`
	Name            string               `json:"name"`
	Source_volid    string               `json:"source_volid"`
	Snapshot_id     string               `json:"snapshot_id"`
	Size            int64                `json:"size"`

	Aavailability_zone  string `json:"availability_zone"`
	Rreplication_status string `json:"replication_status"`
	Consistencygroup_id string `json:"consistencygroup_id"`
}

DetailResponse is a structure for all properties of an volume for a detailed query

type QueryParameters

type QueryParameters struct {
	All_tenant    int64
	Marker        string
	Limit         int64
	SortKey       string
	SortDirection SortDirection
}

QueryParameters is a structure that contains the filter, sort, and paging parameters for an volume or volumedetail query.

type Response

type Response struct {
	ID    string              `json:"id"`
	Links []map[string]string `json:"links"`
	Name  string              `json:"name"`
}

Response is a structure for all properties of an volume for a non detailed query

type Service

type Service struct {
	Session openstack.Session
	Client  http.Client
	URL     string
}

Service is a client service that can make requests against a OpenStack volume service. Below is an example on creating an volume service and getting volumes:

	volumeService := volume.VolumeService{Client: *http.DefaultClient, TokenId: tokenId, Url: "http://volumeservicelocation"}
 volumes:= volumeService.Volumes()

func (Service) QueryVolumes

func (volumeService Service) QueryVolumes(queryParameters *QueryParameters) ([]Response, error)

QueryVolumes will issue a get request with the specified VolumeQueryParameters to retrieve the list of volumes.

func (Service) QueryVolumesDetail

func (volumeService Service) QueryVolumesDetail(queryParameters *QueryParameters) ([]DetailResponse, error)

QueryVolumesDetail will issue a get request with the specified QueryParameters to retrieve the list of volumes with additional details.

func (Service) Volumes

func (volumeService Service) Volumes() (volume []Response, err error)

Volumes will issue a get request to OpenStack to retrieve the list of volumes.

func (Service) VolumesDetail

func (volumeService Service) VolumesDetail() (volume []DetailResponse, err error)

VolumesDetail will issue a get request to OpenStack to retrieve the list of volumes complete with additional details.

type SortDirection

type SortDirection string

SortDirection of the sort, ascending or descending.

const (
	// Desc specifies the sort direction to be descending.
	Desc SortDirection = "desc"
	// Asc specifies the sort direction to be ascending.
	Asc SortDirection = "asc"
)

Jump to

Keyboard shortcuts

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