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
- func AWSPrivateAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)
- func AWSPublicAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)
- func GCPPrivateAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)
- func GCPPublicAddrs(ctx context.Context, timeout time.Duration) ([]net.Addr, error)
- func OnAWS(ctx context.Context, logger logging.Logger, timeout time.Duration) bool
- func OnGCP(ctx context.Context, timeout time.Duration) bool
- func SetAWSMetadataHost(host string)
- func SetGCPMetadataHost(host string)
Constants ¶
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" )
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
AWSPrivateAddrs returns the current private Addrs of this AWS instance. Must be called after OnAWS.
func AWSPublicAddrs ¶ added in v0.1.10
AWSPublicAddrs returns the current public IP of this AWS instance. Must be called after OnAWS.
func GCPPrivateAddrs ¶ added in v0.1.10
GCPPrivateAddrs returns the current private addresses of this GCP instance.
func GCPPublicAddrs ¶ added in v0.1.10
GCPPublicAddrs returns the current public addresses of this GCP instance.
func OnAWS ¶ added in v0.1.10
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
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.