Documentation
¶
Overview ¶
Package servicequotas implements logic for retrieving quotas for specific AWS services
Index ¶
- Variables
- func ToPrometheusNamingFormat(s string) string
- type ASGUsageCheck
- type AvailableIpsPerSubnetUsageCheck
- type LambdaConcurrentExecutionsLimitCheck
- type QuotaUsage
- type QuotasInterface
- type RulesPerSecurityGroupUsageCheck
- type RunningOnDemandStandardInstancesUsageCheck
- type SecurityGroupsPerENIUsageCheck
- type SecurityGroupsPerRegionUsageCheck
- type ServiceQuotas
- type StandardSpotInstanceRequestsUsageCheck
- type UsageCheck
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidRegion = errors.New("invalid region") ErrFailedToListQuotas = errors.New("failed to list quotas") ErrFailedToGetUsage = errors.New("failed to get usage") ErrFailedToConvertCidr = errors.New("failed to convert CIDR block from string to int") )
Errors returned from this package
Functions ¶
func ToPrometheusNamingFormat ¶
ToPrometheusNamingFormat modifies string `s` to conform with the Prom naming conventions
Types ¶
type ASGUsageCheck ¶
type ASGUsageCheck struct {
// contains filtered or unexported fields
}
ASGUsageCheck implements the UsageCheckInterface for VMs per autoscaling group
func (*ASGUsageCheck) Usage ¶
func (c *ASGUsageCheck) Usage() ([]QuotaUsage, error)
Usage returns usage per auto scaling group - the maximum number of instances per ASG and the current number of "running" instances per ASG.
type AvailableIpsPerSubnetUsageCheck ¶
type AvailableIpsPerSubnetUsageCheck struct {
// contains filtered or unexported fields
}
AvailableIpsPerSubnetUsageCheck implements the UsageCheckInterface for available IPs per subnet
func (*AvailableIpsPerSubnetUsageCheck) Usage ¶
func (c *AvailableIpsPerSubnetUsageCheck) Usage() ([]QuotaUsage, error)
Usage returns the usage for each subnet ID with the usage value being the number of available IPv4 addresses in that subnet or an error Note that the Description of the resource here is constructed using `availableIPsPerSubnetDesc` defined previously as well as the subnet's CIDR block
type LambdaConcurrentExecutionsLimitCheck ¶ added in v1.4.0
type LambdaConcurrentExecutionsLimitCheck struct {
// contains filtered or unexported fields
}
LambdaConcurrentExecutionsLimitCheck implements the UsageCheck interface for limits for lambda functions
func (*LambdaConcurrentExecutionsLimitCheck) Usage ¶ added in v1.4.0
func (c *LambdaConcurrentExecutionsLimitCheck) Usage() ([]QuotaUsage, error)
Usage returns the usage and quouta for the lambda concurrent executions and lambda code size unzipped limits
type QuotaUsage ¶
type QuotaUsage struct { // Name is the name of the quota (eg. spot_instance_requests) // or the name given to the piece of exported availibility // information (eg. available_IPs_per_subnet) Name string // ResourceName is the name of the resource in case the quota // is for multiple resources. As an example for "rules per // security group" the ResourceName will be the ARN of the // security group. ResourceName *string // Description is the name of the service quota (eg. "Inbound // or outbound rules per security group") Description string // Usage is the current service quota usage Usage float64 // Quota is the current quota Quota float64 // Tags are the metadata associated with the resource in form of key, value pairs Tags map[string]string }
QuotaUsage represents service quota usage
func (QuotaUsage) Identifier ¶
func (q QuotaUsage) Identifier() string
Identifier for the service quota. Either the resource name in case the quota is for multiple resources or the name of the quota
type QuotasInterface ¶
type QuotasInterface interface {
QuotasAndUsage() ([]QuotaUsage, error)
}
QuotasInterface is an interface for retrieving AWS service quotas and usage
func NewServiceQuotas ¶
func NewServiceQuotas(region, profile string) (QuotasInterface, error)
NewServiceQuotas creates a ServiceQuotas for `region` and `profile` or returns an error. Note that the ServiceQuotas will only return usage and quotas for the service quotas with implemented usage checks
type RulesPerSecurityGroupUsageCheck ¶
type RulesPerSecurityGroupUsageCheck struct {
// contains filtered or unexported fields
}
RulesPerSecurityGroupUsageCheck implements the UsageCheck interface for rules per security group
func (*RulesPerSecurityGroupUsageCheck) Usage ¶
func (c *RulesPerSecurityGroupUsageCheck) Usage() ([]QuotaUsage, error)
Usage returns the usage for each security group ID with the usage value being the sum of their inbound and outbound rules or an error
type RunningOnDemandStandardInstancesUsageCheck ¶
type RunningOnDemandStandardInstancesUsageCheck struct {
// contains filtered or unexported fields
}
RunningOnDemandStandardInstancesUsageCheck implements the UsageCheck interface for standard on-demand instances
func (*RunningOnDemandStandardInstancesUsageCheck) Usage ¶
func (c *RunningOnDemandStandardInstancesUsageCheck) Usage() ([]QuotaUsage, error)
Usage returns vCPU usage for all running on-demand standard (A, C, D, H, I, M, R, T, Z) instances or an error vCPUs are returned instead of the number of images due to the service quota reporting the number of vCPUs https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-limits.html
type SecurityGroupsPerENIUsageCheck ¶
type SecurityGroupsPerENIUsageCheck struct {
// contains filtered or unexported fields
}
SecurityGroupsPerENIUsageCheck implements the UsageCheck interface for security groups per ENI
func (*SecurityGroupsPerENIUsageCheck) Usage ¶
func (c *SecurityGroupsPerENIUsageCheck) Usage() ([]QuotaUsage, error)
Usage returns usage for each Elastic Network Interface ID with the usage value being the number of security groups for each ENI or an error
type SecurityGroupsPerRegionUsageCheck ¶
type SecurityGroupsPerRegionUsageCheck struct {
// contains filtered or unexported fields
}
SecurityGroupsPerRegionUsageCheck implements the UsageCheck interface for security groups per region
func (*SecurityGroupsPerRegionUsageCheck) Usage ¶
func (c *SecurityGroupsPerRegionUsageCheck) Usage() ([]QuotaUsage, error)
Usage returns usage for security groups per region as the number of all security groups for the region specified with `cfgs` or an error
type ServiceQuotas ¶
type ServiceQuotas struct {
// contains filtered or unexported fields
}
ServiceQuotas is an implementation for retrieving service quotas and their limits
func (*ServiceQuotas) QuotasAndUsage ¶
func (s *ServiceQuotas) QuotasAndUsage() ([]QuotaUsage, error)
QuotasAndUsage returns a slice of `QuotaUsage` or an error
type StandardSpotInstanceRequestsUsageCheck ¶
type StandardSpotInstanceRequestsUsageCheck struct {
// contains filtered or unexported fields
}
StandardSpotInstanceRequestsUsageCheck implements the UsageCheck interface for standard spot instance requests
func (*StandardSpotInstanceRequestsUsageCheck) Usage ¶
func (c *StandardSpotInstanceRequestsUsageCheck) Usage() ([]QuotaUsage, error)
Usage returns vCPU usage for all standard (A, C, D, H, I, M, R, T, Z) spot instance requests and usage or an error vCPUs are returned instead of the number of images due to the service quota reporting the number of vCPUs https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-limits.html
type UsageCheck ¶
type UsageCheck interface { // Usage returns slice of QuotaUsage or an error Usage() ([]QuotaUsage, error) }
UsageCheck is an interface for retrieving service quota usage