maintenance/aws-janitor/resources/nat_gateway.go
func (NATGateway) ListAll(sess *session.Session, acct, region string) (*Set, error) {
	svc := ec2.New(sess, &aws.Config{Region: aws.String(region)})
	set := NewSet(0)
	inp := &ec2.DescribeNatGatewaysInput{}

	err := svc.DescribeNatGatewaysPages(inp, func(page *ec2.DescribeNatGatewaysOutput, _ bool) bool {
		for _, gw := range page.NatGateways {
			now := time.Now()
			arn := natGateway{
				Account: acct,
				Region:  region,
				ID:      *gw.NatGatewayId,
			}.ARN()

			set.firstSeen[arn] = now
		}

		return true
	})

	return set, errors.Wrapf(err, "couldn't describe nat gateways for %q in %q", acct, region)
}
func (NATGateway) ListAll(sess *session.Session, acct, region string) (*Set, error) {
	svc := ec2.New(sess, &aws.Config{Region: aws.String(region)})
	set := NewSet(0)
	inp := &ec2.DescribeNatGatewaysInput{}

	err := svc.DescribeNatGatewaysPages(inp, func(page *ec2.DescribeNatGatewaysOutput, _ bool) bool {
		for _, gw := range page.NatGateways {
			now := time.Now()
			arn := natGateway{
				Account: acct,
				Region:  region,
				ID:      *gw.NatGatewayId,
			}.ARN()

			set.firstSeen[arn] = now
		}

		return true
	})

	return set, errors.Wrapf(err, "couldn't describe nat gateways for %q in %q", acct, region)
}
func ( NATGateway ) ListAll ( sess * session . Session , acct , region string ) ( * Set , error ) { svc := ec2 . New ( sess , & aws . Config { Region : aws . String ( region ) } ) set := NewSet ( 0 ) inp := & ec2 . DescribeNatGatewaysInput { } err := svc . DescribeNatGatewaysPages ( inp , func ( page * ec2 . DescribeNatGatewaysOutput , _ bool ) bool { for _ , gw := range page . NatGateways { now := time . Now ( ) arn := natGateway { Account : acct , Region : region , ID : * gw . NatGatewayId , } . ARN ( ) set . firstSeen [ arn ] = now } return true } ) return set , errors . Wrapf ( err , " " , acct , region ) }
// ListAll populates a set will all available NATGateway resources.
ListAll populates a set will all available NATGateway resources .