gounity

package module
v0.4.0 Latest Latest
Warning

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

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

README

GoUnity

GitHub release Travis branch Coveralls github branch Go Report Card license

GoUnity is a Go project that provides a client for managing Dell EMC Unity storage.

Current State

Under development. Please contribute and follow the guideline.

License

Apache License version 2

Support Operations

  • Query instances of:
    • Storage Pool
    • LUN
    • Snapshot
    • Host
    • Filesystem
    • Nas Server
    • NFS Share
  • Create/Delete LUNs
  • Create/Delete Filesystems
  • Create/Delete NFS Shares
  • Attach/Detach Hosts to LUNs
  • Create/Attach/Detach/Copy Snapshots

Installation

go get github.com/murray-liang/gounity

Tutorial

Create a connection to Unity Systems
unity, err := gounity.NewUnity(
    "UnityMgmtIP", "username", "password", true,
)
if err != nil {
    panic(err)
}
Query storage pools
// List all the pools
pools, err := unity.GetPools()

// Get the pool by ID
pool, err := unity.GetPoolById("Pool_1")
Create LUNs
// Create a 3GB LUN named `lunName` on `pool`
lun, err := pool.CreateLun("lunName", 3)
Query Hosts
host, err := unity.GetHostById("Host_1")
Attach LUNs to Hosts
hluNum, err := host.Attach(lun)
More examples

*_test.go files of this package contains lots of detailed examples.

Optional Parameters

Optional parameters are supported for forward compatibility.

fs, err := pool.CreateFilesystem(
    nas, "fs-name", 3,
    // `SupportedProtocol` is optional.
    gounity.SupportedProtocolsOpt(gounity.FSSupportedProtocolNFS),
)

Triage

HTTP requests and responses are traced with logs by enabling GOUNITY_TRACEHTTP.

  1. Set environment variable GOUNITY_TRACEHTTP.
    $ export GOUNITY_TRACEHTTP=true
    
  2. In your codes, enable Debug log level of logrus.
    logrus.SetLevel(logrus.DebugLevel)
    // Your codes continue here ......
    

Issues

If you have any questions or find any issues, please post Github Issues.

Contribute Guideline

You are one of the collaborators
  1. Create a branch from the latest develop branch: git checkout -b <branch_name>.
  2. Push code changes to your branch. Please make sure your changes be covered by unittest.
  3. Push your branch to the remote.
  4. Publish a pull request from your branch to develop branch.
  5. Merge the pull request after passing the review. Recommend using Squash and Merge and deleting your branch after merging.
You aren't
  1. Fork this repo as your own one.
  2. Push code changes to your repo. Please make sure your changes be covered by unittest.
  3. Publish a pull request from your repo to develop branch of this repo.
  4. Wait for merging the pull request.

Develop Tips

Code Generation

*_gen.go source files are generated by go generate. The templates and source files can be found under cmd/modelgen. You are not supposed to edit the *_gen.go files but the templates.

Once you modify the templates, run go generate, then all *_gen.go files update.

End to End Tests

Test cases in integration_test.go require a real Unity. go test won't run the cases there.

The below commands would help out.

# The integration tests would fail depending on the resources on Unity.
# Modify the cases accordingly before running.

# Command to test `CreateLun` on a real Unity.
$ go test -tags=integration -v -run TestE2ECreateLun \
    -args -mgmtIp='10.245.101.39' -username=admin -password=*****

# Command to run all integration tests on a real Unity.
$ go test -tags=integration -v \
    -args -mgmtIp='10.245.101.39' -username=admin -password=*****

Documentation

Overview

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.187215664 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.1822526 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.184708848 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.188563197 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.189915819 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.191293435 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.192671868 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.194464791 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.195602676 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.196772626 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.198222076 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.199720105 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.201207186 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.203056294 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.204599391 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.211020128 +0000 UTC.

DO NOT EDIT. GENERATED by go:generate at 2019-05-15 06:25:01.212712479 +0000 UTC.

Index

Constants

View Source
const (

	// UnityLunNameExistErrorCode is error code of UnityLunNameExist.
	UnityLunNameExistErrorCode = 108007744

	// UnityResourceNotFoundErrorCode is error code of UnityResourceNotFound.
	UnityResourceNotFoundErrorCode = 131149829
)
View Source
const (
	// HeaderKeyContentType is key name of `Content-Type`.
	HeaderKeyContentType = "Content-Type"
	// HeaderValueContentTypeJSON is `json` value of `Content-Type`.
	HeaderValueContentTypeJSON = "application/json"
	// HeaderValueContentTypeBinaryOctetStream is `binary` value of `Content-Type`.
	HeaderValueContentTypeBinaryOctetStream = "binary/octet-stream"
)

Variables

View Source
var ErrUnableParseRespToError = errors.New("unable parse response body to unity error")

Functions

func GetUnityErrorStatusCode added in v0.2.0

func GetUnityErrorStatusCode(err error) int

GetUnityErrorStatusCode returns the unity error code.

func IsUnityError added in v0.2.0

func IsUnityError(err error) bool

IsUnityError returns true if err is an unity error.

func IsUnityLunNameExistError added in v0.2.0

func IsUnityLunNameExistError(err error) bool

IsUnityLunNameExistError returns true or false on whether its error code is UnityLunNameExistErrorCode.

func IsUnityResourceNotFoundError added in v0.2.0

func IsUnityResourceNotFoundError(err error) bool

IsUnityResourceNotFoundError returns true or false on whether its error code is UnityResourceNotFoundErrorCode.

func NewFilter added in v0.2.0

func NewFilter(f string) *filter

NewFilter returns a filter used for filtering collection.

func NewFilterOn added in v0.2.0

func NewFilterOn(typeName string) filterOn

func NewFilterf added in v0.2.0

func NewFilterf(format string, args ...interface{}) *filter

NewFilterf returns a filter used for filtering collection.

func NewRestClient

func NewRestClient(
	ctx context.Context, host, username, password string, opts *restClientOptions,
) (*restClient, error)

NewRestClient returns a new REST client to Unity.

func NewRestClientOptions added in v0.2.0

func NewRestClientOptions(insecure, traceHttp bool) *restClientOptions

NewRestClientOptions returns a rest client option for creating rest client.

func ParseUnityError added in v0.2.0

func ParseUnityError(reader io.Reader) (error, error)

Types

type BlockHostAccess

type BlockHostAccess struct {
	Resource

	Host       *Host             `json:"host"`
	AccessMask HostLUNAccessEnum `json:"accessMask"`
}

BlockHostAccess defines `blockHostAccess` type.

type BlockHostAccessEnum added in v0.2.0

type BlockHostAccessEnum int
const (

	// BlockHostAccessOff means: Access is disabled.
	BlockHostAccessOff BlockHostAccessEnum = 0

	// BlockHostAccessOn means: Access is enabled.
	BlockHostAccessOn BlockHostAccessEnum = 1

	// BlockHostAccessMixed means: (Applies to Consistency Groups only.) Indicates that LUNs in a consistency group have different host access.
	BlockHostAccessMixed BlockHostAccessEnum = 2
)

