Documentation
¶
Index ¶
- Constants
- type GCloud
- func (g *GCloud) AttachVolume(ctx *lepton.Context, image, name string, attachID int) error
- func (p *GCloud) BuildImage(ctx *lepton.Context) (string, error)
- func (p *GCloud) BuildImageWithPackage(ctx *lepton.Context, pkgpath string) (string, error)
- func (p *GCloud) CreateImage(ctx *lepton.Context, imagePath string) error
- func (p *GCloud) CreateInstance(ctx *lepton.Context) error
- func (p *GCloud) CreateSubnet(computeService *compute.Service, project string, region string, name string, ...) (network *compute.Subnetwork, err error)
- func (p *GCloud) CreateVPC(computeService *compute.Service, project string, name string) (network *compute.Network, err error)
- func (g *GCloud) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data string, provider string) (lepton.NanosVolume, error)
- func (p *GCloud) CreateZoneRecord(config *types.Config, zoneID string, record *lepton.DNSRecord) error
- func (p *GCloud) CustomizeImage(ctx *lepton.Context) (string, error)
- func (p *GCloud) DeleteImage(ctx *lepton.Context, imagename string) error
- func (p *GCloud) DeleteInstance(ctx *lepton.Context, instancename string) error
- func (g *GCloud) DeleteVolume(ctx *lepton.Context, name string) error
- func (p *GCloud) DeleteZoneRecordIfExists(config *types.Config, zoneID string, recordName string) error
- func (g *GCloud) DetachVolume(ctx *lepton.Context, image, volumeName string) error
- func (p *GCloud) FindOrCreateZoneIDByName(config *types.Config, dnsName string) (string, error)
- func (g *GCloud) GetAllVolumes(ctx *lepton.Context) (*[]lepton.NanosVolume, error)
- func (p *GCloud) GetImages(ctx *lepton.Context, filter string) ([]lepton.CloudImage, error)
- func (p *GCloud) GetInstanceByName(ctx *lepton.Context, name string) (*lepton.CloudInstance, error)
- func (p *GCloud) GetInstanceLogs(ctx *lepton.Context, instancename string) (string, error)
- func (p *GCloud) GetInstances(ctx *lepton.Context) ([]lepton.CloudInstance, error)
- func (p *GCloud) GetStorage() lepton.Storage
- func (p *GCloud) GetSubnet(computeService *compute.Service, project string, region string, vpc string, ...) (subnet *compute.Subnetwork, err error)
- func (p *GCloud) GetVPC(computeService *compute.Service, project string, name string) (network *compute.Network, err error)
- func (p *GCloud) Initialize(config *types.ProviderConfig) error
- func (p *GCloud) InstanceStats(ctx *lepton.Context, instancename string, watch bool) error
- func (p *GCloud) ListImages(ctx *lepton.Context, filter string) error
- func (p *GCloud) ListInstances(ctx *lepton.Context) error
- func (p *GCloud) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error
- func (p *GCloud) RebootInstance(ctx *lepton.Context, instancename string) error
- func (p *GCloud) ResetInstance(ctx *lepton.Context, instancename string) error
- func (p *GCloud) ResizeImage(ctx *lepton.Context, imagename string, hbytes string) error
- func (p *GCloud) StartInstance(ctx *lepton.Context, instancename string) error
- func (p *GCloud) StopInstance(ctx *lepton.Context, instancename string) error
- func (p *GCloud) SyncImage(config *types.Config, target lepton.Provider, image string) error
- type GCloudOperation
- type Storage
Constants ¶
const GCPStorageURL string = "https://storage.googleapis.com/%v/%v"
GCPStorageURL is GCP storage path
const ProviderName = "gcp"
ProviderName of the cloud platform provider
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GCloud ¶
type GCloud struct { Storage *Storage Service *compute.Service ProjectID string Zone string // contains filtered or unexported fields }
GCloud Provider to interact with GCP cloud infrastructure
func (*GCloud) AttachVolume ¶
AttachVolume attaches Compute Engine Disk volume to existing instance
func (*GCloud) BuildImage ¶
BuildImage to be upload on GCP
func (*GCloud) BuildImageWithPackage ¶
BuildImageWithPackage to upload on GCP
func (*GCloud) CreateImage ¶
CreateImage - Creates image on GCP using nanos images TODO : re-use and cache DefaultClient and instances.
func (*GCloud) CreateInstance ¶
CreateInstance - Creates instance on Google Cloud Platform
func (*GCloud) CreateSubnet ¶
func (p *GCloud) CreateSubnet(computeService *compute.Service, project string, region string, name string, vpc *compute.Network) (network *compute.Subnetwork, err error)
CreateSubnet creates a subnet with the name specified TODO: Specify required subnet IpCidrRange without overlapping other subnetworks ip range. Requires fetching every subnet and find an unused Ip range
func (*GCloud) CreateVPC ¶
func (p *GCloud) CreateVPC(computeService *compute.Service, project string, name string) (network *compute.Network, err error)
CreateVPC creates a legacy virtual network with the name specified
func (*GCloud) CreateVolume ¶
func (g *GCloud) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data string, provider string) (lepton.NanosVolume, error)
CreateVolume creates local volume and converts it to GCP format before orchestrating the necessary upload procedures
func (*GCloud) CreateZoneRecord ¶
func (p *GCloud) CreateZoneRecord(config *types.Config, zoneID string, record *lepton.DNSRecord) error
CreateZoneRecord creates a record in a DNS zone
func (*GCloud) CustomizeImage ¶
CustomizeImage returns image path with adaptations needed by cloud provider
func (*GCloud) DeleteImage ¶
DeleteImage deletes image from Gcloud
func (*GCloud) DeleteInstance ¶
DeleteInstance deletes instance from Gcloud
func (*GCloud) DeleteVolume ¶
DeleteVolume deletes specific disk and image in GCP
func (*GCloud) DeleteZoneRecordIfExists ¶
func (p *GCloud) DeleteZoneRecordIfExists(config *types.Config, zoneID string, recordName string) error
DeleteZoneRecordIfExists deletes a record from a DNS zone if it exists
func (*GCloud) DetachVolume ¶
DetachVolume detaches Compute Engine Disk volume from existing instance
func (*GCloud) FindOrCreateZoneIDByName ¶
FindOrCreateZoneIDByName searches for a DNS zone with the name passed by argument and if it doesn't exist it creates one
func (*GCloud) GetAllVolumes ¶
GetAllVolumes gets all volumes created in GCP as Compute Engine Disks
func (*GCloud) GetInstanceByName ¶
GetInstanceByName returns instance with given name
func (*GCloud) GetInstanceLogs ¶
GetInstanceLogs gets instance related logs
func (*GCloud) GetInstances ¶
GetInstances return all instances on GCloud
func (*GCloud) GetStorage ¶
GetStorage returns storage interface for cloud provider
func (*GCloud) GetSubnet ¶
func (p *GCloud) GetSubnet(computeService *compute.Service, project string, region string, vpc string, name string) (subnet *compute.Subnetwork, err error)
GetSubnet returns the subnet in vpc with the name specified
func (*GCloud) GetVPC ¶
func (p *GCloud) GetVPC(computeService *compute.Service, project string, name string) (network *compute.Network, err error)
GetVPC returns the vpc with the name specified
func (*GCloud) Initialize ¶
func (p *GCloud) Initialize(config *types.ProviderConfig) error
Initialize GCP related things
func (*GCloud) InstanceStats ¶
InstanceStats show metrics for instances on gcp.
func (*GCloud) ListImages ¶
ListImages lists images on Google Cloud
func (*GCloud) ListInstances ¶
ListInstances lists instances on Gcloud
func (*GCloud) PrintInstanceLogs ¶
PrintInstanceLogs writes instance logs to console
func (*GCloud) RebootInstance ¶
RebootInstance reboots the instance.
func (*GCloud) ResetInstance ¶
ResetInstance resets instance
func (*GCloud) ResizeImage ¶
ResizeImage is not supported on google cloud.
func (*GCloud) StartInstance ¶
StartInstance starts an instance in GCloud
func (*GCloud) StopInstance ¶
StopInstance stops instance
type GCloudOperation ¶
type GCloudOperation struct {
// contains filtered or unexported fields
}
GCloudOperation status check
type Storage ¶
type Storage struct{}
Storage provides GCP storage related operations
func (*Storage) CopyToBucket ¶
CopyToBucket copies archive to bucket