providers

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCloudProvider

func GetCloudProvider(i Interface) (*v1alpha1.CloudProvider, error)

get data from api

func List

func List() []string

func MergeAndWriteCloudProvider

func MergeAndWriteCloudProvider(i Interface) error

get data from api , merge it with previous data and write the data previous data written in cloud_old.json

func MergeCloudProvider

func MergeCloudProvider(oldData, curData *v1alpha1.CloudProvider) (*v1alpha1.CloudProvider, error)

region merge rule:

if region doesn't exist in old data, but exists in cur data, then add it
if region exists in old data, but doesn't exists in cur data, then delete it
if region exist in both, then
	if field data exists in both cur and old data , then take the cur data
	otherwise, take data from (old or cur)whichever contains it

instanceType merge rule: same as region rule, except

if instance exists in old data, but doesn't exists in cur data, then add it , set the deprecated true

In MergeCloudProvider, we merge only the region and instanceType data

func WriteCloudProvider

func WriteCloudProvider(data *v1alpha1.CloudProvider) error

func WriteObject

func WriteObject(obj runtime.Object) error

Types

type Interface

type Interface interface {
	GetName() string
	ListRegions() ([]v1alpha1.Region, error)
	ListZones() ([]string, error)
	ListMachineTypes() ([]v1alpha1.MachineType, error)
}

func NewCloudProvider

func NewCloudProvider(opts Options) (Interface, error)

type Options

type Options struct {
	Provider string
	Do       credential.DigitalOcean
	Packet   credential.Packet
	GCE      credential.GCE
	AWS      credential.AWS
	Azure    credential.Azure
	Vultr    credential.Vultr
	Linode   credential.Linode
	Scaleway credential.Scaleway
}

func NewOptions

func NewOptions() *Options

func NewOptionsForCredential

func NewOptionsForCredential(c v1alpha1.Credential) Options

func (*Options) AddFlags

func (c *Options) AddFlags(fs *pflag.FlagSet)

func (*Options) ValidateFlags

func (c *Options) ValidateFlags(cmd *cobra.Command, args []string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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