providers

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

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

type Info

type Info struct {
	Provider      string `json:"provider"`
	PublicIP      string `json:"public_ip"`
	PrivateIP     string `json:"private_ip"`
	VMEnvironment string `json:"vm_environment"`
	InstanceID    string `json:"instance_id"`
}

Info defines a provider info data.

func (*Info) RenderTable

func (i *Info) RenderTable(wr io.Writer)

Directories

Path Synopsis
Package all provides a list of known providers.
Package all provides a list of known providers.
aws
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.
gcp
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.

Jump to

Keyboard shortcuts

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