aws

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateToEks

func AuthenticateToEks(clusterName string, clusterUrl string, roleArn string, session *session.Session) (*kubernetes.Clientset, error)

func CloudformationSession

func CloudformationSession(sess session.Session, region string) *cloudformation.CloudFormation

func CreateSession

func CreateSession(region string) *session.Session

func CreateSessionWithoutRegion

func CreateSessionWithoutRegion() (*session.Session, error)

func DeleteDetachedPolicies

func DeleteDetachedPolicies(sessions *AWSSessions, dryRun bool)

func DeleteExpiredBuckets

func DeleteExpiredBuckets(sessions AWSSessions, options AwsOptions)

func DeleteExpiredClusterSnapshots

func DeleteExpiredClusterSnapshots(sessions AWSSessions, options AwsOptions)

func DeleteExpiredCompleteRDSParameterGroups

func DeleteExpiredCompleteRDSParameterGroups(sessions AWSSessions, options AwsOptions)

func DeleteExpiredDocumentDBClusters

func DeleteExpiredDocumentDBClusters(sessions AWSSessions, options AwsOptions)

func DeleteExpiredEC2Instances

func DeleteExpiredEC2Instances(sessions AWSSessions, options AwsOptions)

func DeleteExpiredEKSClusters

func DeleteExpiredEKSClusters(sessions AWSSessions, options AwsOptions)

func DeleteExpiredElasticIps

func DeleteExpiredElasticIps(sessions AWSSessions, options AwsOptions)

func DeleteExpiredElasticacheDatabases

func DeleteExpiredElasticacheDatabases(sessions AWSSessions, options AwsOptions)

func DeleteExpiredElasticacheSnapshots added in v0.13.27

func DeleteExpiredElasticacheSnapshots(sessions AWSSessions, options AwsOptions)

func DeleteExpiredIAM

func DeleteExpiredIAM(sessions *AWSSessions, options *AwsOptions)

func DeleteExpiredInstanceProfiles

func DeleteExpiredInstanceProfiles(sessions *AWSSessions, options *AwsOptions)

func DeleteExpiredKeyPairs

func DeleteExpiredKeyPairs(sessions AWSSessions, options AwsOptions)

func DeleteExpiredKeys

func DeleteExpiredKeys(sessions AWSSessions, options AwsOptions)

func DeleteExpiredLambdaFunctions

func DeleteExpiredLambdaFunctions(sessions AWSSessions, options AwsOptions)

func DeleteExpiredLoadBalancers

func DeleteExpiredLoadBalancers(sessions AWSSessions, options AwsOptions)

func DeleteExpiredLogs

func DeleteExpiredLogs(sessions AWSSessions, options AwsOptions)

func DeleteExpiredNatGateways

func DeleteExpiredNatGateways(sessions AWSSessions, options AwsOptions)

func DeleteExpiredOpenIDConnectProviders

func DeleteExpiredOpenIDConnectProviders(sessions *AWSSessions, options *AwsOptions)

func DeleteExpiredRDSDatabases

func DeleteExpiredRDSDatabases(sessions AWSSessions, options AwsOptions)

func DeleteExpiredRDSSubnetGroups

func DeleteExpiredRDSSubnetGroups(sessions AWSSessions, options AwsOptions)

func DeleteExpiredRepositories

func DeleteExpiredRepositories(sessions AWSSessions, options AwsOptions)

func DeleteExpiredRoles

func DeleteExpiredRoles(sessions *AWSSessions, options *AwsOptions)

func DeleteExpiredSQSQueues

func DeleteExpiredSQSQueues(sessions AWSSessions, options AwsOptions)

func DeleteExpiredSnapshots

func DeleteExpiredSnapshots(sessions AWSSessions, options AwsOptions)

func DeleteExpiredStacks

func DeleteExpiredStacks(sessions AWSSessions, options AwsOptions)

func DeleteExpiredStateMachines

func DeleteExpiredStateMachines(sessions AWSSessions, options AwsOptions)

func DeleteExpiredUsers

func DeleteExpiredUsers(sessions *AWSSessions, options *AwsOptions)

func DeleteExpiredVPC

func DeleteExpiredVPC(sessions AWSSessions, options AwsOptions)

func DeleteExpiredVolumes

func DeleteExpiredVolumes(sessions AWSSessions, options AwsOptions)

func DeleteGroups

func DeleteGroups(iamSession *iam.IAM, dryRun bool)

func DeleteInternetGatewaysByIds

func DeleteInternetGatewaysByIds(ec2Session *ec2.EC2, internetGateways []InternetGateway, vpcId string)

func DeleteLoadBalancerByVpcId

func DeleteLoadBalancerByVpcId(lbSession *elbv2.ELBV2, vpc VpcInfo, dryRun bool)

func DeleteNatGatewaysByIds

