Documentation
¶
Overview ¶
Package providers contains machine/cloud providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector interface {
// Name returns the name of the provider.
Name() string
// Provider returns a non-empty string and no error,
// if a provider is successfully detected.
Provider(context.Context) (string, error)
// PublicIPv4 returns a non-empty string and no error,
// if a public IPv4 is successfully detected.
PublicIPv4(context.Context) (string, error)
// PrivateIPv4 returns a non-empty string and no error,
// if a private IPv4 is successfully detected.
PrivateIPv4(context.Context) (string, error)
// VMEnvironment returns a non-empty string and no error,
// if a VM environment is successfully detected.
// e.g., "azEnvironment" as "AZUREPUBLICCLOUD" for Azure.
VMEnvironment(context.Context) (string, error)
// InstanceID returns an instance id generated by provider.
InstanceID(ctx context.Context) (string, error)
}
Detector defines a provider detector interface.
func New ¶
func New( name string, detectProviderFunc func(ctx context.Context) (string, error), fetchPublicIPv4Func func(ctx context.Context) (string, error), fetchPrivateIPv4Func func(ctx context.Context) (string, error), fetchVMEnvironmentFunc func(ctx context.Context) (string, error), fetchInstanceIDFunc func(ctx context.Context) (string, error), ) Detector
func NewWithRegion ¶ added in v0.11.7
func NewWithRegion( name string, detectProviderFunc func(ctx context.Context) (string, error), fetchPublicIPv4Func func(ctx context.Context) (string, error), fetchPrivateIPv4Func func(ctx context.Context) (string, error), fetchRegionFunc func(ctx context.Context) (string, error), fetchVMEnvironmentFunc func(ctx context.Context) (string, error), fetchInstanceIDFunc func(ctx context.Context) (string, error), ) Detector
type Info ¶
type Info struct {
Provider string `json:"provider"`
PublicIP string `json:"public_ip"`
PrivateIP string `json:"private_ip"`
Region string `json:"region"`
VMEnvironment string `json:"vm_environment"`
InstanceID string `json:"instance_id"`
}
Info defines a provider info data.
func (*Info) RenderTable ¶
type RegionDetector ¶ added in v0.11.7
type RegionDetector interface {
// Region returns a non-empty provider-specific region and no error,
// if a region is successfully detected.
Region(context.Context) (string, error)
}
RegionDetector is implemented by detectors that can report a provider-specific region.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package all provides a list of known providers.
|
Package all provides a list of known providers. |
|
Package aws implements "AWS" provider and helpers.
|
Package aws implements "AWS" provider and helpers. |
|
imds
Package imds provides functions for interacting with the AWS Instance Metadata Service.
|
Package imds provides functions for interacting with the AWS Instance Metadata Service. |
|
Package azure implements "azure" provider and helpers.
|
Package azure implements "azure" provider and helpers. |
|
imds
Package imds provides functions for interacting with the Azure Instance Metadata Service.
|
Package imds provides functions for interacting with the Azure Instance Metadata Service. |
|
Package gcp implements Google Cloud Platform (GCP) provider and helpers.
|
Package gcp implements Google Cloud Platform (GCP) provider and helpers. |
|
imds
Package imds provides functions for interacting with the Google Cloud Platform Instance Metadata Service.
|
Package imds provides functions for interacting with the Google Cloud Platform Instance Metadata Service. |
|
Package nscale implements nscale provider detection and metadata helpers.
|
Package nscale implements nscale provider detection and metadata helpers. |
|
imds
Package imds provides functions for interacting with the nscale instance metadata service.
|
Package imds provides functions for interacting with the nscale instance metadata service. |
Click to show internal directories.
Click to hide internal directories.