zfssarest

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: UPL-1.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBlockSize int    = 8192
	DevicePathKey    string = "devicePath"
	MaskAll          string = "com.sun.ms.vss.hg.maskAll"
)

Variables

This section is empty.

Functions

func DeleteFilesystem

func DeleteFilesystem(ctx context.Context, token *Token, hRef string) (bool, int, error)

func DeleteLun

func DeleteLun(ctx context.Context, token *Token, pool, project, lun string) (bool, int, error)

func DeleteSnapshot

func DeleteSnapshot(ctx context.Context, token *Token, href string) (
	bool, int, error)

Issues a request to the appliance to delete a snapshot. The source of the snapshot, LUN or filesystem, is determine by the HREF passed in.

func GetInitiatorGroupList

func GetInitiatorGroupList(ctx context.Context, token *Token, pool, project,
	lun string) ([]string, error)

func GetPools

func GetPools(ctx context.Context, token *Token) (*[]Pool, error)

func GetServices

func GetServices(ctx context.Context, token *Token) (*[]Service, error)

func GetSnapshotDependents

func GetSnapshotDependents(ctx context.Context, token *Token, href string) (*[]Dependent, error)

Returns the clones depending on a snapshot.

func InitREST

func InitREST(name string, certLocation string, secure bool) error

Initializes the ZFSSA REST API interface

func MakeRequest

func MakeRequest(ctx context.Context, token *Token, method, url string, reqbody interface{}, status int,
	rspbody interface{}) (interface{}, int, error)

Makes a request to a target appliance updating the token if needed.

func SetInitiatorGroupList

func SetInitiatorGroupList(ctx context.Context, token *Token, pool, project, lun,
	group string) (int, error)

Types

type Dependent

type Dependent struct {
	Project string `json:"project"`
	HRef    string `json:"href"`
	Share   string `json:"share"`
}

type Filesystem

type Filesystem struct {
	MountPoint      string `json:"mountpoint"`
	CreationTime    string `json:"creation"`
	RootUser        string `json:"root_user"`
	RootGroup       string `json:"root_group"`
	RootPermissions string `json:"root_permissions"`
	RestrictChown   bool   `json:"rstchown"`
	ShareNFS        string `json:"sharenfs"`
	ShareSMB        string `json:"sharesmb"`
	SpaceData       int64  `json:"space_data"`
	CanonicalName   string `json:"canonical_name"`
	RecordSize      int64  `json:"recordsize"`
	SpaceAvailable  int64  `json:"space_available"`
	Quota           int64  `json:"quota"`
	UTF8Only        bool   `json:"utf8only"`
	MaxBlockSize    int64  `json:"maxblocksize"`
	Atime           bool   `json:"atime"`
	ReadOnly        bool   `json:"readonly"`
	Pool            string `json:"pool"`
	Name            string `json:"name"`
	SpaceTotal      int64  `json:"space_total"`
	SpaceUnused     int64  `json:"space_unused_res"`
	Project         string `json:"project"`
	Href            string `json:"href"`
}

func CloneFileSystemSnapshot

func CloneFileSystemSnapshot(ctx context.Context, token *Token, hRef string,
	parameters map[string]interface{}) (*Filesystem, int, error)

func CreateFilesystem

func CreateFilesystem(ctx context.Context, token *Token, fsname string, volSize int64,
	parameters *map[string]string) (*Filesystem, int, error)

func GetFilesystem

func GetFilesystem(ctx context.Context, token *Token, pool, project, filesystem string) (
	*Filesystem, int, error)

func GetFilesystems

func GetFilesystems(ctx context.Context, token *Token, pool, project string) ([]Filesystem, error)

Returns the List of filesystems associated with the pool and project passed in. To get a system wide List of file systems, the pool AND the project must be 'nil'

func ModifyFilesystem

func ModifyFilesystem(ctx context.Context, token *Token, href string,
	parameters *map[string]interface{}) (*Filesystem, int, error)

type Lun

type Lun struct {
	SpaceData       float64  `json:"space_data"`
	CanonicalName   string   `json:"canonical_name"`
	VolumeSize      float64  `json:"volsize"`
	VolumeBlockSize int64    `json:"volblocksize"`
	Pool            string   `json:"pool"`
	Project         string   `json:"project"`
	Name            string   `json:"name"`
	Href            string   `json:"href"`
	AssignedNumber  []int32  `json:"assignednumber"`
	InitiatorGroup  []string `json:"initiatorgroup"`
	TargetGroup     string   `json:"targetgroup"`
}

func CloneLunSnapshot

func CloneLunSnapshot(ctx context.Context, token *Token, hRef string,
	parameters map[string]interface{}) (*Lun, int, error)

func CreateLUN

func CreateLUN(ctx context.Context, token *Token, lunName string, volSize int64,
	parameters *map[string]string) (*utils.VolumeId, *Lun, int, error)

func GetLun

