account

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 32 Imported by: 4

Documentation

Overview

This file was generated by go generate; DO NOT EDIT

Index

Constants

View Source
const DefaultStoragePrefix = "/supergiant/account/"

Variables

View Source
var (
	ErrNilAccount          = errors.New("nil account")
	ErrUnsupportedProvider = errors.New("unsupported provider")

	VMResourceType = "virtualMachines"
)

Functions

func NewDOFinder

func NewDOFinder(acc *model.CloudAccount) (*digitalOceanRegionFinder, error)

Types

type AWSFinder

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

func NewAWSFinder

func NewAWSFinder(acc *model.CloudAccount, config *steps.Config) (*AWSFinder, error)

func (*AWSFinder) GetRegions

func (af *AWSFinder) GetRegions(ctx context.Context) (*RegionSizes, error)

func (*AWSFinder) GetTypes

func (af *AWSFinder) GetTypes(ctx context.Context, config steps.Config) ([]string, error)

func (*AWSFinder) GetZones

func (af *AWSFinder) GetZones(ctx context.Context, config steps.Config) ([]string, error)

type AzureFinder

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

func NewAzureFinder

func NewAzureFinder(acc *model.CloudAccount, cfg *steps.Config) (*AzureFinder, error)

func (AzureFinder) GetRegions

func (f AzureFinder) GetRegions(ctx context.Context) (*RegionSizes, error)

func (AzureFinder) GetTypes

func (f AzureFinder) GetTypes(ctx context.Context, cfg steps.Config) ([]string, error)

func (AzureFinder) GetZones

func (f AzureFinder) GetZones(ctx context.Context, config steps.Config) ([]string, error)

type GCEResourceFinder

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

func NewGCEFinder

func NewGCEFinder(acc *model.CloudAccount, config *steps.Config) (*GCEResourceFinder, error)

func (*GCEResourceFinder) GetRegions

func (g *GCEResourceFinder) GetRegions(ctx context.Context) (*RegionSizes, error)

func (*GCEResourceFinder) GetTypes

func (g *GCEResourceFinder) GetTypes(ctx context.Context, config steps.Config) ([]string, error)

func (*GCEResourceFinder) GetZones

func (g *GCEResourceFinder) GetZones(ctx context.Context, config steps.Config) ([]string, error)

type Handler

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

Handler is a http controller for account entity

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) Create

func (h *Handler) Create(rw http.ResponseWriter, r *http.Request)

Create register new cloud account

func (*Handler) Delete

func (h *Handler) Delete(rw http.ResponseWriter, r *http.Request)

Delete cloud account

func (*Handler) Get

func (h *Handler) Get(rw http.ResponseWriter, r *http.Request)

Get retrieves individual account by name

func (*Handler) GetAZs

func (h *Handler) GetAZs(w http.ResponseWriter, r *http.Request)

func (*Handler) GetRegions

func (h *Handler) GetRegions(w http.ResponseWriter, r *http.Request)

func (*Handler) GetTypes

func (h *Handler) GetTypes(w http.ResponseWriter, r *http.Request)

func (*Handler) ListAll

func (h *Handler) ListAll(rw http.ResponseWriter, r *http.Request)

ListAll retrieves all cloud accounts

func (*Handler) Register

func (h *Handler) Register(r *mux.Router)

func (*Handler) Update

func (h *Handler) Update(rw http.ResponseWriter, r *http.Request)

TODO(stgleb): Use patch for updating Update saves updated state of an cloud account, account name can't be changed

type MachineTypes

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

func (MachineTypes) RegionTypes

func (s MachineTypes) RegionTypes(region string) ([]string, error)

Region return a list of supported vm types in the region. Used by RegionFinders.

func (MachineTypes) Regions

func (s MachineTypes) Regions() []string

Regions return a list of supported regions.

func (MachineTypes) Sizes

func (s MachineTypes) Sizes() map[string]VMType

Sizes provides virtual machine parameters (cpu/ram/gpu). Used by RegionFinders.

type Region

type Region struct {
	//Human readable name, e.g. New York City 1 or EU West 1 Frankfurt
	Name string `json:"name"`
	//API specific ID, e.g. t2.micro
	ID string `json:"id"`

	//API specific IDs for a node sizes/type
	AvailableSizes []string
}

Region represents

type RegionSizes

type RegionSizes struct {
	Provider clouds.Name            `json:"provider"`
	Regions  []*Region              `json:"regions"`
	Sizes    map[string]interface{} `json:"sizes"`
}

RegionSizes represents aggregated information about available regions/azs and node sizes/types

type RegionsGetter

type RegionsGetter interface {
	//GetRegions returns a slice of cloud specific regions/az's
	//if not found would return an empty slice
	GetRegions(context.Context) (*RegionSizes, error)
}

RegionsGetter is used to find a list of available regions(availability zones, etc) with available vm types in a given cloud provider using given account credentials

func NewRegionsGetter

func NewRegionsGetter(account *model.CloudAccount, config *steps.Config) (RegionsGetter, error)

NewRegionsGetter returns finder attached to corresponding account as it has all credentials for a cloud provider

type SKUSInterface

type SKUSInterface interface {
	ListComplete(ctx context.Context) (skus.ResourceSkusResultIterator, error)
}

type Service

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

Service holds all business logic related to cloud accounts

func NewService

func NewService(storagePrefix string, repository storage.Interface) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, account *model.CloudAccount) error

Create stores user in the underlying storage

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, accountName string) error

Delete cloud account by name

func (*Service) Get

func (s *Service) Get(ctx context.Context, accountName string) (*model.CloudAccount, error)

Get retrieves a user by it's accountName, returns nil if not found

func (*Service) GetAll

func (s *Service) GetAll(ctx context.Context) ([]model.CloudAccount, error)

GetAll retrieves cloud accounts from underlying storage, returns empty slice if none found

func (*Service) Update

func (s *Service) Update(ctx context.Context, account *model.CloudAccount) error

Update cloud account

type Size

type Size struct {
	RAM string `json:"ram"`
	CPU string `json:"cpu"`
}

type SubscriptionsInterface

type SubscriptionsInterface interface {
	ListLocations(ctx context.Context, subscriptionID string) (subscription.LocationListResult, error)
}

type TypesGetter

type TypesGetter interface {
	GetTypes(context.Context, steps.Config) ([]string, error)
}

func NewTypesGetter

func NewTypesGetter(account *model.CloudAccount, config *steps.Config) (TypesGetter, error)

NewTypesGetter returns finder attached to corresponding account as it has all credentials for a cloud provider

type VMType

type VMType struct {
	Name      string
	VCPU      string
	MemoryGiB string
	GPU       string
}

type ZonesGetter

type ZonesGetter interface {
	GetZones(context.Context, steps.Config) ([]string, error)
}

func NewZonesGetter

func NewZonesGetter(account *model.CloudAccount, config *steps.Config) (ZonesGetter, error)

NewZonesGetter returns finder attached to corresponding account as it has all credentials for a cloud provider

Jump to

Keyboard shortcuts

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