file

package
v1.5.6-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFilter added in v0.6.1

func ApplyFilter(ops []*filev1beta1.Operation, uri string, opType string, done bool) ([]*filev1beta1.Operation, error)

func CodeForError added in v1.4.7

func CodeForError(err error) *codes.Code

CodeForError returns a pointer to the grpc error code that maps to the http error code for the passed in user googleapi error or context error. Returns codes.Internal if the given error is not a googleapi error caused by the user. The following http error codes are considered user errors: (1) http 400 Bad Request, returns grpc InvalidArgument, (2) http 403 Forbidden, returns grpc PermissionDenied, (3) http 404 Not Found, returns grpc NotFound (4) http 429 Too Many Requests, returns grpc ResourceExhausted The following errors are considered context errors: (1) "context deadline exceeded", returns grpc DeadlineExceeded, (2) "context canceled", returns grpc Canceled

func CompareInstances

func CompareInstances(a, b *ServiceInstance) error

func CompareMultishareInstances added in v1.2.0

func CompareMultishareInstances(a, b *MultishareInstance) error

func CompareShares added in v1.2.0

func CompareShares(a, b *Share) error

func CreateBackupURI added in v1.3.19

func CreateBackupURI(obj *ServiceInstance, backupName string, backupLocation string) (string, string, error)

This function returns the backup URI, the region that was picked to be the backup resource location and error.

func GenerateMultishareInstanceURI added in v1.2.0

func GenerateMultishareInstanceURI(m *MultishareInstance) (string, error)

func GenerateShareURI added in v1.2.0

func GenerateShareURI(s *Share) (string, error)

func GetInstanceNameFromURI added in v1.5.0

func GetInstanceNameFromURI(uri string) (project, location, name string, err error)

func GetMultishareInstanceHandle added in v1.2.0

func GetMultishareInstanceHandle(m *MultishareInstance) (string, error)

func IsInstanceTarget added in v1.2.0

func IsInstanceTarget(target string) bool

func IsNotFoundErr added in v0.2.0

func IsNotFoundErr(err error) bool

func IsShareTarget added in v1.2.0

func IsShareTarget(target string) bool

func ParseShare added in v1.2.0

func ParseShare(s *Share) (string, string, string, string, error)

Types

type BackupInfo added in v0.3.1

type BackupInfo struct {
	Backup         *filev1beta1.Backup
	SourceInstance string
	SourceShare    string
}

type ListFilter added in v1.2.0

type ListFilter struct {
	Project      string
	Location     string
	InstanceName string
}

type MultishareInstance added in v1.2.0

type MultishareInstance struct {
	Project            string
	Name               string
	Location           string
	Tier               string
	Network            Network
	CapacityBytes      int64
	MaxCapacityBytes   int64
	CapacityStepSizeGb int64
	Labels             map[string]string
	State              string
	KmsKeyName         string
	Description        string
	MaxShareCount      int
}

func (*MultishareInstance) String added in v1.2.0

func (i *MultishareInstance) String() string

type Network

type Network struct {
	Name            string
	ConnectMode     string
	ReservedIpRange string
	Ip              string
}

type PollOpts added in v1.2.0

type PollOpts struct {
	Interval time.Duration
	Timeout  time.Duration
}

type Service

type Service interface {
	CreateInstance(ctx context.Context, obj *ServiceInstance) (*ServiceInstance, error)
	DeleteInstance(ctx context.Context, obj *ServiceInstance) error
	GetInstance(ctx context.Context, obj *ServiceInstance) (*ServiceInstance, error)
	ListInstances(ctx context.Context, obj *ServiceInstance) ([]*ServiceInstance, error)
	ResizeInstance(ctx context.Context, obj *ServiceInstance) (*ServiceInstance, error)
	GetBackup(ctx context.Context, backupUri string) (*BackupInfo, error)
	CreateBackup(ctx context.Context, obj *ServiceInstance, backupId, backupLocation string) (*filev1beta1.Backup, error)
	DeleteBackup(ctx context.Context, backupId string) error
	CreateInstanceFromBackupSource(ctx context.Context, obj *ServiceInstance, volumeSourceSnapshotId string) (*ServiceInstance, error)
	HasOperations(ctx context.Context, obj *ServiceInstance, operationType string, done bool) (bool, error)
	// Multishare ops
	GetMultishareInstance(ctx context.Context, obj *MultishareInstance) (*MultishareInstance, error)
	ListMultishareInstances(ctx context.Context, filter *ListFilter) ([]*MultishareInstance, error)
	StartCreateMultishareInstanceOp(ctx context.Context, obj *MultishareInstance) (*filev1beta1multishare.Operation, error)
	StartDeleteMultishareInstanceOp(ctx context.Context, obj *MultishareInstance) (*filev1beta1multishare.Operation, error)
	StartResizeMultishareInstanceOp(ctx context.Context, obj *MultishareInstance) (*filev1beta1multishare.Operation, error)
	ListShares(ctx context.Context, filter *ListFilter) ([]*Share, error)
	GetShare(ctx context.Context, obj *Share) (*Share, error)
	StartCreateShareOp(ctx context.Context, obj *Share) (*filev1beta1multishare.Operation, error)
	StartDeleteShareOp(ctx context.Context, obj *Share) (*filev1beta1multishare.Operation, error)
	StartResizeShareOp(ctx context.Context, obj *Share) (*filev1beta1multishare.Operation, error)
	WaitForOpWithOpts(ctx context.Context, op string, opts PollOpts) error
	GetOp(ctx context.Context, op string) (*filev1beta1multishare.Operation, error)
	IsOpDone(op *filev1beta1multishare.Operation) (bool, error)
	ListOps(ctx context.Context, resource *ListFilter) ([]*filev1beta1multishare.Operation, error)
}

func NewFakeBlockingService added in v0.5.0

func NewFakeBlockingService(operationUnblocker chan chan struct{}) (Service, error)

func NewFakeBlockingServiceForMultishare added in v1.2.0

func NewFakeBlockingServiceForMultishare(unblocker chan chan Signal) (Service, error)

func NewFakeService

func NewFakeService() (Service, error)

func NewFakeServiceForMultishare added in v1.2.0

func NewFakeServiceForMultishare(instances []*MultishareInstance, shares []*Share, ops []*filev1beta1multishare.Operation) (Service, error)

func NewGCFSService

func NewGCFSService(version string, client *http.Client, primaryFilestoreServiceEndpoint, testFilestoreServiceEndpoint string) (Service, error)

type ServiceInstance added in v0.2.0

type ServiceInstance struct {
	Project    string
	Name       string
	Location   string
	Tier       string
	Network    Network
	Volume     Volume
	Labels     map[string]string
	State      string
	KmsKeyName string
}

type Share added in v1.2.0

type Share struct {
	Name           string              // only the share name
	Parent         *MultishareInstance // parent captures the project, location details.
	State          string
	MountPointName string
	Labels         map[string]string
	CapacityBytes  int64
}

type Signal added in v1.2.0

type Signal struct {
	ReportError             bool
	ReportNotFoundError     bool
	ReportRunning           bool
	ReportOpWithErrorStatus bool
}

type Volume

type Volume struct {
	Name      string
	SizeBytes int64
}

Jump to

Keyboard shortcuts

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