Class: Awsclean::AwsCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/awsclean/aws_command.rb

Direct Known Subclasses

AmiClean, EcrClean

Class Method Summary collapse

Class Method Details

.filter_regions(regions) ⇒ Object


15
16
17
18
19
20
21
22
23
24
# File 'lib/awsclean/aws_command.rb', line 15

def filter_regions(regions)
  supported = supported_regions

  if regions.first == "all"
    supported_regions
  else
    # TODO: throw something if region not available
    regions.select { |r| supported.include? r }
  end
end

.supported_regionsObject


9
10
11
12
13
# File 'lib/awsclean/aws_command.rb', line 9

def supported_regions
  Aws.partition('aws').regions
    .select { |region| region.services.include?(self.const_get(:SERVICE_IDENTIFIER)) }
    .map(&:name)
end