spi

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AlicloudAccessKeyID is a constant for a key name that is part of the Alibaba cloud credentials.
	AlicloudAccessKeyID string = "alicloudAccessKeyID"
	// AlicloudAccessKeySecret is a constant for a key name that is part of the Alibaba cloud credentials.
	AlicloudAccessKeySecret string = "alicloudAccessKeySecret"
	// AlicloudAlternativeAccessKeyID is a constant for a key name of a secret containing the Alibaba cloud
	// credentials (access key id).
	AlicloudAlternativeAccessKeyID = "accessKeyID"
	// AlicloudAlternativeAccessKeySecret is a constant for a key name of a secret containing the Alibaba cloud
	// credentials (access key secret).
	AlicloudAlternativeAccessKeySecret = "accessKeySecret"
	// AlicloudUserData is a constant for user data
	AlicloudUserData string = "userData"
	// AlicloudDriverName is the name of the CSI driver for Alibaba Cloud
	AlicloudDriverName = "diskplugin.csi.alibabacloud.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ECSClient

type ECSClient interface {
	RunInstances(request *ecs.RunInstancesRequest) (*ecs.RunInstancesResponse, error)
	DescribeInstances(request *ecs.DescribeInstancesRequest) (*ecs.DescribeInstancesResponse, error)
	DeleteInstance(request *ecs.DeleteInstanceRequest) (*ecs.DeleteInstanceResponse, error)
	DescribeDisks(request *ecs.DescribeDisksRequest) (*ecs.DescribeDisksResponse, error)
	DeleteDisk(request *ecs.DeleteDiskRequest) (*ecs.DeleteDiskResponse, error)
	DescribeNetworkInterfaces(request *ecs.DescribeNetworkInterfacesRequest) (*ecs.DescribeNetworkInterfacesResponse, error)
	DeleteNetworkInterface(request *ecs.DeleteNetworkInterfaceRequest) (*ecs.DeleteNetworkInterfaceResponse, error)
}

ECSClient provides an interface

type PluginSPI

type PluginSPI interface {
	NewECSClient(secret *corev1.Secret, region string) (ECSClient, error)
	NewRunInstancesRequest(providerSpec *api.ProviderSpec, machineName string, userData []byte) (*ecs.RunInstancesRequest, error)
	NewDescribeInstancesRequest(machineName, instanceID string, tags map[string]string) (*ecs.DescribeInstancesRequest, error)
	NewDeleteInstanceRequest(instanceID string, force bool) (*ecs.DeleteInstanceRequest, error)
	NewInstanceDataDisks(disks []api.AlicloudDataDisk, machineName string) []ecs.RunInstancesDataDisk
	NewRunInstanceTags(tags map[string]string) ([]ecs.RunInstancesTag, error)
}

PluginSPI provides an interface to deal with cloud provider session You can optionally enhance this interface to add interface methods here You can use it to mock cloud provider calls

type PluginSPIImpl

type PluginSPIImpl struct{}

PluginSPIImpl is the real implementation of SPI interface that makes the calls to the provider SDK.

func (*PluginSPIImpl) NewDeleteInstanceRequest

func (pluginSPI *PluginSPIImpl) NewDeleteInstanceRequest(instanceID string, force bool) (*ecs.DeleteInstanceRequest, error)

NewDeleteInstanceRequest returns a new request of delete instance.

func (*PluginSPIImpl) NewDescribeInstancesRequest

func (pluginSPI *PluginSPIImpl) NewDescribeInstancesRequest(machineName, instanceID string, tags map[string]string) (*ecs.DescribeInstancesRequest, error)

NewDescribeInstancesRequest returns a new request of describe instance.

func (*PluginSPIImpl) NewECSClient

func (pluginSPI *PluginSPIImpl) NewECSClient(secret *corev1.Secret, region string) (ECSClient, error)

NewECSClient returns a new instance of the ECS client.

func (*PluginSPIImpl) NewInstanceDataDisks

func (pluginSPI *PluginSPIImpl) NewInstanceDataDisks(disks []api.AlicloudDataDisk, machineName string) []ecs.RunInstancesDataDisk

NewInstanceDataDisks returns instances data disks.

func (*PluginSPIImpl) NewRunInstanceTags

func (pluginSPI *PluginSPIImpl) NewRunInstanceTags(tags map[string]string) ([]ecs.RunInstancesTag, error)

NewRunInstanceTags returns tags of Running Instances.

func (*PluginSPIImpl) NewRunInstancesRequest

func (pluginSPI *PluginSPIImpl) NewRunInstancesRequest(providerSpec *api.ProviderSpec, machineName string, userData []byte) (*ecs.RunInstancesRequest, error)

NewRunInstancesRequest returns a new request of run instance.

Jump to

Keyboard shortcuts

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