func DeleteNatGatewaysByIds(ec2Session *ec2.EC2, natGateways []NatGateway)

func DeleteNetworkInterfacesByVpcId

func DeleteNetworkInterfacesByVpcId(ec2Session *ec2.EC2, vpcId string)

func DeleteRDSDatabase

func DeleteRDSDatabase(svc rds.RDS, database rdsDatabase)

func DeleteRDSSubnetGroup

func DeleteRDSSubnetGroup(svc rds.RDS, dbSubnetGroupName string)

func DeleteRouteTablesByIds

func DeleteRouteTablesByIds(ec2Session *ec2.EC2, routeTables []RouteTable)

func DeleteSecurityGroupsByIds

func DeleteSecurityGroupsByIds(ec2Session *ec2.EC2, securityGroups []SecurityGroup)

func DeleteSubnetsByIds

func DeleteSubnetsByIds(ec2Session *ec2.EC2, subnets []Subnet)

func DeleteUnlinkedECSubnetGroups

func DeleteUnlinkedECSubnetGroups(sessions AWSSessions, options AwsOptions)

func DeleteUnlinkedLogs

func DeleteUnlinkedLogs(sessions AWSSessions, options AwsOptions)

func DeleteVPCLinkedResourcesWithQuota

func DeleteVPCLinkedResourcesWithQuota(sessions AWSSessions, options AwsOptions)

DeleteVPCLinkedResourcesWithQuota is used to delete some resources linked to a vpc without deleting the vpc itself. This will avoid quota issues on some resources

func ElasticacheSession

func ElasticacheSession(sess session.Session, region string) *elasticache.ElastiCache

func GetAllVPCs

func GetAllVPCs(ec2Session *ec2.EC2) []*ec2.Vpc

func GetClusterDetails

func GetClusterDetails(svc eks.EKS, cluster *string, region string, tagName string) eksCluster

func GetRDSInstanceInfos

func GetRDSInstanceInfos(svc rds.RDS, databaseIdentifier string) (rdsDatabase, error)

func GetVpcsIdsByClusterNameTag

func GetVpcsIdsByClusterNameTag(ec2Session ec2.EC2, clusterName string) []*string

func HandleRolePolicies

func HandleRolePolicies(iamSession *iam.IAM, roleName string)

func HandleUserPolicies

func HandleUserPolicies(iamSession *iam.IAM, userName string)

func LambdaSession

func LambdaSession(sess session.Session, region string) *lambda.Lambda

func ListClusters

func ListClusters(svc eks.EKS) ([]*string, error)

func ListTaggedEKSClusters

func ListTaggedEKSClusters(svc eks.EKS, options *AwsOptions) ([]eksCluster, error)

func RdsSession

func RdsSession(sess session.Session, region string) *rds.RDS

func ReleaseElasticIps

func ReleaseElasticIps(ec2Session *ec2.EC2, eips []ElasticIp)

func RunPlecoAWS

func RunPlecoAWS(cmd *cobra.Command, regions []string, interval int64, wg *sync.WaitGroup, options AwsOptions)

func SqsSession

func SqsSession(sess session.Session, region string) *sqs.SQS

func TagLoadBalancersForDeletion

func TagLoadBalancersForDeletion(lbSession *elbv2.ELBV2, tagKey string, loadBalancersList []ElasticLoadBalancer, clusterName string) error

func TagLogsForDeletion

func TagLogsForDeletion(svc *cloudwatchlogs.CloudWatchLogs, tagName string, clusterId string, TTL int64) error

func TagVolumesFromEksClusterForDeletion

func TagVolumesFromEksClusterForDeletion(ec2Session *ec2.EC2, tagKey string, clusterName string) error

Types

type AWSSessions

type AWSSessions struct {
	RDS            *rds.RDS
	ElastiCache    *elasticache.ElastiCache
	EKS            *eks.EKS
	ELB            *elbv2.ELBV2
	EC2            *ec2.EC2
	S3             *s3.S3
	CloudWatchLogs *cloudwatchlogs.CloudWatchLogs
	KMS            *kms.KMS
	IAM            *iam.IAM
	ECR            *ecr.ECR
	SQS            *sqs.SQS
	LambdaFunction *lambda.Lambda
	SFN            *sfn.SFN
	CloudFormation *cloudformation.CloudFormation
}

type AwsOptions

type AwsOptions struct {
	TagName              string
	TagValue             string
	DisableTTLCheck      bool
	IsDestroyingCommand  bool
	DryRun               bool
	EnableRDS            bool
	EnableElastiCache    bool
	EnableEKS            bool
	EnableELB            bool
	EnableEBS            bool
	EnableVPC            bool
	EnableS3             bool
	EnableCloudWatchLogs bool
	EnableKMS            bool
	EnableIAM            bool
	EnableSSH            bool
	EnableDocumentDB     bool
	EnableECR            bool
	EnableSQS            bool
	EnableLambda         bool
	EnableSFN            bool
	EnableCloudFormation bool
	EnableEC2Instance    bool
}

