v2

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateFromNew      = CreateVolumeFrom("NEW")
	CreateFromSnapshot = CreateVolumeFrom("SNAPSHOT")

	AesXtsPlain64_128 = EncryptType("aes-xts-plain64_128")
	AesXtsPlain64_256 = EncryptType("aes-xts-plain64_256")

	InitMigrateAction    = MigrateAction("INIT-MIGRATE")
	ProcessMigrateAction = MigrateAction("MIGRATE")
	ConfirmMigrateAction = MigrateAction("CONFIRM-MIGRATE")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachBlockVolumeRequest

type AttachBlockVolumeRequest struct {
	BlockVolumeID string
	ServerID      string
}

type BlockVolume

type BlockVolume struct {
	UUID               string   `json:"uuid"`
	ProjectID          string   `json:"projectId"`
	Name               string   `json:"name"`
	Size               uint64   `json:"size"`
	Status             string   `json:"status"`
	VolumeTypeID       string   `json:"volumeTypeId"`
	VolumeTypeZoneName string   `json:"volumeTypeZoneName"`
	IOPS               string   `json:"iops"`
	ServerID           string   `json:"serverId,omitempty"`
	CreatedAt          string   `json:"createdAt"`
	UpdatedAt          *string  `json:"updatedAt"`
	Bootable           bool     `json:"bootable"`
	EncryptionType     *string  `json:"encryptionType"`
	BootIndex          int      `json:"bootIndex"`
	MultiAttach        bool     `json:"multiAttach"`
	ServerIDList       []string `json:"serverIdList"`
	Location           *string  `json:"location"`
	Product            string   `json:"product"`
	PersistentVolume   bool     `json:"persistentVolume"`
	MigrateState       string   `json:"migrateState,omitempty"`
	Zone               Zone     `json:"zone"`
}

type Config

type Config struct {
	IsPermanently bool  `json:"isPermanently"`
	RetainedDays  int64 `json:"retainedDays"`
}

type ConfigureVolumeRestore

type ConfigureVolumeRestore struct {
	SnapshotVolumePointID string `json:"snapshotVolumePointId"`
	VolumeTypeID          string `json:"volumeTypeId"`
}

type CreateBlockVolumeRequest

type CreateBlockVolumeRequest struct {
	BackupVolumePointID    string                  `json:"backupVolumePointId,omitempty"`
	CreatedFrom            CreateVolumeFrom        `json:"createdFrom,omitempty"`
	EncryptionType         EncryptType             `json:"encryptionType,omitempty"`
	MultiAttach            bool                    `json:"multiAttach,omitempty"`
	Name                   string                  `json:"name"`
	Size                   int64                   `json:"size"`
	VolumeTypeID           string                  `json:"volumeTypeId"`
	Tags                   []VolumeTag             `json:"tags,omitempty"`
	IsPoc                  bool                    `json:"isPoc,omitempty"`
	IsEnableAutoRenew      bool                    `json:"isEnableAutoRenew,omitempty"`
	ConfigureVolumeRestore *ConfigureVolumeRestore `json:"configVolumeRestore,omitempty"`
	Zone                   string                  `json:"zoneId,omitempty"`
	PoolName               string                  `json:"poolName,omitempty"`
}

func NewCreateBlockVolumeRequest

func NewCreateBlockVolumeRequest(volumeName, volumeType string, size int64) *CreateBlockVolumeRequest

type CreateBlockVolumeResponse

type CreateBlockVolumeResponse struct {
	Data BlockVolume `json:"data"`
}

func (*CreateBlockVolumeResponse) ToEntityVolume

func (r *CreateBlockVolumeResponse) ToEntityVolume() *Volume

type CreateSnapshotByBlockVolumeIDRequest

type CreateSnapshotByBlockVolumeIDRequest struct {
	Name          string `json:"name"`
	Description   string `json:"description"`
	Permanently   bool   `json:"isPermanently"`
	RetainedDay   uint64 `json:"retainedDay"`
	BlockVolumeID string
}

