cloudvm

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package cloudvm provides functions to test whether the current process is running on Google Compute Engine or Amazon Web Services, and to extract settings from this environment.

Package cloudvm provides functions to test whether the current process is running on Google Compute Engine or Amazon Web Services, and to extract settings from this environment.

Index

Constants

View Source
const (
	// AWSAccountIDStatName is the name of a v.io/x/ref/lib/stats
	// string variable containing the account id.
	AWSAccountIDStatName = "system/aws/account-id"
	// AWSRegionStatName is the name of a v.io/x/ref/lib/stats
	// string variable containing the region.
	AWSRegionStatName = "system/aws/zone"
)
View Source
const (

	// GCPProjectIDStatName is the name of a v.io/x/ref/lib/stats
	// string variable containing the project id.
	GCPProjectIDStatName = "system/gcp/project-id"
	// GCPRegionStatName is the name of a v.io/x/ref/lib/stats
	// string variable containing the region.
	GCPRegionStatName = "system/gcp/zone"
)

Variables

This section is empty.

Functions

func AWSPrivateAddrs added in v0.1.10

func AWSPrivateAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)

AWSPrivateAddrs returns the current private Addrs of this AWS instance. Must be called after OnAWS.

func AWSPublicAddrs added in v0.1.10

func AWSPublicAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)

AWSPublicAddrs returns the current public IP of this AWS instance. Must be called after OnAWS.

func GCPPrivateAddrs added in v0.1.10

func GCPPrivateAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)

GCPPrivateAddrs returns the current private addresses of this GCP instance.

func GCPPublicAddrs added in v0.1.10

func GCPPublicAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)

GCPPublicAddrs returns the current public addresses of this GCP instance.

func OnAWS added in v0.1.10

func OnAWS(ctx context.Context, logger logging.Logger, timeout time.Duration) bool

OnAWS returns true if this process is running on Amazon Web Services. If true, the the stats variables AWSAccountIDStatName and GCPRegionStatName are set.

func OnGCP added in v0.1.10

func OnGCP(ctx context.Context, timeout time.Duration) bool

OnGCP returns true if this process is running on Google Compute Platform. If true, the the stats variables GCPProjectIDStatName and GCPRegionStatName are set.

func SetAWSMetadataHost added in v0.1.10

func SetAWSMetadataHost(host string)

SetAWSMetadataHost can be used to override the default metadata host for testing purposes.

func SetGCPMetadataHost added in v0.1.10

func SetGCPMetadataHost(host string)

SetGCPMetadataHost can be used to override the default metadata host for testing purposes.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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