type EthernetPort added in v0.4.0

type EthernetPort struct {
	Resource

	Health   *Health `json:"health"`
	Id       string  `json:"id"`
	IsLinkUp bool    `json:"isLinkUp"`
	Name     string  `json:"name"`
}

EthernetPort defines `ethernetPort` type.

func (*EthernetPort) Refresh added in v0.4.0

func (r *EthernetPort) Refresh() error

Refresh updates the info from Unity.

func (*EthernetPort) Repr added in v0.4.0

func (r *EthernetPort) Repr() *idRepresent

Repr represents a `ethernetPort` object using its id.

type EthernetPortOperatorGen added in v0.4.0

type EthernetPortOperatorGen interface {
	NewEthernetPortById(id string) *EthernetPort

	NewEthernetPortByName(name string) *EthernetPort

	GetEthernetPortById(id string) (*EthernetPort, error)

	GetEthernetPortByName(name string) (*EthernetPort, error)

	GetEthernetPorts() ([]*EthernetPort, error)

	FillEthernetPorts(respEntries []*instanceResp) ([]*EthernetPort, error)

	FilterEthernetPorts(filter *filter) ([]*EthernetPort, error)
}

type FSSupportedProtocolEnum added in v0.2.0

type FSSupportedProtocolEnum int
const (

	// FSSupportedProtocolNFS means: Only NFS share protocol supported by file system.
	FSSupportedProtocolNFS FSSupportedProtocolEnum = 0

	// FSSupportedProtocolCIFS means: Only SMB (also known as CIFS) share protocol is supported by file system.
	FSSupportedProtocolCIFS FSSupportedProtocolEnum = 1

	// FSSupportedProtocolMultiprotocol means: Both share protocols NFS and SMB (also known as CIFS) are supported by file system.
	FSSupportedProtocolMultiprotocol FSSupportedProtocolEnum = 2
)

type Filesystem added in v0.2.0

type Filesystem struct {
	Resource

	Id              string           `json:"id"`
	Name            string           `json:"name"`
	Health          *Health          `json:"health"`
	Description     string           `json:"description"`
	StorageResource *StorageResource `json:"storageResource"`
}

Filesystem defines `filesystem` type.

func (*Filesystem) Delete added in v0.2.0

func (r *Filesystem) Delete() error

Delete deletes a filesystem object.

func (*Filesystem) ExportNfsShare added in v0.2.0

func (fs *Filesystem) ExportNfsShare(
	name string, opts ...Option,
) (*NfsShare, error)

ExportNfsShare exports the nfs share from this filesystem.

func (*Filesystem) Refresh added in v0.2.0

func (r *Filesystem) Refresh() error

Refresh updates the info from Unity.

func (*Filesystem) Repr added in v0.2.0

func (r *Filesystem) Repr() *idRepresent

Repr represents a `filesystem` object using its id.

type FilesystemOperatorGen added in v0.2.0

type FilesystemOperatorGen interface {
	NewFilesystemById(id string) *Filesystem

	NewFilesystemByName(name string) *Filesystem

	GetFilesystemById(id string) (*Filesystem, error)

	GetFilesystemByName(name string) (*Filesystem, error)

	GetFilesystems() ([]*Filesystem, error)

	FillFilesystems(respEntries []*instanceResp) ([]*Filesystem, error)

	FilterFilesystems(filter *filter) ([]*Filesystem, error)
}

type Health

type Health struct {
	Resource

	Value          int      `json:"value"`
	DescriptionIds []string `json:"descriptionIds"`
	Descriptions   []string `json:"descriptions"`
}

Health defines `health` type.

type Host

type Host struct {
	Resource

	Id          string  `json:"id"`
	Name        string  `json:"name"`
	Health      *Health `json:"health"`
	Description string  `json:"description"`
	OsType      string  `json:"osType"`
}

Host defines `host` type.

func (*Host) Attach

func (h *Host) Attach(lun *Lun) (uint16, error)

Attach attaches the Lun to the host.

func (*Host) Detach added in v0.2.0

func (h *Host) Detach(lun *Lun) error

Detach detaches the Lun from the host.

func (*Host) Refresh added in v0.2.0

func (r *Host) Refresh() error

Refresh updates the info from Unity.

func (*Host) Repr added in v0.2.0

func (r *Host) Repr() *idRepresent

Repr represents a `host` object using its id.

type HostLUN

type HostLUN struct {
	Resource

	Id            string          `json:"id"`
	Host          *Host           `json:"host"`
	Type          HostLunTypeEnum `json:"type"`
	Hlu           uint16          `json:"hlu"`
	Lun           *Lun            `json:"lun"`
	IsReadOnly    bool            `json:"isReadOnly"`
	IsDefaultSnap bool            `json:"isDefaultSnap"`
}

HostLUN defines `hostLUN` type.

func (*HostLUN) Refresh added in v0.2.0

func (r *HostLUN) Refresh() error

Refresh updates the info from Unity.

func (*HostLUN) Repr added in v0.2.0

func (r *HostLUN) Repr() *idRepresent

Repr represents a `hostLUN` object using its id.

type HostLUNAccessEnum

type HostLUNAccessEnum int
const (

	// HostLUNAccessNoAccess means: No access.
	HostLUNAccessNoAccess HostLUNAccessEnum = 0

	// HostLUNAccessProduction means: Access to production LUNs only.
	HostLUNAccessProduction HostLUNAccessEnum = 1

	// HostLUNAccessSnapshot means: Access to LUN snapshots only.
	HostLUNAccessSnapshot HostLUNAccessEnum = 2

	// HostLUNAccessBoth means: Access to both production LUNs and their snapshots.
	HostLUNAccessBoth HostLUNAccessEnum = 3

	// HostLUNAccessProductionOn means: Request to grant production access to LUNs for host. Should be used only by GUI.
	HostLUNAccessProductionOn HostLUNAccessEnum = 4

	// HostLUNAccessProductionOff means: Request to deny production access to LUNs for host. Should be used only by GUI.
	HostLUNAccessProductionOff HostLUNAccessEnum = 5

	// HostLUNAccessMixed means: (Applies to consistency groups only.) Indicates that LUNs in a consistency group have different host access. Do not use this value in Create or Modify requests.
	HostLUNAccessMixed HostLUNAccessEnum = 65535
)

type HostLUNOperator added in v0.2.0

type HostLUNOperator interface {
	HostLUNOperatorGen

	FilterHostLunByHostAndLun(hostId, lunId string) (*HostLUN, error)
}

type HostLUNOperatorGen added in v0.2.0

type HostLUNOperatorGen interface {
	NewHostLUNById(id string) *HostLUN

	GetHostLUNById(id string) (*HostLUN, error)

	GetHostLUNs() ([]*HostLUN, error)

	FillHostLUNs(respEntries []*instanceResp) ([]*HostLUN, error)

	FilterHostLUNs(filter *filter) ([]*HostLUN, error)
}

