Class: Ec2::Blackout::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2-blackout/options.rb

Constant Summary collapse

DEFAULT_REGIONS =
['us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'sa-east-1']

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Options

Returns a new instance of Options



6
7
8
9
# File 'lib/ec2-blackout/options.rb', line 6

def initialize(options = {})
  @options = options
  @options[:regions] = DEFAULT_REGIONS unless @options[:regions]
end

Instance Method Details

#dry_runObject



33
34
35
# File 'lib/ec2-blackout/options.rb', line 33

def dry_run
  @options[:dry_run]
end

#exclude_tagsObject



15
16
17
# File 'lib/ec2-blackout/options.rb', line 15

def exclude_tags
  @exclude_tags ||= key_value_hash(@options[:exclude_by_tag])
end

#forceObject



37
38
39
# File 'lib/ec2-blackout/options.rb', line 37

def force
  @options[:force]
end

#include_tagsObject



11
12
13
# File 'lib/ec2-blackout/options.rb', line 11

def include_tags
  @include_tags ||= key_value_hash(@options[:include_by_tag])
end

#matches_exclude_tags?(tags) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/ec2-blackout/options.rb', line 24

def matches_exclude_tags?(tags)
  return false unless exclude_tags
  matches_tags?(exclude_tags, tags)
end

#matches_include_tags?(tags) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/ec2-blackout/options.rb', line 19

def matches_include_tags?(tags)
  return true unless include_tags
  matches_tags?(include_tags, tags)
end

#regionsObject



29
30
31
# File 'lib/ec2-blackout/options.rb', line 29

def regions
  @options[:regions]
end