Documentation
¶
Overview ¶
Package types defines core types and interfaces for cloud environment detection and metadata retrieval.
Package types defines core types and interfaces for cloud environment detection and metadata retrieval.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudProvider ¶
type CloudProvider string
CloudProvider represents the detected cloud provider.
const ( // CloudProviderAWS represents Amazon Web Services CloudProviderAWS CloudProvider = "aws" // CloudProviderGoogle represents Google Cloud Platform CloudProviderGoogle CloudProvider = "google" // CloudProviderAzure represents Microsoft Azure CloudProviderAzure CloudProvider = "azure" // CloudProviderUnknown represents an undetected or unsupported cloud provider CloudProviderUnknown CloudProvider = "unknown" // CloudProviderMock represents a mock provider for testing CloudProviderMock CloudProvider = "mock" )
type EnvironmentInfo ¶
type EnvironmentInfo struct {
CloudProvider CloudProvider `json:"cloudProvider"`
Region string `json:"region"`
AccountID string `json:"accountId"`
ClusterName string `json:"clusterName"`
}
EnvironmentInfo contains cloud environment information retrieved from metadata services.
This structure provides the essential information needed for cloud cost allocation and monitoring:
- CloudProvider: The detected cloud provider
- Region: The cloud region/location where the instance is running
- AccountID: The cloud account identifier
- ClusterName: The cluster identifier for the environment
type Scout ¶
type Scout interface {
// Detect determines if the current environment is running in this cloud
// provider.
//
// Returns:
// - CloudProvider: CloudProvider value if detected (e.g.,
// CloudProviderAWS), CloudProviderUnknown if not detected
// - error: If detection fails due to network or other errors
Detect(ctx context.Context) (CloudProvider, error)
// EnvironmentInfo retrieves cloud environment information including
// cloud provider, region, and account ID.
//
// The context should include a reasonable timeout (e.g., 10 seconds) to
// prevent hanging if metadata services are unreachable.
//
// Returns:
// - EnvironmentInfo: The detected environment information
// - error: If detection or retrieval fails
EnvironmentInfo(ctx context.Context) (*EnvironmentInfo, error)
}
Scout defines the interface for cloud environment detection and metadata retrieval.
Click to show internal directories.
Click to hide internal directories.