client

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(arr []string, val string) bool

func Filter

func Filter(list []string, check func(string) bool) []string

func IsHeadDisk

func IsHeadDisk(diskName string) bool

IsHeadDisk checks if Disk is a Head

func TrimSnapshotName

func TrimSnapshotName(diskName string) string

TrimSnapshotName trims the snapshot name from diskName string

func TrimSnapshotNamesOfSlice

func TrimSnapshotNamesOfSlice(diskNames []string) []string

TrimSnapshotNamesOfSlice trims the each snapshot name in diskNames Slice

Types

type Collection

type Collection struct {
	Type         string                 `json:"type,omitempty"`
	ResourceType string                 `json:"resourceType,omitempty"`
	Links        map[string]string      `json:"links,omitempty"`
	CreateTypes  map[string]string      `json:"createTypes,omitempty"`
	Actions      map[string]string      `json:"actions,omitempty"`
	SortLinks    map[string]string      `json:"sortLinks,omitempty"`
	Pagination   *Pagination            `json:"pagination,omitempty"`
	Sort         *Sort                  `json:"sort,omitempty"`
	Filters      map[string][]Condition `json:"filters,omitempty"`
}

type Condition

type Condition struct {
	Modifier string      `json:"modifier,omitempty"`
	Value    interface{} `json:"value,omitempty"`
}

type ControllerClient

type ControllerClient struct {
	Address string
	Host    string
	// contains filtered or unexported fields
}

func NewControllerClient

func NewControllerClient(address string) (*ControllerClient, error)

NewControllerClient create the new controller client

func (*ControllerClient) Do

func (c *ControllerClient) Do(method, path string, req, resp interface{}) error

Do sends a request to the specified path and it stores JSON-decoded body from the response into the value pointed to by resp.

func (*ControllerClient) Get

func (c *ControllerClient) Get(path string, obj interface{}) error

Get sends a request to the specified path and stores body in the value pointed to by obj.

func (*ControllerClient) GetVolumeStats

func (c *ControllerClient) GetVolumeStats(address string, api string, obj interface{}) (int, error)

GetVolumeStats is used to get the status of volume controller.It is used to get the response in json format and then the response is then decoded to the desired structure.

func (*ControllerClient) ListReplicas

func (c *ControllerClient) ListReplicas(path string) ([]Replica, error)

ListReplicas to get the details of all the existing replicas which contains address and mode of those replicas (RW/R/W) as well as resource information.

func (*ControllerClient) Post

func (c *ControllerClient) Post(path string, req, resp interface{}) error

Post sends a POST request to the specified path and stores body in the value pointed to by resp.

type DiskInfo

type DiskInfo struct {
	Name        string   `json:"name"`
	Parent      string   `json:"parent"`
	Children    []string `json:"children"`
	Removed     bool     `json:"removed"`
	UserCreated bool     `json:"usercreated"`
	Created     string   `json:"created"`
	Size        string   `json:"size"`
}

type InfoReplica

type InfoReplica struct {
	Resource
	Dirty           bool                `json:"dirty"`
	Rebuilding      bool                `json:"rebuilding"`
	Head            string              `json:"head"`
	Parent          string              `json:"parent"`
	Size            string              `json:"size"`
	SectorSize      int64               `json:"sectorSize"`
	State           string              `json:"state"`
	Chain           []string            `json:"chain"`
	Disks           map[string]DiskInfo `json:"disks"`
	RemainSnapshots int                 `json:"remainsnapshots"`
	RevisionCounter string              `json:"revisioncounter"`
}

type MarkDiskAsRemovedInput

type MarkDiskAsRemovedInput struct {
	Resource
	Name string `json:"name"`
}

type Pagination

type Pagination struct {
	Marker   string `json:"marker,omitempty"`
	First    string `json:"first,omitempty"`
	Previous string `json:"previous,omitempty"`
	Next     string `json:"next,omitempty"`
	Limit    *int64 `json:"limit,omitempty"`
	Total    *int64 `json:"total,omitempty"`
	Partial  bool   `json:"partial,omitempty"`
}

type Replica

type Replica struct {
	Resource
	Address string `json:"address"`
	Mode    string `json:"mode"`
}

type ReplicaClient

type ReplicaClient struct {
	Address   string
	SyncAgent string
	Host      string
	// contains filtered or unexported fields
}

ReplicaClient is Client structure

func NewReplicaClient

func NewReplicaClient(address string) (*ReplicaClient, error)

NewReplicaClient create the new replica client

func (*ReplicaClient) Get

func (c *ReplicaClient) Get(url string, obj interface{}) error

Get obj from a specific url

func (*ReplicaClient) GetReplica

func (c *ReplicaClient) GetReplica() (InfoReplica, error)

GetReplica will return the InfoReplica struct which contains info related to specific replica

func (*ReplicaClient) GetVolumeStats

func (c *ReplicaClient) GetVolumeStats(address string, obj interface{}) (int, error)

GetVolumeStats is the helper function for mayactl.It is used to get the response of the replica created in json format and then the response is then decoded to the desired structure.

func (*ReplicaClient) MarkDiskAsRemoved

func (c *ReplicaClient) MarkDiskAsRemoved(disk string) error

MarkDiskAsRemoved is the helper function to mark the disks as removed

func (*ReplicaClient) Post

func (c *ReplicaClient) Post(path string, req, resp interface{}) error

Post to a specific path

type ReplicaCollection

type ReplicaCollection struct {
	Collection
	Data []Replica `json:"data"`
}

type Resource

type Resource struct {
	Id      string            `json:"id,omitempty"`
	Type    string            `json:"type,omitempty"`
	Links   map[string]string `json:"links"`
	Actions map[string]string `json:"actions"`
}

type RevertInput

type RevertInput struct {
	Resource
	Name string `json:"name"`
}

type SnapshotInput

type SnapshotInput struct {
	Resource
	Name        string            `json:"name"`
	UserCreated bool              `json:"usercreated"`
	Created     string            `json:"created"`
	Labels      map[string]string `json:"labels"`
}

SnapshotInput is Input struct to create snapshot

type SnapshotOutput

type SnapshotOutput struct {
	Resource
}

type Sort

type Sort struct {
	Name    string `json:"name,omitempty"`
	Order   string `json:"order,omitempty"`
	Reverse string `json:"reverse,omitempty"`
}

type VolumeCollection

type VolumeCollection struct {
	Collection
	Data []Volumes `json:"data"`
}

type Volumes

type Volumes struct {
	Resource
	Name         string `json:"name"`
	ReplicaCount int    `json:"replicaCount"`
	Endpoint     string `json:"endpoint"`
}

func GetVolume

func GetVolume(path string) (*Volumes, error)

GetVolume returns Volumes from the specified path.

Jump to

Keyboard shortcuts

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