func NewCreateSnapshotByBlockVolumeIDRequest

func NewCreateSnapshotByBlockVolumeIDRequest(name, blockVolumeID string) *CreateSnapshotByBlockVolumeIDRequest

type CreateSnapshotByBlockVolumeIDResponse

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

func (*CreateSnapshotByBlockVolumeIDResponse) ToEntitySnapshot

func (r *CreateSnapshotByBlockVolumeIDResponse) ToEntitySnapshot() *Snapshot

type CreateVolumeFrom

type CreateVolumeFrom string

type DeleteBlockVolumeByIDRequest

type DeleteBlockVolumeByIDRequest struct {
	BlockVolumeID string
}

func NewDeleteBlockVolumeByIDRequest

func NewDeleteBlockVolumeByIDRequest(volumeID string) *DeleteBlockVolumeByIDRequest

type DeleteSnapshotByIDRequest

type DeleteSnapshotByIDRequest struct {
	BlockVolumeID string
	SnapshotID    string
}

func NewDeleteSnapshotByIDRequest

func NewDeleteSnapshotByIDRequest(snapshotID string) *DeleteSnapshotByIDRequest

type EncryptType

type EncryptType string

type GetBlockVolumeByIDRequest

type GetBlockVolumeByIDRequest struct {
	BlockVolumeID string
}

func NewGetBlockVolumeByIDRequest

func NewGetBlockVolumeByIDRequest(volumeID string) *GetBlockVolumeByIDRequest

type GetBlockVolumeByIDResponse

type GetBlockVolumeByIDResponse struct {
	Data BlockVolume `json:"data"`
}

func (*GetBlockVolumeByIDResponse) ToEntityVolume

func (r *GetBlockVolumeByIDResponse) ToEntityVolume() *Volume

type GetUnderBlockVolumeIDRequest

type GetUnderBlockVolumeIDRequest struct {
	BlockVolumeID string
}

func NewGetUnderVolumeIDRequest

func NewGetUnderVolumeIDRequest(volumeID string) *GetUnderBlockVolumeIDRequest

type GetUnderBlockVolumeIDResponse

type GetUnderBlockVolumeIDResponse struct {
	Uuid string `json:"uuid"`
}

func (*GetUnderBlockVolumeIDResponse) ToEntityVolume

func (r *GetUnderBlockVolumeIDResponse) ToEntityVolume() *Volume

type ListBlockVolumesRequest

type ListBlockVolumesRequest struct {
	Name string
	Page int
	Size int
}

func NewListBlockVolumesRequest

func NewListBlockVolumesRequest(page, size int) *ListBlockVolumesRequest

func (*ListBlockVolumesRequest) ToQuery

func (r *ListBlockVolumesRequest) ToQuery() (string, error)

type ListBlockVolumesResponse

type ListBlockVolumesResponse struct {
	Page      int64         `json:"page"`
	PageSize  int64         `json:"pageSize"`
	TotalPage int64         `json:"totalPage"`
	TotalItem int64         `json:"totalItem"`
	ListData  []BlockVolume `json:"listData"`
}

func (*ListBlockVolumesResponse) ToEntityListVolumes

func (r *ListBlockVolumesResponse) ToEntityListVolumes() *ListVolumes

type ListSnapshots

type ListSnapshots struct {
	Items      []*Snapshot
	TotalPages int
	Page       int
	PageSize   int
	TotalItems int
}

type ListSnapshotsByBlockVolumeIDRequest

type ListSnapshotsByBlockVolumeIDRequest struct {
	Page          int
	Size          int
	BlockVolumeID string
}

func NewListSnapshotsByBlockVolumeIDRequest

func NewListSnapshotsByBlockVolumeIDRequest(page, size int, blockVolumeID string) *ListSnapshotsByBlockVolumeIDRequest

