Class: Stemcell::MetadataSource::Configuration
- Inherits:
-
Object
- Object
- Stemcell::MetadataSource::Configuration
- Defined in:
- lib/stemcell/metadata_source/configuration.rb
Instance Attribute Summary collapse
-
#all_options ⇒ Object
readonly
Returns the value of attribute all_options.
-
#availability_zones ⇒ Object
readonly
Returns the value of attribute availability_zones.
-
#backing_store_options ⇒ Object
readonly
Returns the value of attribute backing_store_options.
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#default_options ⇒ Object
readonly
Returns the value of attribute default_options.
Instance Method Summary collapse
-
#initialize(config_path) ⇒ Configuration
constructor
A new instance of Configuration.
- #options_for_backing_store(backing_store, region) ⇒ Object
- #random_az_for_region(region) ⇒ Object
Constructor Details
#initialize(config_path) ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 14 def initialize(config_path) @config_path = config_path if config_path.nil? raise ArgumentError, "You must specify a configuration file" end read_configuration validate_configutation end |
Instance Attribute Details
#all_options ⇒ Object (readonly)
Returns the value of attribute all_options.
9 10 11 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 9 def @all_options end |
#availability_zones ⇒ Object (readonly)
Returns the value of attribute availability_zones.
12 13 14 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 12 def availability_zones @availability_zones end |
#backing_store_options ⇒ Object (readonly)
Returns the value of attribute backing_store_options.
11 12 13 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 11 def @backing_store_options end |
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
7 8 9 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 7 def config_path @config_path end |
#default_options ⇒ Object (readonly)
Returns the value of attribute default_options.
10 11 12 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 10 def @default_options end |
Instance Method Details
#options_for_backing_store(backing_store, region) ⇒ Object
24 25 26 27 28 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 24 def (backing_store, region) = [backing_store] raise UnknownBackingStoreError.new(backing_store) if .nil? .fetch(region, ) end |
#random_az_for_region(region) ⇒ Object
30 31 32 |
# File 'lib/stemcell/metadata_source/configuration.rb', line 30 def random_az_for_region(region) (availability_zones[region] || []).sample end |