gcp

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotStopped is an error that is thrown when an instance is attempted
	// to be stopped but is found to be not running
	ErrNotStopped = errors.New("not stopped")
)

Functions

This section is empty.

Types

type Client

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

Client is a gcs client

func NewClient

func NewClient(ctx context.Context, project, zone string) (*Client, error)

NewClient creates a new client

func (*Client) ShouldTerminate

func (c *Client) ShouldTerminate(ctx context.Context) (bool, error)

ShouldTerminate checks the current instance's status to see if it's being preempted or terminated. If so, it returns true.

func (*Client) Start

func (c *Client) Start(ctx context.Context, instanceID string) error

Start a instance if it's not already running

func (*Client) Status

func (c *Client) Status(ctx context.Context, instanceID string) (cloud.ProviderStatus, error)

Status returns the status of an instance

func (*Client) Stop

func (c *Client) Stop(ctx context.Context, instanceID string) error

Stop a instance if it's not already stopped

Jump to

Keyboard shortcuts

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