services

package
v0.0.0-...-baef6ec Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitializeConfig = initializeConfig

Functions

func GiBtoTiB

func GiBtoTiB(gib float64) (ret float64)

Types

type AWSQuotaInfo

type AWSQuotaInfo struct {
	Service    string  // service the quota applies to
	Region     string  // the region this quota applies to
	ResourceId string  // if there can be multiple usages for one quota, aws id (Cloudformation format)
	QuotaName  string  // the name of the quota
	Quotacode  string  // servicequota code
	QuotaValue float64 // the quota value
	UsageValue float64 // the usage value
	Unit       string  // unit of the quota/usage
	Global     bool    // whether the quota is global or not
}

func IamSummaryToAWSQuotaInfo

func IamSummaryToAWSQuotaInfo(summaryName string, quotaName string) (ret AWSQuotaInfo, err error)

type AWSQuotaOverride

type AWSQuotaOverride struct {
	Service    string  // service the quota applies to
	QuotaName  string  // the name of the quota
	QuotaValue float64 // the quota value
}

type AcmClientInterface

type AcmClientInterface interface {
	ListCertificatesPages(input *acm.ListCertificatesInput, fn func(*acm.ListCertificatesOutput, bool) bool) error
}

type AutoscalingClientInterface

type AutoscalingClientInterface interface {
	DescribeAccountLimits(input *autoscaling.DescribeAccountLimitsInput) (*autoscaling.DescribeAccountLimitsOutput, error)
}

type CloudformationClientInterface

type CloudformationClientInterface interface {
	ListStacksPages(input *cloudformation.ListStacksInput, fn func(*cloudformation.ListStacksOutput, bool) bool) error
}

type Config

type Config struct {
	Session        *session.Session
	Acm            AcmClientInterface
	Autoscaling    AutoscalingClientInterface
	Cloudformation CloudformationClientInterface
	DynamoDb       DynamodbClientInterface
	Ec2            Ec2ClientInterface
	Eks            EksClientInterface
	ElastiCache    ElastiCacheClientInterface
	Elb            ElbClientInterface   // for classic load balancers
	Elbv2          Elbv2ClientInterface // for ALB, NLB load balancers
	Iam            IamClientInterface
	Kinesis        KinesisClientInterface
	Rds            RdsClientInterface
	S3             S3ClientInterface
	ServiceQuotas  SvcQuotaClientInterface
	Sns            SnsClientInterface
}

type DynamodbClientInterface

type DynamodbClientInterface interface {
	ListTablesPages(input *dynamodb.ListTablesInput, fn func(*dynamodb.ListTablesOutput, bool) bool) error
}

type Ec2ClientInterface

type Ec2ClientInterface interface {
	DescribeSnapshotsPages(input *ec2.DescribeSnapshotsInput, fn func(*ec2.DescribeSnapshotsOutput, bool) bool) error
	DescribeVolumesPages(input *ec2.DescribeVolumesInput, fn func(*ec2.DescribeVolumesOutput, bool) bool) error
}

type EksClientInterface

type EksClientInterface interface {
	ListClustersPages(input *eks.ListClustersInput, fn func(*eks.ListClustersOutput, bool) bool) error
	ListNodegroupsPages(input *eks.ListNodegroupsInput, fn func(*eks.ListNodegroupsOutput, bool) bool) error
}

type ElastiCacheClientInterface

type ElastiCacheClientInterface interface {
	DescribeCacheClustersPages(input *elasticache.DescribeCacheClustersInput, fn func(*elasticache.DescribeCacheClustersOutput, bool) bool) error
}

type ElbClientInterface

type ElbClientInterface interface {
	DescribeAccountLimits(input *elb.DescribeAccountLimitsInput) (*elb.DescribeAccountLimitsOutput, error)
	DescribeLoadBalancersPages(input *elb.DescribeLoadBalancersInput, fn func(*elb.DescribeLoadBalancersOutput, bool) bool) error
}

type Elbv2ClientInterface

type Elbv2ClientInterface interface {
	DescribeAccountLimits(input *elbv2.DescribeAccountLimitsInput) (*elbv2.DescribeAccountLimitsOutput, error)
	DescribeLoadBalancersPages(input *elbv2.DescribeLoadBalancersInput, fn func(*elbv2.DescribeLoadBalancersOutput, bool) bool) error
}

type IamClientInterface

type IamClientInterface interface {
	GetAccountSummary(input *iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error)
}

type KinesisClientInterface