type HostLunTypeEnum added in v0.2.0

type HostLunTypeEnum int
const (

	// HostLunTypeUnknown means: Unknown LUN type.
	HostLunTypeUnknown HostLunTypeEnum = 0

	// HostLunTypeLUN means: Production LUN.
	HostLunTypeLUN HostLunTypeEnum = 1

	// HostLunTypeLUN_Snap means: Snapshot LUN.
	HostLunTypeLUN_Snap HostLunTypeEnum = 2
)

type HostOperatorGen added in v0.2.0

type HostOperatorGen interface {
	NewHostById(id string) *Host

	NewHostByName(name string) *Host

	GetHostById(id string) (*Host, error)

	GetHostByName(name string) (*Host, error)

	GetHosts() ([]*Host, error)

	FillHosts(respEntries []*instanceResp) ([]*Host, error)

	FilterHosts(filter *filter) ([]*Host, error)
}

type IpProtocolVersionEnum added in v0.4.0

type IpProtocolVersionEnum int
const (

	// IpProtocolVersionIPv4 means: Network interface uses IPv4 address.
	IpProtocolVersionIPv4 IpProtocolVersionEnum = 4

	// IpProtocolVersionIPv6 means: Network interface uses IPv6 address.
	IpProtocolVersionIPv6 IpProtocolVersionEnum = 6
)

type IscsiNode added in v0.4.0

type IscsiNode struct {
	Resource

	Alias        string       `json:"alias"`
	EthernetPort EthernetPort `json:"ethernetPort"`
	Id           string       `json:"id"`
	Name         string       `json:"name"`
}

IscsiNode defines `iscsiNode` type.

func (*IscsiNode) Refresh added in v0.4.0

func (r *IscsiNode) Refresh() error

Refresh updates the info from Unity.

func (*IscsiNode) Repr added in v0.4.0

func (r *IscsiNode) Repr() *idRepresent

Repr represents a `iscsiNode` object using its id.

type IscsiNodeOperatorGen added in v0.4.0

type IscsiNodeOperatorGen interface {
	NewIscsiNodeById(id string) *IscsiNode

	NewIscsiNodeByName(name string) *IscsiNode

	GetIscsiNodeById(id string) (*IscsiNode, error)

	GetIscsiNodeByName(name string) (*IscsiNode, error)

	GetIscsiNodes() ([]*IscsiNode, error)

	FillIscsiNodes(respEntries []*instanceResp) ([]*IscsiNode, error)

	FilterIscsiNodes(filter *filter) ([]*IscsiNode, error)
}

type IscsiPortal added in v0.4.0

type IscsiPortal struct {
	Resource

	EthernetPort      *EthernetPort         `json:"ethernetPort"`
	Gateway           string                `json:"gateway"`
	Id                string                `json:"id"`
	IpAddress         string                `json:"ipAddress"`
	IpProtocolVersion IpProtocolVersionEnum `json:"ipProtocolVersion"`
	IscsiNode         *IscsiNode            `json:"iscsiNode"`
	Netmask           string                `json:"netmask"`
	V6PrefixLength    uint32                `json:"v6PrefixLength"`
	VlanId            uint16                `json:"vlanId"`
}

IscsiPortal defines `iscsiPortal` type.

func (*IscsiPortal) Refresh added in v0.4.0

func (r *IscsiPortal) Refresh() error

Refresh updates the info from Unity.

func (*IscsiPortal) Repr added in v0.4.0

func (r *IscsiPortal) Repr() *idRepresent

Repr represents a `iscsiPortal` object using its id.

type IscsiPortalOperatorGen added in v0.4.0

type IscsiPortalOperatorGen interface {
	NewIscsiPortalById(id string) *IscsiPortal

	GetIscsiPortalById(id string) (*IscsiPortal, error)

	GetIscsiPortals() ([]*IscsiPortal, error)

	FillIscsiPortals(respEntries []*instanceResp) ([]*IscsiPortal, error)

	FilterIscsiPortals(filter *filter) ([]*IscsiPortal, error)
}

type Lun added in v0.2.0

type Lun struct {
	Resource

	Description           string             `json:"description"`
	Health                *Health            `json:"health"`
	HostAccess            []*BlockHostAccess `json:"hostAccess"`
	Id                    string             `json:"id"`
	IsThinEnabled         bool               `json:"isThinEnabled"`
	MetadataSize          uint64             `json:"metadataSize"`
	MetadataSizeAllocated uint64             `json:"metadataSizeAllocated"`
	Name                  string             `json:"name"`
	Pool                  *Pool              `json:"pool"`
	SizeAllocated         uint64             `json:"sizeAllocated"`
	SizeTotal             uint64             `json:"sizeTotal"`
	SizeUsed              uint64             `json:"sizeUsed"`
	SnapCount             uint32             `json:"snapCount"`
	SnapWwn               string             `json:"snapWwn"`
	SnapsSize             uint64             `json:"snapsSize"`
	SnapsSizeAllocated    uint64             `json:"snapsSizeAllocated"`
	StorageResource       *StorageResource   `json:"storageResource"`
	Wwn                   string             `json:"wwn"`
}

Lun defines `lun` type.

func (*Lun) Delete added in v0.2.0

func (r *Lun) Delete() error

Delete deletes a lun object.

func (*Lun) Refresh added in v0.2.0

func (r *Lun) Refresh() error

Refresh updates the info from Unity.

func (*Lun) Repr added in v0.2.0

func (r *Lun) Repr() *idRepresent

Repr represents a `lun` object using its id.

type LunOperatorGen added in v0.2.0

type LunOperatorGen interface {
	NewLunById(id string) *Lun

	NewLunByName(name string) *Lun

	GetLunById(id string) (*Lun, error)

	GetLunByName(name string) (*Lun, error)

	GetLuns() ([]*Lun, error)

	FillLuns(respEntries []*instanceResp) ([]*Lun, error)

	FilterLuns(filter *filter) ([]*Lun, error)
}

type NFSShareDefaultAccessEnum added in v0.2.0

type NFSShareDefaultAccessEnum int
const (

	// NFSShareDefaultAccessNoAccess means: Deny access to the share for the hosts.
	NFSShareDefaultAccessNoAccess NFSShareDefaultAccessEnum = 0

	// NFSShareDefaultAccessReadOnly means: Allow read only access to the share for the hosts.
	NFSShareDefaultAccessReadOnly NFSShareDefaultAccessEnum = 1

	// NFSShareDefaultAccessReadWrite means: Allow read write access to the share for the hosts.
	NFSShareDefaultAccessReadWrite NFSShareDefaultAccessEnum = 2

	// NFSShareDefaultAccessRoot means: Allow read write root access to the share for the hosts.
	NFSShareDefaultAccessRoot NFSShareDefaultAccessEnum = 3

	// NFSShareDefaultAccessRoRoot means: Allow read only root access to the share for the hosts.
	NFSShareDefaultAccessRoRoot NFSShareDefaultAccessEnum = 4
)

