apmcloudutil

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger added in v1.10.0

type Logger interface {
	Warningf(format string, args ...interface{})
}

Logger defines the interface for logging while fetching cloud metadata.

type Provider

type Provider string

Provider identifies the cloud provider.

const (
	// None is a pseudo cloud provider which disables fetching of
	// cloud metadata.
	None Provider = "none"

	// Auto is a pseudo cloud provider which uses trial-and-error to
	// fetch cloud metadata from all supported clouds.
	Auto Provider = "auto"

	// AWS represents the Amazon Web Services (EC2) cloud provider.
	AWS Provider = "aws"

	// Azure represents the Microsoft Azure cloud provider.
	Azure Provider = "azure"

	// GCP represents the Google Cloud Platform cloud provider.
	GCP Provider = "gcp"
)

func ParseProvider

func ParseProvider(s string) (Provider, error)

ParseProvider parses the provider name "s", returning the relevant Provider.

If the provider name is unknown, None will be returned with an error.

func (Provider) GetCloudMetadata

func (p Provider) GetCloudMetadata(ctx context.Context, logger Logger, out *model.Cloud) bool

GetCloudMetadata attempts to fetch cloud metadata for cloud provider p, storing it into out and returning a boolean indicating that the metadata was successfully retrieved.

It is the caller's responsibility to set a reasonable timeout, to ensure requests do not block normal operation in non-cloud environments.

Jump to

Keyboard shortcuts

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