client

package
v4.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package client provides fusion storage client

Package client provides fusion storage client

Index

Constants

View Source
const (

	// IPLock defines error code of ip lock
	IPLock = 1077949071
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddNfsShareAuthClientRequest added in v4.7.0

type AddNfsShareAuthClientRequest struct {
	AccessName  string `json:"access_name"`
	ShareId     string `json:"share_id"`
	AccessValue int    `json:"access_value"`
	Sync        int    `json:"sync"`
	AllSquash   int    `json:"all_squash"`
	RootSquash  int    `json:"root_squash"`
	AccountId   int    `json:"account_id"`
}

AddNfsShareAuthClientRequest defines the fields to add nfs share auth client request

type AllowNfsShareAccessRequest

type AllowNfsShareAccessRequest struct {
	AccessName  string
	ShareId     string
	AccessValue int
	AllSquash   int
	RootSquash  int
	AccountId   string
}

AllowNfsShareAccessRequest used for AllowNfsShareAccess request

type CreateDTreeNfsShareRequest added in v4.7.0

type CreateDTreeNfsShareRequest struct {
	DtreeId     string `json:"dtree_id"`
	Sharepath   string `json:"share_path"`
	Description string `json:"description"`
	AccountId   int    `json:"account_id"`
}

CreateDTreeNfsShareRequest defines the fields of create dtree nfs share request

type CreateDTreeNfsShareResponse added in v4.7.0

type CreateDTreeNfsShareResponse struct {
	Id string `json:"id"`
}

CreateDTreeNfsShareResponse defines the fields of create dtree nfs share response

type CreateDTreeRequest added in v4.7.0

type CreateDTreeRequest struct {
	Name           string `json:"name"`
	FileSystemName string `json:"file_system_name"`
	UnixPermission string `json:"unix_permission,omitempty"`
	AccountId      int    `json:"account_id"`
}

CreateDTreeRequest defines the fields to create dtree resource

type DTree added in v4.7.0

type DTree interface {
	GetDTreeByName(ctx context.Context, parentName, name string) (*DTreeResponse, error)
	CreateDTree(ctx context.Context, parentName, name, unixPermission string) (*DTreeResponse, error)
	DeleteDTree(ctx context.Context, dtreeId string) error
	GetDTreeNfsShareByPath(ctx context.Context, sharePath string) (*GetDTreeNfsShareResponse, error)
	CreateDTreeNfsShare(ctx context.Context, req *CreateDTreeNfsShareRequest) (*CreateDTreeNfsShareResponse, error)
	DeleteDTreeNfsShare(ctx context.Context, shareId string) error
	AddNfsShareAuthClient(ctx context.Context, req *AddNfsShareAuthClientRequest) error
}

DTree is the interface for Pacific DTree

type DTreeQuotaResponse added in v4.7.0

type DTreeQuotaResponse struct {
	Id             string  `json:"id"`
	ParentId       string  `json:"parent_id"`
	SpaceHardQuota int64   `json:"space_hard_quota"`
	SpaceSoftQuota float64 `json:"space_soft_quota"`
	SpaceUnitType  int64   `json:"space_unit_type"`
}

DTreeQuotaResponse defines the fields of quota

type DTreeResponse added in v4.7.0

type DTreeResponse struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

DTreeResponse defines the fields of dtree response

type GetDTreeNfsShareResponse added in v4.7.0

type GetDTreeNfsShareResponse struct {
	Id        string `json:"id"`
	SharePath string `json:"share_path"`
}

GetDTreeNfsShareResponse defines the fields of dtree nfs share response

type Host added in v4.7.0

type Host interface {
	CreateHost(ctx context.Context, hostName string, alua map[string]interface{}) error
	UpdateHost(ctx context.Context, hostName string, alua map[string]interface{}) error
	QueryHostByPort(ctx context.Context, port string) (string, error)
	AddPortToHost(ctx context.Context, initiatorName, hostName string) error
	AddLunToHost(ctx context.Context, lunName, hostName string) error
	DeleteLunFromHost(ctx context.Context, lunName, hostName string) error
	QueryHostOfVolume(ctx context.Context, lunName string) ([]map[string]interface{}, error)
	GetHostByName(ctx context.Context, hostName string) (map[string]interface{}, error)
}

Host is the interface for host

type HostIscsiInfo added in v4.9.0

type HostIscsiInfo struct {
	Flag int    `json:"flag"`
	Key  string `json:"key"`
}

HostIscsiInfo defines the fields of IsSupportDynamicLinks request item

type IRestClient added in v4.7.0

type IRestClient interface {
	Host
	Iscsi
	Namespace
	Qos
	Quota
	Snapshot
	System
	Volume
	DTree

	ValidateLogin(ctx context.Context) error
	Login(ctx context.Context) error
	SetAccountId(ctx context.Context) error
	Logout(ctx context.Context)
	ReLogin(ctx context.Context) error
	KeepAlive(ctx context.Context)
}

IRestClient defines all methods for fusion storage client

func NewIRestClient added in v4.7.0

func NewIRestClient(ctx context.Context, clientConfig *NewClientConfig) IRestClient

NewIRestClient returns a RestClient as IRestClient

type IsSupportDynamicLinksResponse added in v4.9.0

type IsSupportDynamicLinksResponse struct {
	*SanBaseResponse
	NewIscsi bool `json:"newIscsi"`
}

IsSupportDynamicLinksResponse defines the fields of IsSupportDynamicLinks response

type Iscsi added in v4.7.0

type Iscsi interface {
	GetInitiatorByName(ctx context.Context, name string) (map[string]interface{}, error)
	CreateInitiator(ctx context.Context, name string) error
	QueryIscsiPortal(ctx context.Context) ([]map[string]interface{}, error)
	IsSupportDynamicLinks(ctx context.Context, hostname string) (bool, error)
	QueryDynamicLinks(ctx context.Context, poolName, hostname string, amount int) ([]*IscsiLink, error)
}

Iscsi is the interface for iSCSI

type IscsiLink struct {
	IP            string `json:"ip"`
	IscsiLinksNum int    `json:"iscsiLinksNum"`
	TargetName    string `json:"targetName"`
	IscsiPortal   string `json:"iscsiPortal"`
}

IscsiLink defines the fields of QueryDynamicLinks response item

type Namespace added in v4.7.0

type Namespace interface {
	CreateFileSystem(ctx context.Context, params map[string]any) (map[string]any, error)
	DeleteFileSystem(ctx context.Context, id string) error
	GetFileSystemByName(ctx context.Context, name string) (map[string]interface{}, error)
	CreateNfsShare(ctx context.Context, params map[string]any) (map[string]any, error)
	DeleteNfsShare(ctx context.Context, id, accountId string) error
	GetNfsShareByPath(ctx context.Context, path, accountId string) (map[string]interface{}, error)
	AllowNfsShareAccess(ctx context.Context, req *AllowNfsShareAccessRequest) error
	DeleteNfsShareAccess(ctx context.Context, accessID string) error
	GetNfsShareAccess(ctx context.Context, shareID string) (map[string]interface{}, error)
	GetQuotaByFileSystemName(ctx context.Context, fsName string) (*QueryQuotaResponse, error)
}

Namespace is the interface for namespace

type NasResponse added in v4.9.0

type NasResponse[T any] struct {
	Data       T         `json:"data"`
	Result     NasResult `json:"result"`
	ErrorCode  int64     `json:"errorCode"`
	Suggestion string    `json:"suggestion"`
}

NasResponse defines the response struct from Restful API

func (*NasResponse[T]) GetErrorCode added in v4.9.0

func (resp *NasResponse[T]) GetErrorCode() int64

GetErrorCode returns the error code from the response

func (*NasResponse[T]) NeedRetry added in v4.9.0

func (resp *NasResponse[T]) NeedRetry() bool

NeedRetry determines whether the request needs to be retried

type NasResult added in v4.9.0

type NasResult struct {
	Code        int64  `json:"code"`
	Description string `json:"description"`
	Suggestion  string `json:"suggestion"`
}

NasResult defines the response result from Restful API

type NewClientConfig

type NewClientConfig struct {
	Url             string
	User            string
	SecretName      string
	SecretNamespace string
	ParallelNum     string
	BackendID       string
	AccountName     string
	UseCert         bool
	CertSecretMeta  string
}

NewClientConfig stores the information needed to create a new FusionStorage client

type Qos added in v4.7.0

type Qos interface {
	GetConvergedQoSNameByID(ctx context.Context, qosId int) (string, error)
	CreateConvergedQoS(ctx context.Context, req *types.CreateConvergedQoSReq) (int, error)
	DeleteConvergedQoS(ctx context.Context, qosName string) error
	CreateQoS(ctx context.Context, qosName string, qosData map[string]int) error
	DeleteQoS(ctx context.Context, qosName string) error
	DisassociateConvergedQoSWithVolume(ctx context.Context, objectName string) error
	AssociateConvergedQoSWithVolume(ctx context.Context, req *types.AssociateConvergedQoSWithVolumeReq) error
	AssociateQoSWithVolume(ctx context.Context, volName, qosName string) error
	DisassociateQoSWithVolume(ctx context.Context, volName, qosName string) error
	GetQoSPolicyAssociationCount(ctx context.Context, qosPolicyId int) (int, error)
	GetQoSPolicyIdByFsName(ctx context.Context, namespaceName string) (int, error)
	GetQoSNameByVolume(ctx context.Context, volName string) (string, error)
	GetAssociateCountOfQoS(ctx context.Context, qosName string) (int, error)
}

Qos is the interface for QoS

type QueryDynamicLinksRequest added in v4.9.0

type QueryDynamicLinksRequest struct {
	Amount             int      `json:"amount"`
	IscsiServiceIpType int      `json:"iscsiServiceIpType"`
	PoolList           []string `json:"poolList"`
	HostKey            string   `json:"hostKey"`
}

QueryDynamicLinksRequest defines the fields of QueryDynamicLinks request

type QueryDynamicLinksResponse added in v4.9.0

type QueryDynamicLinksResponse struct {
	*SanBaseResponse
	IscsiLinks []*IscsiLink `json:"iscsiLinks"`
}

QueryDynamicLinksResponse defines the fields of QueryDynamicLinks response

type QueryQuotaResponse added in v4.7.0

type QueryQuotaResponse struct {
	Id             string  `json:"id"`
	SpaceHardQuota uint64  `json:"space_hard_quota"`
	SpaceSoftQuota uint64  `json:"space_soft_quota"`
	SpaceUnitType  float64 `json:"space_unit_type"`
}

QueryQuotaResponse defines the response of quota

type Quota added in v4.7.0

type Quota interface {
	CreateQuota(ctx context.Context, params map[string]interface{}) error
	UpdateQuota(ctx context.Context, params map[string]interface{}) error
	GetQuotaByFileSystemById(ctx context.Context, fsID string) (map[string]interface{}, error)
	QueryQuotaByFsId(ctx context.Context, fsID string) (*QueryQuotaResponse, error)
	DeleteQuota(ctx context.Context, quotaID string) error

	GetQuotaByDTreeId(ctx context.Context, dTreeId string) (*DTreeQuotaResponse, error)
	CreateDTreeQuota(ctx context.Context, dTreeId string, capacity int64) (*DTreeQuotaResponse, error)
	DeleteDTreeQuota(ctx context.Context, quotaId string) error
	UpdateDTreeQuota(ctx context.Context, quotaId string, capacity int64) error
}

Quota is the interface for quota

type RestClient

type RestClient struct {
	RequestSemaphore *utils.Semaphore
	// contains filtered or unexported fields
}

RestClient implement fusion storage client

func NewClient

func NewClient(ctx context.Context, clientConfig *NewClientConfig) *RestClient

NewClient used to init a new fusion storage client

func (*RestClient) AddLunToHost

func (cli *RestClient) AddLunToHost(ctx context.Context, lunName, hostName string) error

AddLunToHost usd to add lun to host

func (*RestClient) AddNfsShareAuthClient added in v4.7.0

func (cli *RestClient) AddNfsShareAuthClient(ctx context.Context, req *AddNfsShareAuthClientRequest) error

AddNfsShareAuthClient adds nfs share auth client

func (*RestClient) AddPortToHost

func (cli *RestClient) AddPortToHost(ctx context.Context, initiatorName, hostName string) error

AddPortToHost used add port to host

func (*RestClient) AllowNfsShareAccess

func (cli *RestClient) AllowNfsShareAccess(ctx context.Context, req *AllowNfsShareAccessRequest) error

AllowNfsShareAccess used for create nfs share client

func (*RestClient) AssociateConvergedQoSWithVolume

func (cli *RestClient) AssociateConvergedQoSWithVolume(ctx context.Context,
	req *types.AssociateConvergedQoSWithVolumeReq) error

AssociateConvergedQoSWithVolume used to add a converged QoS policy association

func (*RestClient) AssociateQoSWithVolume

func (cli *RestClient) AssociateQoSWithVolume(ctx context.Context, volName, qosName string) error

AssociateQoSWithVolume used to associate QoS with volume

func (*RestClient) AttachVolume

func (cli *RestClient) AttachVolume(ctx context.Context, name, ip string) error

AttachVolume attaches volume target ip

func (*RestClient) CreateConvergedQoS

func (cli *RestClient) CreateConvergedQoS(ctx context.Context, req *types.CreateConvergedQoSReq) (int, error)

CreateConvergedQoS used to create converged QoS

func (*RestClient) CreateDTree added in v4.7.0

func (cli *RestClient) CreateDTree(ctx context.Context, parentName, name, unixPermission string) (*DTreeResponse,
	error)

CreateDTree creates a dtree resource

func (*RestClient) CreateDTreeNfsShare added in v4.7.0

CreateDTreeNfsShare creates a nfs share of dtree

func (*RestClient) CreateDTreeQuota added in v4.7.0

func (cli *RestClient) CreateDTreeQuota(ctx context.Context, dtreeId string, capacity int64) (*DTreeQuotaResponse,
	error)

CreateDTreeQuota creates quota of dtree

func (*RestClient) CreateFileSystem

func (cli *RestClient) CreateFileSystem(ctx context.Context, params map[string]any) (map[string]any, error)

CreateFileSystem used to create file system by params

func (*RestClient) CreateHost

func (cli *RestClient) CreateHost(ctx context.Context, hostName string, alua map[string]interface{}) error

CreateHost used to create host

func (*RestClient) CreateInitiator

func (cli *RestClient) CreateInitiator(ctx context.Context, name string) error

CreateInitiator used to create initiator by name

func (*RestClient) CreateNfsShare

func (cli *RestClient) CreateNfsShare(ctx context.Context, params map[string]any) (map[string]any, error)

CreateNfsShare used to create nfs share by params

func (*RestClient) CreateQoS

func (cli *RestClient) CreateQoS(ctx context.Context, qosName string, qosData map[string]int) error

CreateQoS used to create QoS

func (*RestClient) CreateQuota

func (cli *RestClient) CreateQuota(ctx context.Context, params map[string]interface{}) error

CreateQuota creates quota by params

func (*RestClient) CreateSnapshot

func (cli *RestClient) CreateSnapshot(ctx context.Context, snapshotName, volName string) error

CreateSnapshot creates volume snapshot

func (*RestClient) CreateVolume

func (cli *RestClient) CreateVolume(ctx context.Context, params map[string]interface{}) error

CreateVolume creates volume by params

func (*RestClient) CreateVolumeFromSnapshot

func (cli *RestClient) CreateVolumeFromSnapshot(ctx context.Context,
	volName string,
	volSize int64,
	snapshotName string) error

CreateVolumeFromSnapshot creates volume from snapshot

func (*RestClient) DeleteConvergedQoS

func (cli *RestClient) DeleteConvergedQoS(ctx context.Context, qosName string) error

DeleteConvergedQoS used to delete converged QoS by name

func (*RestClient) DeleteDTree added in v4.7.0

func (cli *RestClient) DeleteDTree(ctx context.Context, dtreeId string) error

DeleteDTree deletes dtree resource by its id

func (*RestClient) DeleteDTreeNfsShare added in v4.7.0

func (cli *RestClient) DeleteDTreeNfsShare(ctx context.Context, shareId string) error

DeleteDTreeNfsShare deletes dtree nfs share by its id

func (*RestClient) DeleteDTreeQuota added in v4.7.0

func (cli *RestClient) DeleteDTreeQuota(ctx context.Context, quotaId string) error

DeleteDTreeQuota deletes quota of dtree

func (*RestClient) DeleteFileSystem

func (cli *RestClient) DeleteFileSystem(ctx context.Context, id string) error

DeleteFileSystem used to delete file system by id

func (*RestClient) DeleteLunFromHost

func (cli *RestClient) DeleteLunFromHost(ctx context.Context, lunName, hostName string) error

DeleteLunFromHost used to delete lun from host

func (*RestClient) DeleteNfsShare

func (cli *RestClient) DeleteNfsShare(ctx context.Context, id, accountId string) error

DeleteNfsShare used to delete nfs share by id

func (*RestClient) DeleteNfsShareAccess

func (cli *RestClient) DeleteNfsShareAccess(ctx context.Context, accessID string) error

DeleteNfsShareAccess used to delete nfs share access by id

func (*RestClient) DeleteQoS

func (cli *RestClient) DeleteQoS(ctx context.Context, qosName string) error

DeleteQoS used to delete QoS by name

func (*RestClient) DeleteQuota

func (cli *RestClient) DeleteQuota(ctx context.Context, quotaID string) error

DeleteQuota deletes quota by id

func (*RestClient) DeleteSnapshot

func (cli *RestClient) DeleteSnapshot(ctx context.Context, snapshotName string) error

DeleteSnapshot deletes volume snapshot

func (*RestClient) DeleteVolume

func (cli *RestClient) DeleteVolume(ctx context.Context, name string) error

DeleteVolume deletes volume by name

func (*RestClient) DetachVolume

func (cli *RestClient) DetachVolume(ctx context.Context, name, ip string) error

DetachVolume detaches volume from target ip

func (*RestClient) DisassociateConvergedQoSWithVolume

func (cli *RestClient) DisassociateConvergedQoSWithVolume(ctx context.Context, objectName string) error

DisassociateConvergedQoSWithVolume used to delete a converged QoS policy association

func (*RestClient) DisassociateQoSWithVolume

func (cli *RestClient) DisassociateQoSWithVolume(ctx context.Context, volName, qosName string) error

DisassociateQoSWithVolume used to disassociate QoS with volume

func (*RestClient) ExtendVolume

func (cli *RestClient) ExtendVolume(ctx context.Context, lunName string, newCapacity int64) error

ExtendVolume extends volume capacity

func (*RestClient) GetAccountIdByName

func (cli *RestClient) GetAccountIdByName(ctx context.Context, accountName string) (string, error)

GetAccountIdByName gets account id by account name

func (*RestClient) GetAllAccounts

func (cli *RestClient) GetAllAccounts(ctx context.Context) ([]string, error)

GetAllAccounts gets all accounts

func (*RestClient) GetAllPools

func (cli *RestClient) GetAllPools(ctx context.Context) (map[string]interface{}, error)

GetAllPools gets all pools

func (*RestClient) GetAssociateCountOfQoS

func (cli *RestClient) GetAssociateCountOfQoS(ctx context.Context, qosName string) (int, error)

GetAssociateCountOfQoS used to get associate count of QoS

func (*RestClient) GetConvergedQoSNameByID

func (cli *RestClient) GetConvergedQoSNameByID(ctx context.Context, qosId int) (string, error)

GetConvergedQoSNameByID used to get qos name by id

func (*RestClient) GetDTreeByName added in v4.7.0

func (cli *RestClient) GetDTreeByName(ctx context.Context, parentName, name string) (*DTreeResponse, error)

GetDTreeByName gets dtree by its name

func (*RestClient) GetDTreeNfsShareByPath added in v4.7.0

func (cli *RestClient) GetDTreeNfsShareByPath(ctx context.Context, sharePath string) (*GetDTreeNfsShareResponse,
	error)

GetDTreeNfsShareByPath gets the nfs share of dtree by share path

func (*RestClient) GetFileSystemByName

func (cli *RestClient) GetFileSystemByName(ctx context.Context, name string) (map[string]interface{}, error)

GetFileSystemByName used to get file system by name

func (*RestClient) GetHostByName

func (cli *RestClient) GetHostByName(ctx context.Context, hostName string) (map[string]interface{}, error)

GetHostByName used to get host by name

func (*RestClient) GetHostLunId

func (cli *RestClient) GetHostLunId(ctx context.Context, hostName, lunName string) (string, error)

GetHostLunId gets host lun id of hostName

func (*RestClient) GetInitiatorByName

func (cli *RestClient) GetInitiatorByName(ctx context.Context, name string) (map[string]interface{}, error)

GetInitiatorByName used to get initiator by name

func (*RestClient) GetNFSServiceSetting

func (cli *RestClient) GetNFSServiceSetting(ctx context.Context) (map[string]bool, error)

GetNFSServiceSetting gets nfs service settings

func (*RestClient) GetNfsShareAccess

func (cli *RestClient) GetNfsShareAccess(ctx context.Context, shareID string) (map[string]interface{}, error)

GetNfsShareAccess used to get nfs share access by id

func (*RestClient) GetNfsShareByPath

func (cli *RestClient) GetNfsShareByPath(ctx context.Context, path, accountId string) (map[string]interface{}, error)

GetNfsShareByPath used to get nfs share by path

func (*RestClient) GetPoolById

func (cli *RestClient) GetPoolById(ctx context.Context, poolId int64) (map[string]interface{}, error)

GetPoolById gets pool by pool id

func (*RestClient) GetPoolByName

func (cli *RestClient) GetPoolByName(ctx context.Context, poolName string) (map[string]interface{}, error)

GetPoolByName gets pool by pool name

func (*RestClient) GetQoSNameByVolume

func (cli *RestClient) GetQoSNameByVolume(ctx context.Context, volName string) (string, error)

GetQoSNameByVolume used to get QoS name by volume name

func (*RestClient) GetQoSPolicyAssociationCount

func (cli *RestClient) GetQoSPolicyAssociationCount(ctx context.Context, qosPolicyId int) (int, error)

GetQoSPolicyAssociationCount used to get count of qos association

func (*RestClient) GetQoSPolicyIdByFsName

func (cli *RestClient) GetQoSPolicyIdByFsName(ctx context.Context, namespaceName string) (int, error)

GetQoSPolicyIdByFsName used to get qos id by fs name

func (*RestClient) GetQuotaByDTreeId added in v4.7.0

func (cli *RestClient) GetQuotaByDTreeId(ctx context.Context, dTreeId string) (*DTreeQuotaResponse, error)

GetQuotaByDTreeId gets quota by dtree id

func (*RestClient) GetQuotaByFileSystemById

func (cli *RestClient) GetQuotaByFileSystemById(ctx context.Context, fsID string) (map[string]interface{}, error)

GetQuotaByFileSystemById query quota info by file system id

func (*RestClient) GetQuotaByFileSystemName

func (cli *RestClient) GetQuotaByFileSystemName(ctx context.Context, fsName string) (*QueryQuotaResponse, error)

GetQuotaByFileSystemName query quota info by file system name

func (*RestClient) GetSnapshotByName

func (cli *RestClient) GetSnapshotByName(ctx context.Context, snapshotName string) (map[string]interface{}, error)

GetSnapshotByName get snapshot by name

func (*RestClient) GetVolumeByName

func (cli *RestClient) GetVolumeByName(ctx context.Context, name string) (map[string]interface{}, error)

GetVolumeByName gets volume info by name

func (cli *RestClient) IsSupportDynamicLinks(ctx context.Context, hostname string) (bool, error)

IsSupportDynamicLinks return whether the storage support querying the iscsi links dynamically

func (*RestClient) KeepAlive

func (cli *RestClient) KeepAlive(ctx context.Context)

KeepAlive used to keep connection token alive

func (*RestClient) Login

func (cli *RestClient) Login(ctx context.Context) error

Login try to login fusion storage by backend id

func (*RestClient) Logout

func (cli *RestClient) Logout(ctx context.Context)

Logout used to log out

func (*RestClient) Post

func (cli *RestClient) Post(ctx context.Context, url string, data map[string]any) (map[string]any, error)

Post used to send post request to storage client

func (cli *RestClient) QueryDynamicLinks(ctx context.Context,
	poolName, hostname string, amount int) ([]*IscsiLink, error)

QueryDynamicLinks return whether the storage support querying the iscsi links dynamically

func (*RestClient) QueryHostByPort

func (cli *RestClient) QueryHostByPort(ctx context.Context, port string) (string, error)

QueryHostByPort used query host by port

func (*RestClient) QueryHostOfVolume

func (cli *RestClient) QueryHostOfVolume(ctx context.Context, lunName string) ([]map[string]interface{}, error)

QueryHostOfVolume used to query host of volume

func (*RestClient) QueryIscsiPortal

func (cli *RestClient) QueryIscsiPortal(ctx context.Context) ([]map[string]interface{}, error)

QueryIscsiPortal used to query iscsi portal

func (*RestClient) QueryQuotaByFsId added in v4.7.0

func (cli *RestClient) QueryQuotaByFsId(ctx context.Context, fsID string) (*QueryQuotaResponse, error)

QueryQuotaByFsId query quotas by filesystem id

func (*RestClient) ReLogin added in v4.8.0

func (cli *RestClient) ReLogin(ctx context.Context) error

ReLogin logout and login again

func (*RestClient) SetAccountId

func (cli *RestClient) SetAccountId(ctx context.Context) error

SetAccountId used to set account id of the client

func (*RestClient) UpdateDTreeQuota added in v4.7.0

func (cli *RestClient) UpdateDTreeQuota(ctx context.Context, quotaId string, capacity int64) error

UpdateDTreeQuota update quota of dtree

func (*RestClient) UpdateHost

func (cli *RestClient) UpdateHost(ctx context.Context, hostName string, alua map[string]interface{}) error

UpdateHost used to update host

func (*RestClient) UpdateQuota

func (cli *RestClient) UpdateQuota(ctx context.Context, params map[string]interface{}) error

UpdateQuota updates quota by params

func (*RestClient) ValidateLogin

func (cli *RestClient) ValidateLogin(ctx context.Context) error

ValidateLogin try to login fusion storage by secret

type Retryable added in v4.9.0

type Retryable interface {
	NeedRetry() bool
}

Retryable defines the retryable interface

type SanBaseResponse added in v4.9.0

type SanBaseResponse struct {
	Result      int64  `json:"result"`
	Suggestion  string `json:"suggestion"`
	ErrorCode   any    `json:"errorCode"`
	Description string `json:"description"`
}

SanBaseResponse defines the base response fields of san restful call

func (*SanBaseResponse) Error added in v4.9.0

func (resp *SanBaseResponse) Error() string

Error return the formated error msg of restful call response

func (*SanBaseResponse) IsErrorCodeSet added in v4.9.0

func (resp *SanBaseResponse) IsErrorCodeSet() bool

IsErrorCodeSet return whether the ErrorCode has been set

func (*SanBaseResponse) NeedRetry added in v4.9.0

func (resp *SanBaseResponse) NeedRetry() bool

NeedRetry determines whether the request needs to be retried

type Snapshot added in v4.7.0

type Snapshot interface {
	CreateSnapshot(ctx context.Context, snapshotName, volName string) error
	DeleteSnapshot(ctx context.Context, snapshotName string) error
	GetSnapshotByName(ctx context.Context, snapshotName string) (map[string]interface{}, error)
	CreateVolumeFromSnapshot(ctx context.Context, volName string, volSize int64, snapshotName string) error
}

Snapshot is the interface for snapshot

type System added in v4.7.0

type System interface {
	GetAccountIdByName(ctx context.Context, accountName string) (string, error)
	GetPoolByName(ctx context.Context, poolName string) (map[string]interface{}, error)
	GetPoolById(ctx context.Context, poolId int64) (map[string]interface{}, error)
	GetAllAccounts(ctx context.Context) ([]string, error)
	GetAllPools(ctx context.Context) (map[string]interface{}, error)
	GetNFSServiceSetting(ctx context.Context) (map[string]bool, error)
}

System is the interface for system

type Volume added in v4.7.0

type Volume interface {
	CreateVolume(ctx context.Context, params map[string]interface{}) error
	GetVolumeByName(ctx context.Context, name string) (map[string]interface{}, error)
	DeleteVolume(ctx context.Context, name string) error
	AttachVolume(ctx context.Context, name, ip string) error
	DetachVolume(ctx context.Context, name, ip string) error
	ExtendVolume(ctx context.Context, lunName string, newCapacity int64) error
	GetHostLunId(ctx context.Context, hostName, lunName string) (string, error)
}

Volume is the interface for volume

Jump to

Keyboard shortcuts

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