driver

package
v0.0.0-...-2193abd Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDriverName = "block.csi.upcloud.com"
)

Variables

View Source
var UpCloudApiEndpoint = "https://api.upcloud.com"
View Source
var UpCloudApiVersion = "1.3"

Functions

func GRPCLogger

func GRPCLogger(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

GRPCLogger provides better error handling for gRPC calls

func NewMounter

func NewMounter(log *logrus.Entry) *mounter

Types

type Mounter

type Mounter interface {
	Format(source, fs string) error
	IsFormatted(source string) (bool, error)
	Mount(source, target, fs string, opts ...string) error
	IsMounted(target string) (bool, error)
	UnMount(target string) error
}

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start services at the endpoint
	Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer)
	// Waits for the service to stop
	Wait()
	// Stops the service gracefully
	Stop()
	// Stops the service forcefully
	ForceStop()
}

Defines Non blocking GRPC server interfaces

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

type UpCloudClient

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

func NewUpCloudClient

func NewUpCloudClient(token string) *UpCloudClient

func (*UpCloudClient) CreateStorage

func (client *UpCloudClient) CreateStorage(size int, tier, title, zone string) (*UpCloudCreateStorageResp, error)

func (*UpCloudClient) DeleteStorage

func (client *UpCloudClient) DeleteStorage(UUID string) error

func (*UpCloudClient) ListServers

func (client *UpCloudClient) ListServers() (*UpCloudListServerResp, error)

func (*UpCloudClient) ListStorages

func (client *UpCloudClient) ListStorages() (*UpCloudListStoragesResp, error)

func (*UpCloudClient) ListStoragesWithDetails

func (client *UpCloudClient) ListStoragesWithDetails() (*UpCloudListStoragesResp, error)

func (*UpCloudClient) ServerDetail

func (client *UpCloudClient) ServerDetail(UUID string) (*UpCloudServerDetailResp, error)

func (*UpCloudClient) StorageDetail

func (client *UpCloudClient) StorageDetail(UUID string) (*UpCloudListStorageDetailsResp, error)

func (*UpCloudClient) StorageOP

func (client *UpCloudClient) StorageOP(serverID, volID, OP string) (*UpCloudStorageOPResp, error)

type UpCloudControllerServer

type UpCloudControllerServer struct {
	Driver *UpCloudDriver
}

func NewUpCloudControllerServer

func NewUpCloudControllerServer(driver *UpCloudDriver) *UpCloudControllerServer

func (*UpCloudControllerServer) ControllerGetCapabilities

ControllerGetCapabilities get capabilities of the controller

func (*UpCloudControllerServer) ControllerGetVolume

This relates to being able to get health checks on a PV. We do not have this

func (*UpCloudControllerServer) ControllerPublishVolume

func (*UpCloudControllerServer) ControllerUnpublishVolume

func (*UpCloudControllerServer) CreateSnapshot

func (*UpCloudControllerServer) CreateVolume

CreateVolume provisions a new volume on behalf of the user

func (*UpCloudControllerServer) DeleteSnapshot

func (*UpCloudControllerServer) DeleteVolume

func (*UpCloudControllerServer) GetCapacity

func (*UpCloudControllerServer) ListSnapshots

func (*UpCloudControllerServer) ListVolumes

func (*UpCloudControllerServer) ValidateVolumeCapabilities

ValidateVolumeCapabilities checks if requested capabilities are supported

type UpCloudCreateStorageResp

type UpCloudCreateStorageResp struct {
	Storage struct {
		Access     string `json:"access"`
		BackupRule struct {
		} `json:"backup_rule"`
		Backups struct {
			Backup []interface{} `json:"backup"`
		} `json:"backups"`
		Created time.Time `json:"created"`
		License int       `json:"license"`
		Servers struct {
			Server []interface{} `json:"server"`
		} `json:"servers"`
		Size  int    `json:"size"`
		State string `json:"state"`
		Tier  string `json:"tier"`
		Title string `json:"title"`
		Type  string `json:"type"`
		UUID  string `json:"uuid"`
		Zone  string `json:"zone"`
	} `json:"storage"`
}

type UpCloudDriver

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

UpCloudDriver struct

func NewDriver

func NewDriver(endpoint, token, driverName, version, userAgent string, isController bool) (*UpCloudDriver, error)

func (*UpCloudDriver) Run

