dothill

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

dothill-api-go

A Go implementation of the Dothill API.

Using the library

A minimalist documentation is available on godoc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Username   string
	Password   string
	Addr       string
	HTTPClient http.Client
	// contains filtered or unexported fields
}

Client : Can be used to request the dothill API

func NewClient

func NewClient() *Client

NewClient : Creates a dothill client by setting up its HTTP client

func (*Client) CreateHost

func (client *Client) CreateHost(name, iqn string) (*Response, *ResponseStatus, error)

CreateHost : creates a host

func (*Client) CreateVolume

func (client *Client) CreateVolume(name, size, pool string) (*Response, *ResponseStatus, error)

CreateVolume : creates a volume with the given name, capacity in the given pool

func (*Client) DeleteHost added in v1.3.0

func (client *Client) DeleteHost(name string) (*Response, *ResponseStatus, error)

DeleteHost : deletes a hotst by its ID or nickname

func (*Client) DeleteVolume

func (client *Client) DeleteVolume(name string) (*Response, *ResponseStatus, error)

DeleteVolume : deletes a volume

func (*Client) Login

func (client *Client) Login() error

Login : Called automatically, may be called manually if credentials changed

func (*Client) MapVolume

func (client *Client) MapVolume(name, host, access string, lun int) (*Response, *ResponseStatus, error)

MapVolume : map a volume to host + LUN

func (*Client) Request

func (client *Client) Request(endpoint string) (*Response, *ResponseStatus, error)

Request : Execute the given request with client's configuration

func (*Client) ShowHostMaps

func (client *Client) ShowHostMaps(host string) ([]Volume, *ResponseStatus, error)

ShowHostMaps : list the volume mappings for given host If host is an empty string, mapping for all hosts is shown

func (*Client) UnmapVolume

func (client *Client) UnmapVolume(name, host string) (*Response, *ResponseStatus, error)

UnmapVolume : unmap a volume from host

type Object

type Object struct {
	Typ           string     `xml:"basetype,attr"`
	Name          string     `xml:"name,attr"`
	OID           int32      `xml:"oid,attr"`
	Format        string     `xml:"format,attr,omitempty"`
	Objects       []Object   `xml:"OBJECT"`
	Properties    []Property `xml:"PROPERTY"`
	ObjectsMap    map[string]*Object
	PropertiesMap map[string]*Property
}

Object : Typed representation of any XML API object

type Property

type Property struct {
	Name        string `xml:"name,attr"`
	Typ         string `xml:"type,attr"`
	Size        int32  `xml:"size,attr"`
	Draw        bool   `xml:"draw,attr"`
	Sort        string `xml:"sort,attr"`
	DisplayName string `xml:"display-name,attr"`
	Data        string `xml:",chardata"`
}

Property : Typed representation of any XML API property

type Request

type Request struct {
	Endpoint string
	Data     interface{}
}

Request : Used internally, and can be used to send custom requests (see Client.Request())

type Response

type Response struct {
	Version    string   `xml:"VERSION,attr"`
	Objects    []Object `xml:"OBJECT"`
	ObjectsMap map[string]*Object
}

Response : Typed representation of any XML API response

func NewResponse

func NewResponse(data []byte) (*Response, error)

NewResponse : Unmarshals the raw data into a typed response object and generate a hash map from fields for optimization

func (*Response) GetStatus

func (res *Response) GetStatus() *ResponseStatus

GetStatus : Creates and returns the final ResponseStatus struct from the raw status object in response

type ResponseStatus

type ResponseStatus struct {
	ResponseType        string
	ResponseTypeNumeric int
	Response            string
	ReturnCode          int
	Time                time.Time
}

ResponseStatus : Final representation of the "status" object in every API response

type Volume

type Volume struct {
	LUN int
}

Volume : volume-view representation

Jump to

Keyboard shortcuts

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