func GetLun(ctx context.Context, token *Token, pool, project, lun string) (*Lun, int, error)

func GetLuns

func GetLuns(ctx context.Context, token *Token, pool, project string) ([]Lun, error)

Returns the List of LUNs belonging to the pool and project passed in. To get a system wide List of LUNs, the pool AND the project must be 'nil'

type LunInitiatorGrps

type LunInitiatorGrps struct {
	InitiatorGroup []string `json:"initiatorgroup"`
}

type LunJson

type LunJson struct {
	LUN Lun `json:"lun"`
}

type Luns

type Luns struct {
	List []Lun `json:"luns"`
}

func (*Luns) UnmarshalJSON

func (l *Luns) UnmarshalJSON(b []byte) error

type Pool

type Pool struct {
	Status string `json:"status"`
	Name   string `json:"name"`
	Usage  struct {
		Available             int64 `json:"available"`
		UsageSnapshots        int64 `json:"usage_snapshots"`
		UsageMetasize         int64 `json:"usage_metasize"`
		Used                  int64 `json:"used"`
		UsageChildReservation int64 `json:"usage_child_reservation"`
		UsageReplication      int64 `json:"usage_replication"`
		UsageReservation      int64 `json:"usage_reservation"`
		Free                  int64 `json:"free"`
		UsageTotal            int64 `json:"usage_total"`
		UsageMetaused         int64 `json:"usage_metaused"`
		Total                 int64 `json:"total"`
		UsageData             int64 `json:"usage_data"`
	} `json:"usage"`
	HRef string `json:"href"`
	ASN  string `json:"asn"`
}

func GetPool

func GetPool(ctx context.Context, token *Token, name string) (*Pool, error)

type Project

type Project struct {
	Name           string `json:"name"`
	Pool           string `json:"pool"`
	SpaceAvailable int64  `json:"space_available"`
}

func GetProject

func GetProject(ctx context.Context, token *Token, pool string, project string) (*Project, error)

func GetProjects

func GetProjects(ctx context.Context, token *Token, pool string) ([]Project, error)

Returns the List of filesystems associated with the pool and project passed in. To get a system wide List of file systems, the pool must be 'nil'

type ProjectJSON

type ProjectJSON struct {
	Project Project `json:"project"`
}

type Property

type Property struct {
	Property Schema `json:"property"`
}

type Schema

type Schema struct {
	Type        string `json:"type"`
	Description string `json:"description"`
	Property    string `json:"property"`
	Href        string `json:"href,omitempty"`
}

func CreateProperty

func CreateProperty(ctx context.Context, token *Token, s Schema) (*Schema, error)

func GetProperty

func GetProperty(ctx context.Context, token *Token, property string) (*Schema, error)

type SchemaList

type SchemaList struct {
	Schema []Schema `json:"schema"`
}

This type is to help deserialize from a ZFSSA response, not used internally

func GetSchema

func GetSchema(ctx context.Context, token *Token) (*SchemaList, error)

type Service

type Service struct {
	Version string `json:"version"`
	Name    string `json:"name"`
	URI     string `json:"uri"`
}

type Snapshot

type Snapshot struct {
	Name          string `json:"name"`
	NumClones     int    `json:"numclones"`
	Creation      string `json:"creation"`
	Collection    string `json:"collection"`
	Project       string `json:"project"`
	CanonicalName string `json:"canonical_name"`
	SpaceUnique   int64  `json:"space_unique"`
	SpaceData     int64  `json:"space_data"`
	Type          string `json:"type"`
	ID            string `json:"id"`
	Pool          string `json:"pool"`
	Href          string `json:"href"`
}

func CreateSnapshot

func CreateSnapshot(ctx context.Context, token *Token, href, name string) (*Snapshot, int, error)

Issues a request to the appliance to create a snapshot. The source of the snapshot, LUN or filesystem, is determine by the HREF passed in.

func GetSnapshot

func GetSnapshot(ctx context.Context, token *Token, href, name string) (*Snapshot, int, error)

Issues a request to the appliance asking for the detailed information of a snapshot.

func GetSnapshots

func GetSnapshots(ctx context.Context, token *Token, href string) ([]Snapshot, error)

Issues a request to the appliance asking for a volume's snapshot list.

type Target

type Target struct {
	Alias            string
	Auth             string
	HRef             string
	Interfaces       []string
	IQN              string
	TargetChapSecret string
	TargetChapUser   string
}

type TargetGroup

type TargetGroup struct {
	Name    string
	Targets []string `json:"targets"`
}

func GetTargetGroup

func GetTargetGroup(ctx context.Context, token *Token, protocol, groupName string) (*TargetGroup, error)

type Token

type Token struct {
	Name string
	// contains filtered or unexported fields
}

func LookUpToken

func LookUpToken(ctx context.Context, user, password string) *Token

Looks up a token context based on the user name passed in. If one doesn't exist yet, it is created.

Jump to

Keyboard shortcuts

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