type NasServer added in v0.2.0

type NasServer struct {
	Resource

	Id     string  `json:"id"`
	Name   string  `json:"name"`
	Health *Health `json:"health"`
}

NasServer defines `nasServer` type.

func (*NasServer) Refresh added in v0.2.0

func (r *NasServer) Refresh() error

Refresh updates the info from Unity.

func (*NasServer) Repr added in v0.2.0

func (r *NasServer) Repr() *idRepresent

Repr represents a `nasServer` object using its id.

type NasServerOperatorGen added in v0.2.0

type NasServerOperatorGen interface {
	NewNasServerById(id string) *NasServer

	NewNasServerByName(name string) *NasServer

	GetNasServerById(id string) (*NasServer, error)

	GetNasServerByName(name string) (*NasServer, error)

	GetNasServers() ([]*NasServer, error)

	FillNasServers(respEntries []*instanceResp) ([]*NasServer, error)

	FilterNasServers(filter *filter) ([]*NasServer, error)
}

type NfsShare added in v0.2.0

type NfsShare struct {
	Resource

	Id          string      `json:"id"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	ExportPaths []string    `json:"exportPaths"`
	Filesystem  *Filesystem `json:"filesystem"`
}

NfsShare defines `nfsShare` type.

func (*NfsShare) Delete added in v0.2.0

func (r *NfsShare) Delete() error

func (*NfsShare) Refresh added in v0.2.0

func (r *NfsShare) Refresh() error

Refresh updates the info from Unity.

func (*NfsShare) Repr added in v0.2.0

func (r *NfsShare) Repr() *idRepresent

Repr represents a `nfsShare` object using its id.

type NfsShareOperatorGen added in v0.2.0

type NfsShareOperatorGen interface {
	NewNfsShareById(id string) *NfsShare

	NewNfsShareByName(name string) *NfsShare

	GetNfsShareById(id string) (*NfsShare, error)

	GetNfsShareByName(name string) (*NfsShare, error)

	GetNfsShares() ([]*NfsShare, error)

	FillNfsShares(respEntries []*instanceResp) ([]*NfsShare, error)

	FilterNfsShares(filter *filter) ([]*NfsShare, error)
}

type Option added in v0.2.0

type Option func(*Options)

Option defines an optional parameter.

func DefaultAccessOpt added in v0.2.0

func DefaultAccessOpt(da NFSShareDefaultAccessEnum) Option

DefaultAccessOpt constructs optional parameter `defaultAccess`.

func HostAccessOpt added in v0.2.0

func HostAccessOpt(host *Host, accessMask HostLUNAccessEnum) Option

HostAccessOpt constructs optional parameter `hostAccess`.

func NameOpt added in v0.2.0

func NameOpt(name string) Option

NameOpt constructs optional parameter `name`.

func SizeGBOpt added in v0.2.0

func SizeGBOpt(sizeGB uint64) Option

SizeGBOpt constructs optional parameter `size` in GB.

func SupportedProtocolsOpt added in v0.2.0

func SupportedProtocolsOpt(protocol FSSupportedProtocolEnum) Option

SupportedProtocolsOpt constructs optional parameter `supportedProtocols`.

type Options added in v0.2.0

type Options map[string]interface{}

Options defines the mapping of optional parameters.

func NewOptions added in v0.2.0

func NewOptions(opts ...Option) *Options

NewOptions constructs the optional parameters.

func (*Options) PopDefaultAccess added in v0.2.0

func (o *Options) PopDefaultAccess() interface{}

PopDefaultAccess retrieves optional parameter `defaultAccess` and removes it from options.

func (*Options) PopHostAccess added in v0.2.0

func (o *Options) PopHostAccess() interface{}

PopHostAccess retrieves optional parameter `hostAccess` and removes it from options.

func (*Options) PopName added in v0.2.0

func (o *Options) PopName() interface{}

PopName retrieves optional parameter `name` and removes it from options.

func (*Options) PopSize added in v0.2.0

func (o *Options) PopSize() interface{}

PopSize retrieves optional parameter `size` and removes it from options.

func (*Options) PopSupportedProtocols added in v0.2.0

func (o *Options) PopSupportedProtocols() interface{}

PopSupportedProtocols retrieves optional parameter `supportedProtocols` and removes it from options.

func (*Options) PushDefaultAccess added in v0.2.0

func (o *Options) PushDefaultAccess(da NFSShareDefaultAccessEnum)

PushDefaultAccess adds optional parameter `defaultAccess`.

func (*Options) PushHostAccess added in v0.2.0

func (o *Options) PushHostAccess(host *Host, accessMask HostLUNAccessEnum)

PushHostAccess adds optional parameter `hostAccess`.

func (*Options) PushName added in v0.2.0

func (o *Options) PushName(name string)

PushName adds optional parameter `name`.

func (*Options) PushSize added in v0.2.0

func (o *Options) PushSize(sizeBytes uint64)

PushSize adds optional parameter `size`.

func (*Options) PushSupportedProtocols added in v0.2.0

func (o *Options) PushSupportedProtocols(protocol FSSupportedProtocolEnum)

PushSupportedProtocols adds optional parameter `supportedProtocols`.

func (*Options) WarnNotUsedOptions added in v0.2.0

func (o *Options) WarnNotUsedOptions()

WarnNotUsedOptions logs warning messages for not-used optional parameters.

type Pool

type Pool struct {
	Resource

	Id          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Health      *Health `json:"health"`
	SizeFree    uint64  `json:"sizeFree"`
	SizeTotal   uint64  `json:"sizeTotal"`
	SizeUsed    uint64  `json:"sizeUsed"`
}

Pool defines `pool` type.

func (*Pool) CreateFilesystem added in v0.2.0

func (p *Pool) CreateFilesystem(
	nasServer *NasServer, name string, sizeGB uint64, opts ...Option,
) (*Filesystem, error)

CreateFilesystem creates a new filesystem on the pool. Parameters - nasServer, name and sizeGB are required. SupportedProtocolsOpt is optional.

func (*Pool) CreateLun added in v0.2.0

func (p *Pool) CreateLun(
	name string, sizeGB uint64, opts ...Option,
) (*Lun, error)

CreateLun creates a new Lun on the pool. Parameter - name and sizeGB are required. HostAccessOpt is optional.

func (*Pool) CreateNfsShare added in v0.2.0

func (p *Pool) CreateNfsShare(
	nasServer *NasServer, name string, sizeGB uint64, opts ...Option,
) (*NfsShare, error)

CreateNfsShare creates a new filesystem on the pool then exports a nfs share from it. Parameters - nasServer, name and sizeGB are required. DefaultAccessOpt is optional.

func (*Pool) Refresh added in v0.2.0

func (r *Pool) Refresh() error

Refresh updates the info from Unity.

func (*Pool) Repr added in v0.2.0

func (r *Pool) Repr() *idRepresent

Repr represents a `pool` object using its id.

type PoolOperatorGen added in v0.2.0

type PoolOperatorGen interface {
	NewPoolById(id string) *Pool

	NewPoolByName(name string) *Pool

	GetPoolById(id string) (*Pool, error)

	GetPoolByName(name string) (*Pool, error)

	GetPools() ([]*Pool, error)

	FillPools(respEntries []*instanceResp) ([]*Pool, error)

	FilterPools(filter *filter) ([]*Pool, error)
}

type Resource added in v0.2.0

type Resource struct {
	Unity UnityConnector
	// contains filtered or unexported fields
}

type RestClient

type RestClient interface {
	Do(
		ctx context.Context,
		method, path string, body, resp interface{},
	) error

	Get(
		ctx context.Context,
		path string, headers map[string]string, resp interface{},
	) error

	Post(
		ctx context.Context,
		path string, headers map[string]string, body, resp interface{},
	) error

	Delete(
		ctx context.Context,
		path string, headers map[string]string, body, resp interface{},
	) error
}

RestClient acts as a REST client.

type Snap added in v0.3.0

type Snap struct {
	Resource

	Id              string              `json:"id"`
	Name            string              `json:"name"`
	Description     string              `json:"description"`
	StorageResource *StorageResource    `json:"storageResource"`
	Lun             *Lun                `json:"lun"`
	CreationTime    string              `json:"creationTime"`
	ExpirationTime  string              `json:"expirationTime"`
	CreatorType     SnapCreatorTypeEnum `json:"creatorType"`
	IsSystemSnap    bool                `json:"isSystemSnap"`
	IsModifiable    bool                `json:"isModifiable"`
	IsReadOnly      bool                `json:"isReadOnly"`
	IsModified      bool                `json:"isModified"`
	State           SnapStateEnum       `json:"state"`
	Size            uint64              `json:"size"`
	HostAccess      []*SnapHostAccess   `json:"hostAccess"`
}

Snap defines `snap` type.

func (*Snap) AttachToHost added in v0.3.0

func (s *Snap) AttachToHost(host *Host, access SnapAccessLevelEnum) error

func (*Snap) Copy added in v0.3.0

func (s *Snap) Copy(copyName string) (*Snap, error)

func (*Snap) Create added in v0.3.0

func (s *Snap) Create(sr *StorageResource) error

func (*Snap) Delete added in v0.3.0

func (r *Snap) Delete() error

Delete deletes a snap object.

func (*Snap) DetachFromHost added in v0.3.0

func (s *Snap) DetachFromHost() error

func (*Snap) Refresh added in v0.3.0

func (r *Snap) Refresh() error

Refresh updates the info from Unity.

func (*Snap) Repr added in v0.3.0

func (r *Snap) Repr() *idRepresent

Repr represents a `snap` object using its id.

type SnapAccessLevelEnum added in v0.3.0

type SnapAccessLevelEnum int
const (

	// SnapAccessLevelReadOnly means: Allow read-only access to the snapshot for a host.
	SnapAccessLevelReadOnly SnapAccessLevelEnum = 0

	// SnapAccessLevelReadWrite means: Allow read/write access to the snapshot for a host.
	SnapAccessLevelReadWrite SnapAccessLevelEnum = 1

	// SnapAccessLevelReadOnlyPartial means: (Applies to consistency group snapshots only.) Indicates that host has read-only access to some individual snapshots in a consistency group snapshot. Do not use this value in Modify requests.
	SnapAccessLevelReadOnlyPartial SnapAccessLevelEnum = 2

	// SnapAccessLevelReadWritePartial means: (Applies to consistency group snapshots only.) Indicates that host has read/write access to some individual snapshots in a consistency group snapshot. Do not use this value in Modify requests.
	SnapAccessLevelReadWritePartial SnapAccessLevelEnum = 3

	// SnapAccessLevelMixed means: (Applies to consistency group snapshots only.) Indicates that host has read-only and read/write access to some individual snapshots in a consistency group snapshot. Do not use this value in Modify requests.
	SnapAccessLevelMixed SnapAccessLevelEnum = 4
)

type SnapCreatorTypeEnum added in v0.3.0

type SnapCreatorTypeEnum int
const (

	// SnapCreatorTypeNone means: Not specified.
	SnapCreatorTypeNone SnapCreatorTypeEnum = 0

	// SnapCreatorTypeScheduled means: Created by a snapshot schedule.
	SnapCreatorTypeScheduled SnapCreatorTypeEnum = 1

	// SnapCreatorTypeUser_Custom means: Created by a user with a custom name.
	SnapCreatorTypeUser_Custom SnapCreatorTypeEnum = 2

	// SnapCreatorTypeUser_Default means: Created by a user with a default name.
	SnapCreatorTypeUser_Default SnapCreatorTypeEnum = 3

	// SnapCreatorTypeExternal_VSS means: Created by Windows Volume Shadow Copy Service (VSS) to obtain an application consistent snapshot.
	SnapCreatorTypeExternal_VSS SnapCreatorTypeEnum = 4

	// SnapCreatorTypeExternal_NDMP means: Created by an NDMP backup operation.
	SnapCreatorTypeExternal_NDMP SnapCreatorTypeEnum = 5

	// SnapCreatorTypeExternal_Restore means: Created as a backup snapshot before a snapshot restore.
	SnapCreatorTypeExternal_Restore SnapCreatorTypeEnum = 6

	// SnapCreatorTypeExternal_Replication_Manager means: Created by Replication Manager.
	SnapCreatorTypeExternal_Replication_Manager SnapCreatorTypeEnum = 8

	// SnapCreatorTypeReplication means: Created by a native replication operation.
	SnapCreatorTypeReplication SnapCreatorTypeEnum = 9

	// SnapCreatorTypeSnap_CLI means: Created inband by SnapCLI.
	SnapCreatorTypeSnap_CLI SnapCreatorTypeEnum = 11

	// SnapCreatorTypeAppSync means: Created by AppSync.
	SnapCreatorTypeAppSync SnapCreatorTypeEnum = 12
)

type SnapHostAccess added in v0.3.0

type SnapHostAccess struct {
	Resource

	Host       *Host               `json:"host"`
	AccessMask SnapAccessLevelEnum `json:"accessMask"`
}

SnapHostAccess defines `snapHostAccess` type.

type SnapOperatorGen added in v0.3.0

type SnapOperatorGen interface {
	NewSnapById(id string) *Snap

	NewSnapByName(name string) *Snap

	GetSnapById(id string) (*Snap, error)

	GetSnapByName(name string) (*Snap, error)

	GetSnaps() ([]*Snap, error)

	FillSnaps(respEntries []*instanceResp) ([]*Snap, error)

	FilterSnaps(filter *filter) ([]*Snap, error)
}

type SnapStateEnum added in v0.3.0

type SnapStateEnum int
const (

	// SnapStateReady means: The snaphot is operating normally.
	SnapStateReady SnapStateEnum = 2

	// SnapStateFaulted means: The storage pool that the snapshot belongs to is degraded.
	SnapStateFaulted SnapStateEnum = 3

	// SnapStateOffline means: The snapshot is not accessible possibly because the storage resource is not ready or the storage pool is full.
	SnapStateOffline SnapStateEnum = 6

	// SnapStateInvalid means: The snapshot has become invalid becauuse of a non recoverable error.
	SnapStateInvalid SnapStateEnum = 7

	// SnapStateInitializing means: The snapshot is being created.
	SnapStateInitializing SnapStateEnum = 8

	// SnapStateDestroying means: The snapshot is being deleted.
	SnapStateDestroying SnapStateEnum = 9
)

type StorageResource

type StorageResource struct {
	Resource

	Id          string      `json:"id"`
	Name        string      `json:"name"`
	Health      *Health     `json:"health"`
	Description string      `json:"description"`
	Filesystem  *Filesystem `json:"filesystem"`
}

StorageResource defines `storageResource` type.

func (*StorageResource) Refresh added in v0.2.0

func (r *StorageResource) Refresh() error

Refresh updates the info from Unity.

func (*StorageResource) Repr added in v0.2.0

func (r *StorageResource) Repr() *idRepresent

Repr represents a `storageResource` object using its id.

type StorageResourceOperatorGen added in v0.2.0

type StorageResourceOperatorGen interface {
	NewStorageResourceById(id string) *StorageResource

	NewStorageResourceByName(name string) *StorageResource

	GetStorageResourceById(id string) (*StorageResource, error)

	GetStorageResourceByName(name string) (*StorageResource, error)

	GetStorageResources() ([]*StorageResource, error)

	FillStorageResources(respEntries []*instanceResp) ([]*StorageResource, error)

	FilterStorageResources(filter *filter) ([]*StorageResource, error)
}

type Unity

type Unity struct {
	// contains filtered or unexported fields
}

Unity defines the connection to Unity system.

func NewUnity

func NewUnity(
	mgmtIp, username, password string, insecure bool,
) (*Unity, error)

NewUnity creates a connection to a Unity system.

func (*Unity) CreateOnType added in v0.3.0

func (u *Unity) CreateOnType(
	typeName string, body map[string]interface{}, resp interface{},
) error

CreateOnType sends POST request to create resource type.

func (*Unity) DeleteInstance added in v0.2.0

func (u *Unity) DeleteInstance(resType, id string) error

DeleteInstance deletes the instance.

func (*Unity) FillEthernetPorts added in v0.4.0

func (u *Unity) FillEthernetPorts(
	respEntries []*instanceResp,
) ([]*EthernetPort, error)

FillEthernetPorts generates the `ethernetPort` objects from collection query response.

func (*Unity) FillFilesystems added in v0.2.0

func (u *Unity) FillFilesystems(
	respEntries []*instanceResp,
) ([]*Filesystem, error)

FillFilesystems generates the `filesystem` objects from collection query response.

func (*Unity) FillHostLUNs added in v0.2.0

func (u *Unity) FillHostLUNs(
	respEntries []*instanceResp,
) ([]*HostLUN, error)

FillHostLUNs generates the `hostLUN` objects from collection query response.

func (*Unity) FillHosts added in v0.2.0

func (u *Unity) FillHosts(
	respEntries []*instanceResp,
) ([]*Host, error)

FillHosts generates the `host` objects from collection query response.

func (*Unity) FillIscsiNodes added in v0.4.0

func (u *Unity) FillIscsiNodes(
	respEntries []*instanceResp,
) ([]*IscsiNode, error)

FillIscsiNodes generates the `iscsiNode` objects from collection query response.

func (*Unity) FillIscsiPortals added in v0.4.0

func (u *Unity) FillIscsiPortals(
	respEntries []*instanceResp,
) ([]*IscsiPortal, error)

FillIscsiPortals generates the `iscsiPortal` objects from collection query response.

func (*Unity) FillLuns added in v0.2.0

func (u *Unity) FillLuns(
	respEntries []*instanceResp,
) ([]*Lun, error)

FillLuns generates the `lun` objects from collection query response.

func (*Unity) FillNasServers added in v0.2.0

func (u *Unity) FillNasServers(
	respEntries []*instanceResp,
) ([]*NasServer, error)

FillNasServers generates the `nasServer` objects from collection query response.

func (*Unity) FillNfsShares added in v0.2.0

func (u *Unity) FillNfsShares(
	respEntries []*instanceResp,
) ([]*NfsShare, error)

FillNfsShares generates the `nfsShare` objects from collection query response.

func (*Unity) FillPools added in v0.2.0

func (u *Unity) FillPools(
	respEntries []*instanceResp,
) ([]*Pool, error)

FillPools generates the `pool` objects from collection query response.

func (*Unity) FillSnaps added in v0.3.0

func (u *Unity) FillSnaps(
	respEntries []*instanceResp,
) ([]*Snap, error)

FillSnaps generates the `snap` objects from collection query response.

func (*Unity) FillStorageResources added in v0.2.0

func (u *Unity) FillStorageResources(
	respEntries []*instanceResp,
) ([]*StorageResource, error)

FillStorageResources generates the `storageResource` objects from collection query response.

func (*Unity) FilterEthernetPorts added in v0.4.0

func (u *Unity) FilterEthernetPorts(
	filter *filter,
) ([]*EthernetPort, error)

FilterEthernetPorts filters the `ethernetPort` objects by given filters.

func (*Unity) FilterFilesystems added in v0.2.0

func (u *Unity) FilterFilesystems(
	filter *filter,
) ([]*Filesystem, error)

FilterFilesystems filters the `filesystem` objects by given filters.

func (*Unity) FilterHostLUNs added in v0.2.0

func (u *Unity) FilterHostLUNs(
	filter *filter,
) ([]*HostLUN, error)

FilterHostLUNs filters the `hostLUN` objects by given filters.

func (*Unity) FilterHostLunByHostAndLun added in v0.2.0

func (u *Unity) FilterHostLunByHostAndLun(hostId, lunId string) (*HostLUN, error)

FilterHostLunByHostAndLun filters the `HostLun` by given its host Id and Lun Id.

func (*Unity) FilterHosts added in v0.2.0

func (u *Unity) FilterHosts(
	filter *filter,
) ([]*Host, error)

FilterHosts filters the `host` objects by given filters.

func (*Unity) FilterIscsiNodes added in v0.4.0

func (u *Unity) FilterIscsiNodes(
	filter *filter,
) ([]*IscsiNode, error)

FilterIscsiNodes filters the `iscsiNode` objects by given filters.

func (*Unity) FilterIscsiPortals added in v0.4.0

func (u *Unity) FilterIscsiPortals(
	filter *filter,
) ([]*IscsiPortal, error)

FilterIscsiPortals filters the `iscsiPortal` objects by given filters.

func (*Unity) FilterLuns added in v0.2.0

func (u *Unity) FilterLuns(
	filter *filter,
) ([]*Lun, error)

FilterLuns filters the `lun` objects by given filters.

func (*Unity) FilterNasServers added in v0.2.0

func (u *Unity) FilterNasServers(
	filter *filter,
) ([]*NasServer, error)

FilterNasServers filters the `nasServer` objects by given filters.

func (*Unity) FilterNfsShares added in v0.2.0

func (u *Unity) FilterNfsShares(
	filter *filter,
) ([]*NfsShare, error)

FilterNfsShares filters the `nfsShare` objects by given filters.

func (*Unity) FilterPools added in v0.2.0

func (u *Unity) FilterPools(
	filter *filter,
) ([]*Pool, error)

FilterPools filters the `pool` objects by given filters.

func (*Unity) FilterSnaps added in v0.3.0

func (u *Unity) FilterSnaps(
	filter *filter,
) ([]*Snap, error)

FilterSnaps filters the `snap` objects by given filters.

func (*Unity) FilterStorageResources added in v0.2.0

func (u *Unity) FilterStorageResources(
	filter *filter,
) ([]*StorageResource, error)

FilterStorageResources filters the `storageResource` objects by given filters.

func (*Unity) GetCollection added in v0.2.0

func (u *Unity) GetCollection(
	resType, fields string, filter *filter,
) ([]*instanceResp, error)

GetCollection queries instance collection.

func (*Unity) GetEthernetPortById added in v0.4.0

func (u *Unity) GetEthernetPortById(
	id string,
) (*EthernetPort, error)

GetEthernetPortById retrives the `ethernetPort` by given its id.

func (*Unity) GetEthernetPortByName added in v0.4.0

func (u *Unity) GetEthernetPortByName(
	name string,
) (*EthernetPort, error)

GetEthernetPortByName retrives the `ethernetPort` by given its name.

func (*Unity) GetEthernetPorts added in v0.4.0

func (u *Unity) GetEthernetPorts() ([]*EthernetPort, error)

GetEthernetPorts retrives all `ethernetPort` objects.

func (*Unity) GetFilesystemById added in v0.2.0

func (u *Unity) GetFilesystemById(
	id string,
) (*Filesystem, error)

GetFilesystemById retrives the `filesystem` by given its id.

func (*Unity) GetFilesystemByName added in v0.2.0

func (u *Unity) GetFilesystemByName(
	name string,
) (*Filesystem, error)

GetFilesystemByName retrives the `filesystem` by given its name.

func (*Unity) GetFilesystems added in v0.2.0

func (u *Unity) GetFilesystems() ([]*Filesystem, error)

GetFilesystems retrives all `filesystem` objects.

func (*Unity) GetHostById added in v0.2.0

func (u *Unity) GetHostById(
	id string,
) (*Host, error)

GetHostById retrives the `host` by given its id.

func (*Unity) GetHostByName added in v0.2.0

func (u *Unity) GetHostByName(
	name string,
) (*Host, error)

GetHostByName retrives the `host` by given its name.

func (*Unity) GetHostLUNById added in v0.2.0

func (u *Unity) GetHostLUNById(
	id string,
) (*HostLUN, error)

GetHostLUNById retrives the `hostLUN` by given its id.

func (*Unity) GetHostLUNs added in v0.2.0

func (u *Unity) GetHostLUNs() ([]*HostLUN, error)

GetHostLUNs retrives all `hostLUN` objects.

func (*Unity) GetHosts

func (u *Unity) GetHosts() ([]*Host, error)

GetHosts retrives all `host` objects.

func (*Unity) GetInstanceById added in v0.2.0

func (u *Unity) GetInstanceById(
	resType, id, fields string, instance interface{},
) error

GetInstanceById queries instance via id.

func (*Unity) GetInstanceByName added in v0.2.0

func (u *Unity) GetInstanceByName(
	resType, name, fields string, instance interface{},
) error

GetInstanceByName queries instance via name.

func (*Unity) GetIscsiNodeById added in v0.4.0

func (u *Unity) GetIscsiNodeById(
	id string,
) (*IscsiNode, error)

GetIscsiNodeById retrives the `iscsiNode` by given its id.

func (*Unity) GetIscsiNodeByName added in v0.4.0

func (u *Unity) GetIscsiNodeByName(
	name string,
) (*IscsiNode, error)

GetIscsiNodeByName retrives the `iscsiNode` by given its name.

func (*Unity) GetIscsiNodes added in v0.4.0

func (u *Unity) GetIscsiNodes() ([]*IscsiNode, error)

GetIscsiNodes retrives all `iscsiNode` objects.

func (*Unity) GetIscsiPortalById added in v0.4.0

func (u *Unity) GetIscsiPortalById(
	id string,
) (*IscsiPortal, error)

GetIscsiPortalById retrives the `iscsiPortal` by given its id.

func (*Unity) GetIscsiPortals added in v0.4.0

func (u *Unity) GetIscsiPortals() ([]*IscsiPortal, error)

GetIscsiPortals retrives all `iscsiPortal` objects.

func (*Unity) GetLunById added in v0.2.0

func (u *Unity) GetLunById(
	id string,
) (*Lun, error)

GetLunById retrives the `lun` by given its id.

func (*Unity) GetLunByName added in v0.2.0

func (u *Unity) GetLunByName(
	name string,
) (*Lun, error)

GetLunByName retrives the `lun` by given its name.

func (*Unity) GetLuns added in v0.2.0

func (u *Unity) GetLuns() ([]*Lun, error)

GetLuns retrives all `lun` objects.

func (*Unity) GetNasServerById added in v0.2.0

func (u *Unity) GetNasServerById(
	id string,
) (*NasServer, error)

GetNasServerById retrives the `nasServer` by given its id.

func (*Unity) GetNasServerByName added in v0.2.0

func (u *Unity) GetNasServerByName(
	name string,
) (*NasServer, error)

GetNasServerByName retrives the `nasServer` by given its name.

func (*Unity) GetNasServers added in v0.2.0

func (u *Unity) GetNasServers() ([]*NasServer, error)

GetNasServers retrives all `nasServer` objects.

func (*Unity) GetNfsShareById added in v0.2.0

func (u *Unity) GetNfsShareById(
	id string,
) (*NfsShare, error)

GetNfsShareById retrives the `nfsShare` by given its id.

func (*Unity) GetNfsShareByName added in v0.2.0

func (u *Unity) GetNfsShareByName(
	name string,
) (*NfsShare, error)

GetNfsShareByName retrives the `nfsShare` by given its name.

func (*Unity) GetNfsShares added in v0.2.0

func (u *Unity) GetNfsShares() ([]*NfsShare, error)

GetNfsShares retrives all `nfsShare` objects.

func (*Unity) GetPoolById added in v0.2.0

func (u *Unity) GetPoolById(
	id string,
) (*Pool, error)

GetPoolById retrives the `pool` by given its id.

func (*Unity) GetPoolByName added in v0.2.0

func (u *Unity) GetPoolByName(
	name string,
) (*Pool, error)

GetPoolByName retrives the `pool` by given its name.

func (*Unity) GetPools

func (u *Unity) GetPools() ([]*Pool, error)

GetPools retrives all `pool` objects.

func (*Unity) GetSnapById added in v0.3.0

func (u *Unity) GetSnapById(
	id string,
) (*Snap, error)

GetSnapById retrives the `snap` by given its id.

func (*Unity) GetSnapByName added in v0.3.0

func (u *Unity) GetSnapByName(
	name string,
) (*Snap, error)

GetSnapByName retrives the `snap` by given its name.

func (*Unity) GetSnaps added in v0.3.0

func (u *Unity) GetSnaps() ([]*Snap, error)

GetSnaps retrives all `snap` objects.

func (*Unity) GetStorageResourceById added in v0.2.0

func (u *Unity) GetStorageResourceById(
	id string,
) (*StorageResource, error)

GetStorageResourceById retrives the `storageResource` by given its id.

func (*Unity) GetStorageResourceByName added in v0.2.0

func (u *Unity) GetStorageResourceByName(
	name string,
) (*StorageResource, error)

GetStorageResourceByName retrives the `storageResource` by given its name.

func (*Unity) GetStorageResources added in v0.2.0

func (u *Unity) GetStorageResources() ([]*StorageResource, error)

GetStorageResources retrives all `storageResource` objects.

func (*Unity) NewEthernetPortById added in v0.4.0

func (u *Unity) NewEthernetPortById(
	id string,
) *EthernetPort

NewEthernetPortById constructs a `EthernetPort` object with id.

func (*Unity) NewEthernetPortByName added in v0.4.0

func (u *Unity) NewEthernetPortByName(
	name string,
) *EthernetPort

NewEthernetPortByName constructs a `ethernetPort` object with name.

func (*Unity) NewFilesystemById added in v0.2.0

func (u *Unity) NewFilesystemById(
	id string,
) *Filesystem

NewFilesystemById constructs a `Filesystem` object with id.

func (*Unity) NewFilesystemByName added in v0.2.0

func (u *Unity) NewFilesystemByName(
	name string,
) *Filesystem

NewFilesystemByName constructs a `filesystem` object with name.

func (*Unity) NewHostById added in v0.2.0

func (u *Unity) NewHostById(
	id string,
) *Host

NewHostById constructs a `Host` object with id.

func (*Unity) NewHostByName added in v0.2.0

func (u *Unity) NewHostByName(
	name string,
) *Host

NewHostByName constructs a `host` object with name.

func (*Unity) NewHostLUNById added in v0.2.0

func (u *Unity) NewHostLUNById(
	id string,
) *HostLUN

NewHostLUNById constructs a `HostLUN` object with id.

func (*Unity) NewIscsiNodeById added in v0.4.0

func (u *Unity) NewIscsiNodeById(
	id string,
) *IscsiNode

NewIscsiNodeById constructs a `IscsiNode` object with id.

func (*Unity) NewIscsiNodeByName added in v0.4.0

func (u *Unity) NewIscsiNodeByName(
	name string,
) *IscsiNode

NewIscsiNodeByName constructs a `iscsiNode` object with name.

func (*Unity) NewIscsiPortalById added in v0.4.0

func (u *Unity) NewIscsiPortalById(
	id string,
) *IscsiPortal

NewIscsiPortalById constructs a `IscsiPortal` object with id.

func (*Unity) NewLunById added in v0.2.0

func (u *Unity) NewLunById(
	id string,
) *Lun

NewLunById constructs a `Lun` object with id.

func (*Unity) NewLunByName added in v0.2.0

func (u *Unity) NewLunByName(
	name string,
) *Lun

NewLunByName constructs a `lun` object with name.

func (*Unity) NewNasServerById added in v0.2.0

func (u *Unity) NewNasServerById(
	id string,
) *NasServer

NewNasServerById constructs a `NasServer` object with id.

func (*Unity) NewNasServerByName added in v0.2.0

func (u *Unity) NewNasServerByName(
	name string,
) *NasServer

NewNasServerByName constructs a `nasServer` object with name.

func (*Unity) NewNfsShareById added in v0.2.0

func (u *Unity) NewNfsShareById(
	id string,
) *NfsShare

NewNfsShareById constructs a `NfsShare` object with id.

func (*Unity) NewNfsShareByName added in v0.2.0

func (u *Unity) NewNfsShareByName(
	name string,
) *NfsShare

NewNfsShareByName constructs a `nfsShare` object with name.

func (*Unity) NewPoolById added in v0.2.0

func (u *Unity) NewPoolById(
	id string,
) *Pool

NewPoolById constructs a `Pool` object with id.

func (*Unity) NewPoolByName added in v0.2.0

func (u *Unity) NewPoolByName(
	name string,
) *Pool

NewPoolByName constructs a `pool` object with name.

func (*Unity) NewSnapById added in v0.3.0

func (u *Unity) NewSnapById(
	id string,
) *Snap

NewSnapById constructs a `Snap` object with id.

func (*Unity) NewSnapByName added in v0.3.0

func (u *Unity) NewSnapByName(
	name string,
) *Snap

NewSnapByName constructs a `snap` object with name.

func (*Unity) NewStorageResourceById added in v0.2.0

func (u *Unity) NewStorageResourceById(
	id string,
) *StorageResource

NewStorageResourceById constructs a `StorageResource` object with id.

func (*Unity) NewStorageResourceByName added in v0.2.0

func (u *Unity) NewStorageResourceByName(
	name string,
) *StorageResource

NewStorageResourceByName constructs a `storageResource` object with name.

func (*Unity) PostOnInstance added in v0.2.0

func (u *Unity) PostOnInstance(
	typeName, resId, action string, body map[string]interface{},
) error

PostOnInstance sends POST request on resource instance.

func (*Unity) PostOnType added in v0.2.0

func (u *Unity) PostOnType(
	typeName, action string, body map[string]interface{},
) (string, error)

PostOnType sends POST request on resource type.

type UnityConnector added in v0.2.0

type UnityConnector interface {
	GetInstanceById(
		resType, id, fields string, instance interface{},
	) error

	GetInstanceByName(
		resType, name, fields string, instance interface{},
	) error

	GetCollection(
		resType, fields string, filter *filter,
	) ([]*instanceResp, error)

	PostOnType(
		typeName, action string, body map[string]interface{},
	) (string, error)

	CreateOnType(
		typeName string, body map[string]interface{}, resp interface{},
	) error

	PostOnInstance(
		typeName, resId, action string, body map[string]interface{},
	) error

	DeleteInstance(resType, id string) error

	StorageResourceOperatorGen

	PoolOperatorGen

	LunOperatorGen

	SnapOperatorGen

	HostOperatorGen

	HostLUNOperator

	NasServerOperatorGen

	FilesystemOperatorGen

	NfsShareOperatorGen

	EthernetPortOperatorGen

	IscsiNodeOperatorGen

	IscsiPortalOperatorGen
}

UnityConnector defines the interface to storage system.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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