spotinst

package
v0.0.0-...-0147870 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteInstance

func DeleteInstance(cloud Cloud, instance *cloudinstances.CloudInstanceGroupMember) error

DeleteInstance removes an instance from its instance group.

func DeleteInstanceGroup

func DeleteInstanceGroup(cloud Cloud, group *cloudinstances.CloudInstanceGroup) error

DeleteInstanceGroup deletes an existing InstanceGroup.

func GetCloudGroups

func GetCloudGroups(cloud Cloud, cluster *kops.Cluster, instanceGroups []*kops.InstanceGroup,
	warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error)

GetCloudGroups returns a list of InstanceGroups as CloudInstanceGroup objects.

func ListElastigroupResources

func ListElastigroupResources(cloud Cloud, clusterName string) ([]*resources.Resource, error)

ListElastigroupResources returns a list of all Elastigroup resources.

func ListOceanResources

func ListOceanResources(cloud Cloud, clusterName string) ([]*resources.Resource, error)

ListOceanResources returns a list of all Ocean resources.

func ListResources

func ListResources(cloud Cloud, clusterName string) ([]*resources.Resource, error)

ListResources returns a list of all resources.

func LoadCredentials

func LoadCredentials() (credentials.Value, error)

LoadCredentials attempts to load credentials using the default chain.

func NewConfig

func NewConfig() *spotinst.Config

NewConfig returns a new configuration object.

func NewCredentials

func NewCredentials() *credentials.Credentials

NewCredentials returns a new chain-credentials object.

func NewStdLogger

func NewStdLogger() log.Logger

NewStdLogger returns a new Logger.

Types

type Cloud

type Cloud interface {
	// Elastigroups returns a new Elastigroup service.
	Elastigroup() InstanceGroupService

	// Ocean returns a new Ocean service.
	Ocean() InstanceGroupService

	// LaunchSpec returns a new LaunchSpec service.
	LaunchSpec() LaunchSpecService
}

Cloud wraps all services provided by Spotinst.

func NewCloud

func NewCloud(cloudProviderID kops.CloudProviderID) (Cloud, error)

NewCloud returns a Cloud interface for the specified cloud provider.

type Instance

type Instance interface {
	// Id returns the ID of the instance.
	Id() string

	// CreatedAt returns the timestamp when the Instance has been created.
	CreatedAt() time.Time

	// Obj returns the raw object which is a cloud-specific implementation.
	Obj() interface{}
}

Instance wraps a cloud-specific instance object.

type InstanceGroup

type InstanceGroup interface {
	// Id returns the ID of the InstanceGroup.
	Id() string

	// Type returns the type of the InstanceGroup.
	Type() InstanceGroupType

	// Name returns the name of the InstanceGroup.
	Name() string

	// MinSize returns the minimum size of the InstanceGroup.
	MinSize() int

	// MaxSize returns the maximum size of the InstanceGroup.
	MaxSize() int

	// CreatedAt returns the timestamp when the InstanceGroup has been created.
	CreatedAt() time.Time

	// UpdatedAt returns the timestamp when the InstanceGroup has been updated.
	UpdatedAt() time.Time

	// Obj returns the raw object which is a cloud-specific implementation.
	Obj() interface{}
}

InstanceGroup wraps a cloud-specific instance group object.

func NewElastigroup

func NewElastigroup(cloudProviderID kops.CloudProviderID,
	obj interface{}) (InstanceGroup, error)

NewElastigroup returns an Elastigroup wrapper for the specified cloud provider.

func NewInstanceGroup

func NewInstanceGroup(cloudProviderID kops.CloudProviderID,
	instanceGroupType InstanceGroupType, obj interface{}) (InstanceGroup, error)

NewInstanceGroups returns an InstanceGroup wrapper for the specified cloud provider.

func NewOcean

func NewOcean(cloudProviderID kops.CloudProviderID,
	obj interface{}) (InstanceGroup, error)

NewOcean returns an Ocean wrapper for the specified cloud provider.

type InstanceGroupService

type InstanceGroupService interface {
	// List returns a list of InstanceGroups.
	List(ctx context.Context) ([]InstanceGroup, error)

	// Create creates a new InstanceGroup and returns its ID.
	Create(ctx context.Context, group InstanceGroup) (string, error)

	// Read returns an existing InstanceGroup by ID.
	Read(ctx context.Context, groupID string) (InstanceGroup, error)

	// Update updates an existing InstanceGroup.
	Update(ctx context.Context, group InstanceGroup) error

	// Delete deletes an existing InstanceGroup by ID.
	Delete(ctx context.Context, groupID string) error

	// Detach removes one or more instances from the specified InstanceGroup.
	Detach(ctx context.Context, groupID string, instanceIDs []string) error

	// Instances returns a list of all instances that belong to specified InstanceGroup.
	Instances(ctx context.Context, groupID string) ([]Instance, error)
}

InstanceGroupService wraps all common functionality for InstanceGroups.

type InstanceGroupType

type InstanceGroupType string
const (
	InstanceGroupElastigroup InstanceGroupType = "elastigroup"
	InstanceGroupOcean       InstanceGroupType = "ocean"
)

type LaunchSpec

type LaunchSpec interface {
	// Id returns the ID of the LaunchSpec.
	Id() string

	// Name returns the name of the LaunchSpec.
	Name() string

	// OceanId returns the ID of the Ocean instance group.
	OceanId() string

	// CreatedAt returns the timestamp when the LaunchSpec has been created.
	CreatedAt() time.Time

	// UpdatedAt returns the timestamp when the LaunchSpec has been updated.
	UpdatedAt() time.Time

	// Obj returns the raw object which is a cloud-specific implementation.
	Obj() interface{}
}

LaunchSpec wraps a cloud-specific launch specification object.

func NewLaunchSpec

func NewLaunchSpec(cloudProviderID kops.CloudProviderID, obj interface{}) (LaunchSpec, error)

NewLaunchSpec returns a LaunchSpec wrapper for the specified cloud provider.

type LaunchSpecService

type LaunchSpecService interface {
	// List returns a list of LaunchSpecs.
	List(ctx context.Context, oceanID string) ([]LaunchSpec, error)

	// Create creates a new LaunchSpec and returns its ID.
	Create(ctx context.Context, spec LaunchSpec) (string, error)

	// Read returns an existing LaunchSpec by ID.
	Read(ctx context.Context, specID string) (LaunchSpec, error)

	// Update updates an existing LaunchSpec.
	Update(ctx context.Context, spec LaunchSpec) error

	// Delete deletes an existing LaunchSpec by ID.
	Delete(ctx context.Context, specID string) error
}

LaunchSpecService wraps all common functionality for LaunchSpecs.

type ResourceType

type ResourceType string
const (
	ResourceTypeInstanceGroup ResourceType = "instancegroup"
	ResourceTypeLaunchSpec    ResourceType = "launchspec"
)

Jump to

Keyboard shortcuts

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