type CloudformationStack

type CloudformationStack struct {
	common.CloudProviderResource
}

type CompleteKey

type CompleteKey struct {
	common.CloudProviderResource
	Status     string
	KeyManager string
}

type CompleteLogGroup

type CompleteLogGroup struct {
	common.CloudProviderResource
	// contains filtered or unexported fields
}

type EBSVolume

type EBSVolume struct {
	common.CloudProviderResource
	Status string
}

type EC2Instance

type EC2Instance struct {
	common.CloudProviderResource
}

type ElasticIp

type ElasticIp struct {
	common.CloudProviderResource
	AssociationId string
	Ip            string
}

func GetElasticIpsByVpcId

func GetElasticIpsByVpcId(ec2Session *ec2.EC2, vpc VpcInfo, tagName string) []ElasticIp

type ElasticLoadBalancer

type ElasticLoadBalancer struct {
	common.CloudProviderResource
	Arn       string
	Status    string
	VpcId     string
	Tags      []*elbv2.Tag
	PublicIps []string
}

func ListExpiredLoadBalancers

func ListExpiredLoadBalancers(eksSession *eks.EKS, lbSession *elbv2.ELBV2, options *AwsOptions) ([]ElasticLoadBalancer, error)

func ListLoadBalancers

func ListLoadBalancers(lbSession *elbv2.ELBV2, tagName string) ([]ElasticLoadBalancer, error)

type InstanceProfile

type InstanceProfile struct {
	common.CloudProviderResource
	InstanceProfileName string
	Roles               []*iam.Role
}

type InternetGateway

type InternetGateway struct {
	Id           string
	CreationDate time.Time

	IsProtected bool
	// contains filtered or unexported fields
}

func GetInternetGatewaysIdsByVpcId

func GetInternetGatewaysIdsByVpcId(ec2Session *ec2.EC2, vpcId string, tagName string) []InternetGateway

type KeyPair

type KeyPair struct {
	common.CloudProviderResource
	KeyName string
}

type NatGateway

type NatGateway struct {
	common.CloudProviderResource
}

func GetNatGatewaysIdsByVpcId

func GetNatGatewaysIdsByVpcId(ec2Session *ec2.EC2, options *AwsOptions, vpcId string) []NatGateway

type NetworkInterface

type NetworkInterface struct {
	Id           string
	VpcId        string
	AttachmentId string
}

func GetNetworkInterfacesByVpcId

func GetNetworkInterfacesByVpcId(ec2Session *ec2.EC2, vpcId string) []NetworkInterface

type OpenIDConnectProvider

type OpenIDConnectProvider struct {
	common.CloudProviderResource
	OpenIDConnectProviderName string
}

type Policy

type Policy struct {
	Name string
	Arn  string
}

type RDSParameterGroups

type RDSParameterGroups struct {
	common.CloudProviderResource
	ID string
}

type RDSSubnetGroup

type RDSSubnetGroup struct {
	common.CloudProviderResource
	ID string
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

type Role

type Role struct {
	common.CloudProviderResource
	InstanceProfile []*iam.InstanceProfile
}

type RouteTable

type RouteTable struct {
	Id           string
	CreationDate time.Time

	Associations []*ec2.RouteTableAssociation
	IsProtected  bool
	// contains filtered or unexported fields
}

func GetRouteTablesIdsByVpcId

func GetRouteTablesIdsByVpcId(ec2Session *ec2.EC2, vpcId string, tagName string) []RouteTable

type SecurityGroup

type SecurityGroup struct {
	Id           string
	CreationDate time.Time

	IsProtected         bool
	IpPermissionIngress []*ec2.IpPermission
	IpPermissionEgress  []*ec2.IpPermission
	// contains filtered or unexported fields
}

func GetSecurityGroupsIdsByVpcId

func GetSecurityGroupsIdsByVpcId(ec2Session *ec2.EC2, vpcId string, tagName string) []SecurityGroup

type Subnet

type Subnet struct {
	Id           string
	CreationDate time.Time

	IsProtected bool
	// contains filtered or unexported fields
}

func GetSubnetsIdsByVpcId

func GetSubnetsIdsByVpcId(ec2Session *ec2.EC2, vpcId string, tagName string) []Subnet

type User

type User struct {
	common.CloudProviderResource
}

type VpcInfo

type VpcInfo struct {
	common.CloudProviderResource
	SecurityGroups    []SecurityGroup
	NatGateways       []NatGateway
	InternetGateways  []InternetGateway
	Subnets           []Subnet
	RouteTables       []RouteTable
	ElasticIps        []ElasticIp
	NetworkInterfaces []NetworkInterface
	Status            string
}

Jump to

Keyboard shortcuts

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