Documentation ¶
Index ¶
- Variables
- func LogRequest(logger log.Logger) autorest.PrepareDecorator
- func LogResponse(logger log.Logger) autorest.RespondDecorator
- func NewAzureProvider(config *provider.Config) provider.Provider
- type AuthConfig
- type Azure
- type Client
- type ClientSecretMap
- type Compute
- type DefaultAuthConfig
- type EventData
- type EventHub
- type Instance
- type Networking
- type ProvisionedVolume
- type ResponseError
- type TimeGrain
- type VMType
Constants ¶
This section is empty.
Variables ¶
var ( ErrResourceGroupNotFound = errors.New("resource group not found") ErrMetricClient = errors.New("metric client error") ErrMetricNotFound = errors.New("no metric found") ErrTimeSeriesNotFound = errors.New("no time series found") ErrTimeSeriesDataNotFound = errors.New("no time series data found") )
Functions ¶
func LogRequest ¶
func LogRequest(logger log.Logger) autorest.PrepareDecorator
LogRequest inspect the request being made to Azure API and writes it to the logger.
func LogResponse ¶
func LogResponse(logger log.Logger) autorest.RespondDecorator
LogResponse inspect the response received from Azure API, process metrics and writes it to the logger.
Types ¶
type AuthConfig ¶
type AuthConfig interface {
GetAuthConfig(clientID, clientSecret, tenantID, envName string) (autorest.Authorizer, azure.Environment, error)
}
AuthConfig is the interface that provides an Authoriser used to provide request authorization to the Azure Rest API.
type Azure ¶
type Azure struct { ClientAuthConfig AuthConfig // contains filtered or unexported fields }
Azure holds the Azure provider configuration options.
type Client ¶
type Client interface { GetResourceGroup(ctx context.Context, name, filter string, logger log.Logger) (resources.Group, error) GetVirtualMachines(ctx context.Context, rgname string, logger log.Logger) ([]compute.VirtualMachine, error) GetVMResourceSkus(ctx context.Context, filter string, logger log.Logger) ([]compute.ResourceSku, error) GetDisks(ctx context.Context, rgname string, logger log.Logger) ([]compute.Disk, error) GetLoadBalancers(ctx context.Context, rgname string, logger log.Logger) ([]network.LoadBalancer, error) GetVirtualNetworks(ctx context.Context, rgname string, logger log.Logger) ([]network.VirtualNetwork, error) GetPublicIPAddresses(ctx context.Context, rgname string, logger log.Logger) ([]network.PublicIPAddress, error) GetEHNamespaces(ctx context.Context, rgname string, logger log.Logger) ([]eventhub.EHNamespace, error) GetMetricValues(ctx context.Context, resourceURI, interval string, metricnames, aggregations []string, logger log.Logger) (map[string]insights.MetricValue, error) }
Client is the interface that provides the methods to get metrics from Azure Rest API.
type ClientSecretMap ¶
type ClientSecretMap struct { ClientID string `mapstructure:"clientID"` ClientSecret string `mapstructure:"clientSecret"` TenantID string `mapstructure:"tenantID"` SubscriptionID string `mapstructure:"subscriptionID"` EnvironmentName string }
ClientSecretMap is a structure to decode and map kubernetes secret data values to azure client configuration.
type Compute ¶
type Compute struct { VMTypes []VMType `json:"vm_types"` ProvisionedRAMGB float64 `json:"provisioned_ram_gb"` ProvisionedVolumes ProvisionedVolume `json:"provisioned_volumes"` ProvisionedCpus uint32 `json:"provisioned_cpus"` }
Compute defines the event format for the compute metrics.
type DefaultAuthConfig ¶
type DefaultAuthConfig struct{}
DefaultAuthConfig implements a default AuthConfig.
func (*DefaultAuthConfig) GetAuthConfig ¶
func (a *DefaultAuthConfig) GetAuthConfig(clientID, clientSecret, tenantID, envName string) (autorest.Authorizer, azure.Environment, error)
type EventData ¶
type EventData struct { ResourceGroups []string `json:"resource_groups"` Compute *Compute `json:"compute"` Networking *Networking `json:"networking"` EventHub *EventHub `json:"event_hub"` }
EventData defines the event information to send to EDP.
type EventHub ¶
type EventHub struct { NumberNamespaces uint32 `json:"number_namespaces"` IncomingRequestsPT1M float64 `json:"incoming_requests_pt1m"` MaxIncomingBytesPT1M float64 `json:"max_incoming_bytes_pt1m"` MaxOutgoingBytesPT1M float64 `json:"max_outgoing_bytes_pt1m"` IncomingRequestsPT5M float64 `json:"incoming_requests_pt5m"` MaxIncomingBytesPT5M float64 `json:"max_incoming_bytes_pt5m"` MaxOutgoingBytesPT5M float64 `json:"max_outgoing_bytes_pt5m"` }
EventHub defines the event format for the event hub metrics.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is an instance of a cluster with its client configuration.
type Networking ¶
type Networking struct { ProvisionedLoadBalancers uint32 `json:"provisioned_loadbalancers"` ProvisionedVnets uint32 `json:"provisioned_vnets"` ProvisionedIps uint32 `json:"provisioned_ips"` }
Networking defines the event format for the network metrics.
type ProvisionedVolume ¶
type ProvisionedVolume struct { SizeGBTotal uint32 `json:"size_gb_total"` SizeGBRounded uint32 `json:"size_gb_rounded"` Count uint32 `json:"count"` }
ProvisionedVolume defines the event format for the volume metrics.
type ResponseError ¶
type ResponseError struct { Error struct { Code string `json:"code"` Message string `json:"message"` } `json:"error"` }
ResponseError represent the error message structure return by Azure REST API.