func (d *UpCloudDriver) Run()

type UpCloudIdentityServer

type UpCloudIdentityServer struct {
	Driver *UpCloudDriver
}

UpCloudIdentityServer

func NewUpCloudIdentityServer

func NewUpCloudIdentityServer(driver *UpCloudDriver) *UpCloudIdentityServer

func (*UpCloudIdentityServer) GetPluginCapabilities

GetPluginCapabilities returns plugins available capabilities

func (*UpCloudIdentityServer) GetPluginInfo

GetPluginInfo returns basic plugin data

func (*UpCloudIdentityServer) Probe

func (upCloudIdentity *UpCloudIdentityServer) Probe(_ context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

type UpCloudListServerResp

type UpCloudListServerResp struct {
	Servers struct {
		Server []struct {
			CoreNumber    string `json:"core_number"`
			Hostname      string `json:"hostname"`
			License       int    `json:"license"`
			MemoryAmount  string `json:"memory_amount"`
			Plan          string `json:"plan"`
			PlanIvp4Bytes string `json:"plan_ivp4_bytes,omitempty"`
			PlanIpv6Bytes string `json:"plan_ipv6_bytes,omitempty"`
			State         string `json:"state"`
			Tags          struct {
				Tag []string `json:"tag"`
			} `json:"tags"`
			Title string `json:"title"`
			UUID  string `json:"uuid"`
			Zone  string `json:"zone"`
		} `json:"server"`
	} `json:"servers"`
}

type UpCloudListStorageDetailsResp

type UpCloudListStorageDetailsResp struct {
	Storage struct {
		Access  string `json:"access"`
		License int    `json:"license"`
		Servers struct {
			Server []string `json:"server"`
		} `json:"servers"`
		Size  int    `json:"size"`
		State string `json:"state"`
		Tier  string `json:"tier"`
		Title string `json:"title"`
		Type  string `json:"type"`
		UUID  string `json:"uuid"`
		Zone  string `json:"zone"`
	} `json:"storage"`
}

type UpCloudListStoragesResp

type UpCloudListStoragesResp struct {
	Storages struct {
		Storage []struct {
			Access     string    `json:"access"`
			Created    time.Time `json:"created"`
			License    int       `json:"license"`
			Size       int       `json:"size"`
			State      string    `json:"state"`
			Tier       string    `json:"tier"`
			Title      string    `json:"title"`
			Type       string    `json:"type"`
			UUID       string    `json:"uuid"`
			Zone       string    `json:"zone"`
			PartOfPlan string    `json:"part_of_plan,omitempty"`
			Details    *UpCloudListStorageDetailsResp
		} `json:"storage"`
	} `json:"storages"`
}

type UpCloudNodeServer

type UpCloudNodeServer struct {
	Driver *UpCloudDriver
}

func NewUpCloudNodeDriver

func NewUpCloudNodeDriver(driver *UpCloudDriver) *UpCloudNodeServer

func (*UpCloudNodeServer) NodeGetInfo

func (*UpCloudNodeServer) NodePublishVolume

func (*UpCloudNodeServer) NodeStageVolume

func (*UpCloudNodeServer) NodeUnpublishVolume

func (*UpCloudNodeServer) NodeUnstageVolume

type UpCloudServerDetailResp

type UpCloudServerDetailResp struct {
	Server struct {
		BootOrder   string `json:"boot_order"`
		CoreNumber  string `json:"core_number"`
		Firewall    string `json:"firewall"`
		Host        int64  `json:"host"`
		Hostname    string `json:"hostname"`
		IPAddresses struct {
			IPAddress []struct {
				Access  string `json:"access"`
				Address string `json:"address"`
				Family  string `json:"family"`
			} `json:"ip_address"`
		} `json:"ip_addresses"`
		License      int    `json:"license"`
		MemoryAmount string `json:"memory_amount"`
		Networking   struct {
			Interfaces struct {
				Interface []struct {
					Index       int `json:"index"`
					IPAddresses struct {
						IPAddress []struct {
							Address  string `json:"address"`
							Family   string `json:"family"`
							Floating string `json:"floating"`
						} `json:"ip_address"`
					} `json:"ip_addresses"`
					Mac      string `json:"mac"`
					Network  string `json:"network"`
					Type     string `json:"type"`
					Bootable string `json:"bootable"`
				} `json:"interface"`
			} `json:"interfaces"`
		} `json:"networking"`
		NicModel       string `json:"nic_model"`
		Plan           string `json:"plan"`
		PlanIpv4Bytes  string `json:"plan_ipv4_bytes"`
		PlanIpv6Bytes  string `json:"plan_ipv6_bytes"`
		SimpleBackup   string `json:"simple_backup"`
		State          string `json:"state"`
		StorageDevices struct {
			StorageDevice []struct {
				Address      string `json:"address"`
				PartOfPlan   string `json:"part_of_plan"`
				Storage      string `json:"storage"`
				StorageSize  int    `json:"storage_size"`
				StorageTier  string `json:"storage_tier"`
				StorageTitle string `json:"storage_title"`
				Type         string `json:"type"`
				BootDisk     string `json:"boot_disk"`
			} `json:"storage_device"`
		} `json:"storage_devices"`
		Tags struct {
			Tag []string `json:"tag"`
		} `json:"tags"`
		Timezone             string `json:"timezone"`
		Title                string `json:"title"`
		UUID                 string `json:"uuid"`
		VideoModel           string `json:"video_model"`
		RemoteAccessEnabled  string `json:"remote_access_enabled"`
		RemoteAccessType     string `json:"remote_access_type"`
		RemoteAccessHost     string `json:"remote_access_host"`
		RemoteAccessPassword string `json:"remote_access_password"`
		RemoteAccessPort     string `json:"remote_access_port"`
		Zone                 string `json:"zone"`
	} `json:"server"`
}

type UpCloudStorageOPResp

type UpCloudStorageOPResp struct {
	Server struct {
		BootOrder   string `json:"boot_order"`
		CoreNumber  string `json:"core_number"`
		Created     int    `json:"created"`
		Firewall    string `json:"firewall"`
		Host        int64  `json:"host"`
		Hostname    string `json:"hostname"`
		IPAddresses struct {
			IPAddress []struct {
				Access     string `json:"access"`
				Address    string `json:"address"`
				Family     string `json:"family"`
				PartOfPlan string `json:"part_of_plan,omitempty"`
			} `json:"ip_address"`
		} `json:"ip_addresses"`
		License      int    `json:"license"`
		MemoryAmount string `json:"memory_amount"`
		Metadata     string `json:"metadata"`
		Networking   struct {
			Interfaces struct {
				Interface []struct {
					Bootable    string `json:"bootable"`
					Index       int    `json:"index"`
					IPAddresses struct {
						IPAddress []struct {
							Address  string `json:"address"`
							Family   string `json:"family"`
							Floating string `json:"floating"`
						} `json:"ip_address"`
					} `json:"ip_addresses"`
					Mac               string `json:"mac"`
					Network           string `json:"network"`
					SourceIPFiltering string `json:"source_ip_filtering"`
					Type              string `json:"type"`
				} `json:"interface"`
			} `json:"interfaces"`
		} `json:"networking"`
		NicModel             string `json:"nic_model"`
		Plan                 string `json:"plan"`
		PlanIpv4Bytes        string `json:"plan_ipv4_bytes"`
		PlanIpv6Bytes        string `json:"plan_ipv6_bytes"`
		RemoteAccessEnabled  string `json:"remote_access_enabled"`
		RemoteAccessPassword string `json:"remote_access_password"`
		RemoteAccessType     string `json:"remote_access_type"`
		SimpleBackup         string `json:"simple_backup"`
		State                string `json:"state"`
		StorageDevices       struct {
			StorageDevice []struct {
				Address      string `json:"address"`
				BootDisk     string `json:"boot_disk"`
				PartOfPlan   string `json:"part_of_plan,omitempty"`
				Storage      string `json:"storage"`
				StorageSize  int    `json:"storage_size"`
				StorageTier  string `json:"storage_tier"`
				StorageTitle string `json:"storage_title"`
				Type         string `json:"type"`
			} `json:"storage_device"`
		} `json:"storage_devices"`
		Tags struct {
			Tag []interface{} `json:"tag"`
		} `json:"tags"`
		Timezone   string `json:"timezone"`
		Title      string `json:"title"`
		UUID       string `json:"uuid"`
		VideoModel string `json:"video_model"`
		Zone       string `json:"zone"`
	} `json:"server"`
}

Jump to

Keyboard shortcuts

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