func (*ListSnapshotsByBlockVolumeIDRequest) ToQuery

type ListSnapshotsByBlockVolumeIDResponse

type ListSnapshotsByBlockVolumeIDResponse struct {
	Items      []snapshotResp `json:"items"`
	Page       int            `json:"page"`
	PageSize   int            `json:"pageSize"`
	TotalPages int            `json:"totalPages"`
	TotalItems int            `json:"totalItems"`
}

func (*ListSnapshotsByBlockVolumeIDResponse) ToEntityListSnapshots

func (r *ListSnapshotsByBlockVolumeIDResponse) ToEntityListSnapshots() *ListSnapshots

type ListVolumes

type ListVolumes struct {
	Items      []*Volume
	TotalPage  int
	Page       int
	PageSize   int
	TotalItems int
}

func (ListVolumes) Len

func (l ListVolumes) Len() int

type MigrateAction

type MigrateAction string

type MigrateBlockVolumeByIDRequest

type MigrateBlockVolumeByIDRequest struct {
	Action         MigrateAction `json:"action"`
	ConfirmMigrate bool
	Tags           []common.Tag `json:"tags"`
	VolumeTypeID   string       `json:"volumeTypeId"`
	Auto           bool
	BlockVolumeID  string
}

func NewMigrateBlockVolumeByIDRequest

func NewMigrateBlockVolumeByIDRequest(volumeID, volumeType string) *MigrateBlockVolumeByIDRequest

type ResizeBlockVolumeByIDRequest

type ResizeBlockVolumeByIDRequest struct {
	NewSize       int    `json:"newSize"`         // NewSize is the new size of the volume, in GB
	VolumeTypeID  string `json:"newVolumeTypeId"` // VolumeTypeID is the type of the volume
	BlockVolumeID string
}

func NewResizeBlockVolumeByIDRequest

func NewResizeBlockVolumeByIDRequest(volumeID, volumeType string, size int) *ResizeBlockVolumeByIDRequest

type ResizeBlockVolumeByIDResponse

type ResizeBlockVolumeByIDResponse struct {
	Data BlockVolume `json:"data"`
}

func (*ResizeBlockVolumeByIDResponse) ToEntityVolume

func (r *ResizeBlockVolumeByIDResponse) ToEntityVolume() *Volume

type Snapshot

type Snapshot struct {
	ID         string `json:"id"`
	CreatedAt  string `json:"createdAt"`
	VolumeID   string `json:"volumeId"`
	Size       int64  `json:"size"`
	VolumeSize int64  `json:"volumeSize"`
	Status     string `json:"status"`
	Name       string `json:"name"`
}

type Volume

type Volume struct {
	Name             string   `json:"name"`
	ID               string   `json:"uuid"`
	VolumeTypeID     string   `json:"volumeTypeId"`
	ClusterID        *string  `json:"clusterId"`
	VmID             string   `json:"serverId"`
	Size             uint64   `json:"size"`
	IopsID           uint64   `json:"iopsId"`
	Status           string   `json:"status"`
	CreatedAt        string   `json:"createdAt"`
	UpdatedAt        *string  `json:"updatedAt"`
	PersistentVolume bool     `json:"persistentVolume"`
	AttachedMachine  []string `json:"serverIdList"`
	UnderID          string   `json:"underId"`
	MigrateState     string   `json:"migrateState"`
	MultiAttach      bool     `json:"multiAttach"`
	ZoneID           string   `json:"zoneId"`
}

func (Volume) AttachedTheInstance

func (v Volume) AttachedTheInstance(instanceID string) bool

func (Volume) CanDelete

func (v Volume) CanDelete() bool

func (Volume) IsAvailable

func (v Volume) IsAvailable() bool

func (Volume) IsError

func (v Volume) IsError() bool

func (Volume) IsInUse

func (v Volume) IsInUse() bool

