gce

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstanceExternalIP

func GetInstanceExternalIP(inst string, project string, zone string) (string, error)

GetInstanceExternalIP returns the external IP address of the instance in specific project and zone.

Types

type Config

type Config struct {
	NATIP string `json:"natIP"`
}

type Instance

type Instance struct {
	Name        string `json:"name"`
	Status      string `json:"status"`
	Internal    string `json:"internal"`
	External    string `json:"external"`
	Type        string `json:"type"`
	Preemptible bool   `json:"preemptible"`
}

Instance stores details of an instance.

type InstanceDetails

type InstanceDetails struct {
	NIC []Interface `json:"networkInterfaces"`
}

type Instances

type Instances struct {
	List    []Instance
	Project string
	Zone    string
}

Instances stores list of instances in specific project and zone.

func NewInstances

func NewInstances(project string, zone string) *Instances

NewInstances returns an Instances struct with provided project and zone.

func (*Instances) GetInstancesList

func (i *Instances) GetInstancesList() (string, error)

GetInstancesList returns a JSON formatted string with instances.

func (*Instances) GetList

func (i *Instances) GetList() ([]Instance, error)

GetList returns a slice of Instance.

func (*Instances) Start

func (i *Instances) Start(inst string) error

Start will start an instance.

func (*Instances) Status

func (i *Instances) Status(inst string) (string, error)

Status returns the status of the instance.

func (*Instances) Stop

func (i *Instances) Stop(inst string) error

Stop will stop the instance.

type Interface

type Interface struct {
	AccessConfig []Config `json:"accessConfigs"`
}

Jump to

Keyboard shortcuts

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