type KinesisClientInterface interface {
	DescribeLimits(input *kinesis.DescribeLimitsInput) (*kinesis.DescribeLimitsOutput, error)
}

type RdsClientInterface

type RdsClientInterface interface {
	DescribeAccountAttributes(input *rds.DescribeAccountAttributesInput) (*rds.DescribeAccountAttributesOutput, error)
}

type S3ClientInterface

type S3ClientInterface interface {
	ListBuckets(input *s3.ListBucketsInput) (*s3.ListBucketsOutput, error)
}

type ServiceChecker

type ServiceChecker struct {
	// ServiceCode is the name of the service this checker verifies
	ServiceCode string
	// Region the checker will run against
	Region string
	// the applied quotas for the service. For some quotas, only default values are available
	AppliedQuotas map[string]AWSQuotaInfo
	// the default quotas of the service
	DefaultQuotas map[string]AWSQuotaInfo
	// SupportedQuotas contains the service quota name and the func used to retrieve its usage
	SupportedQuotas map[string]func(ServiceChecker) (ret []AWSQuotaInfo)
	// Permissions required to get usage
	RequiredPermissions []string
}

func (ServiceChecker) GetAllAppliedQuotas

func (c ServiceChecker) GetAllAppliedQuotas() map[string]AWSQuotaInfo

func (ServiceChecker) GetAllDefaultQuotas

func (c ServiceChecker) GetAllDefaultQuotas() map[string]AWSQuotaInfo

func (ServiceChecker) GetRequiredPermissions

func (c ServiceChecker) GetRequiredPermissions() []string

func (ServiceChecker) GetUsage

func (c ServiceChecker) GetUsage() (ret []AWSQuotaInfo)

func (ServiceChecker) SetQuotasOverride

func (c ServiceChecker) SetQuotasOverride(quotasOverride []AWSQuotaOverride)

type SnsClientInterface

type SnsClientInterface interface {
	ListTopicsPages(input *sns.ListTopicsInput, fn func(*sns.ListTopicsOutput, bool) bool) error
	ListSubscriptionsPages(input *sns.ListSubscriptionsInput, fn func(*sns.ListSubscriptionsOutput, bool) bool) error
}

type SvcQuotaClientInterface

type SvcQuotaClientInterface interface {
	ListAWSDefaultServiceQuotasPages(*servicequotas.ListAWSDefaultServiceQuotasInput, func(*servicequotas.ListAWSDefaultServiceQuotasOutput, bool) bool) error
	ListServiceQuotasPages(input *servicequotas.ListServiceQuotasInput, fn func(*servicequotas.ListServiceQuotasOutput, bool) bool) error
}

type Svcquota

type Svcquota interface {
	// Get Usage retrieve the quotas and usage for the given service
	GetUsage() []AWSQuotaInfo

	// Retrieves all the applied quotas for the given service. For some quotas,
	// only the default values are available
	GetAllAppliedQuotas() map[string]AWSQuotaInfo

	// GetAllDefaultQuotas retrieves all the default quotas for the given
	// service. Usage of those resources are not retrieved/calculated
	GetAllDefaultQuotas() map[string]AWSQuotaInfo

	// Overrides the given quota for the service with a new value
	SetQuotasOverride(quotaOverride []AWSQuotaOverride)

	// GetRequiredPermissions returns a list of the IAM permissions required
	// to retrieve the usage for this service.
	GetRequiredPermissions() []string
}

func NewAcmChecker

func NewAcmChecker() Svcquota

func NewAutoscalingChecker

func NewAutoscalingChecker() Svcquota

func NewCloudformationChecker

func NewCloudformationChecker() Svcquota

func NewDynamoDbChecker

func NewDynamoDbChecker() Svcquota

func NewEbsChecker

func NewEbsChecker() Svcquota

func NewEksChecker

func NewEksChecker() Svcquota

func NewElastiCacheChecker

func NewElastiCacheChecker() Svcquota

func NewElbChecker

func NewElbChecker() Svcquota

func NewIamChecker

func NewIamChecker() Svcquota

func NewKinesisChecker

func NewKinesisChecker() Svcquota

func NewRdsChecker

func NewRdsChecker() Svcquota

func NewS3Checker

func NewS3Checker() Svcquota

func NewServiceChecker

func NewServiceChecker(
	serviceCode string,
	quotas map[string]func(ServiceChecker) (ret []AWSQuotaInfo),
	permissions []string,

) Svcquota

func NewSnsChecker

func NewSnsChecker() Svcquota

Jump to

Keyboard shortcuts

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