type VolumeServiceV2

type VolumeServiceV2 struct {
	Client *client.ServiceClient
}

func (*VolumeServiceV2) CreateBlockVolume

func (s *VolumeServiceV2) CreateBlockVolume(ctx context.Context, opts *CreateBlockVolumeRequest) (*Volume, error)

func (*VolumeServiceV2) CreateSnapshotByBlockVolumeID

func (s *VolumeServiceV2) CreateSnapshotByBlockVolumeID(ctx context.Context, opts *CreateSnapshotByBlockVolumeIDRequest) (*Snapshot, error)

func (*VolumeServiceV2) DeleteBlockVolumeByID

func (s *VolumeServiceV2) DeleteBlockVolumeByID(ctx context.Context, opts *DeleteBlockVolumeByIDRequest) error

func (*VolumeServiceV2) DeleteSnapshotByID

func (s *VolumeServiceV2) DeleteSnapshotByID(ctx context.Context, opts *DeleteSnapshotByIDRequest) error

func (*VolumeServiceV2) GetBlockVolumeByID

func (s *VolumeServiceV2) GetBlockVolumeByID(ctx context.Context, opts *GetBlockVolumeByIDRequest) (*Volume, error)

func (*VolumeServiceV2) GetUnderBlockVolumeID

func (s *VolumeServiceV2) GetUnderBlockVolumeID(ctx context.Context, opts *GetUnderBlockVolumeIDRequest) (*Volume, error)

func (*VolumeServiceV2) ListBlockVolumes

func (s *VolumeServiceV2) ListBlockVolumes(ctx context.Context, opts *ListBlockVolumesRequest) (*ListVolumes, error)

func (*VolumeServiceV2) ListSnapshotsByBlockVolumeID

func (s *VolumeServiceV2) ListSnapshotsByBlockVolumeID(ctx context.Context, opts *ListSnapshotsByBlockVolumeIDRequest) (*ListSnapshots, error)

func (*VolumeServiceV2) MigrateBlockVolumeByID

func (s *VolumeServiceV2) MigrateBlockVolumeByID(ctx context.Context, opts *MigrateBlockVolumeByIDRequest) error

func (*VolumeServiceV2) ResizeBlockVolumeByID

func (s *VolumeServiceV2) ResizeBlockVolumeByID(ctx context.Context, opts *ResizeBlockVolumeByIDRequest) (*Volume, error)

type VolumeSnapshot

type VolumeSnapshot struct {
	BackendPool      string  `json:"backendPool"`
	BackendPrefix    string  `json:"backendPrefix"`
	BackendStatus    string  `json:"backendStatus"`
	BackendUuid      string  `json:"backendUuid"`
	BootIndex        int     `json:"bootIndex"`
	Bootable         bool    `json:"bootable"`
	CreatedAt        string  `json:"createdAt"`
	ID               string  `json:"id"`
	MultiAttach      bool    `json:"multiAttach"`
	Name             string  `json:"name"`
	Product          string  `json:"product"`
	ProjectID        string  `json:"projectId"`
	Size             int64   `json:"size"`
	Status           string  `json:"status"`
	Type             string  `json:"type"`
	UpdatedAt        string  `json:"updatedAt"`
	Uuid             string  `json:"uuid"`
	VolumeID         int64   `json:"volumeId"`
	VolumeTypeID     string  `json:"volumeTypeId"`
	VolumeTypeZoneID string  `json:"volumeTypeZoneId"`
	EncryptionType   *string `json:"encryptionType"`
}

type VolumeTag

type VolumeTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

func NewVolumeTags

func NewVolumeTags(kvPairs ...string) []VolumeTag

NewVolumeTags creates a []VolumeTag from variadic key-value string pairs. If an odd number of strings is provided, the last value defaults to "none".

type Zone

type Zone struct {
	Uuid string `json:"uuid"`
}

Jump to

Keyboard shortcuts

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