Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
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 ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.