Class: Stacco::Orchestrator
- Inherits:
-
Object
- Object
- Stacco::Orchestrator
- Defined in:
- lib/stacco.rb
Class Method Summary collapse
Instance Method Summary collapse
- #define_stack(config_body) ⇒ Object
-
#initialize(config) ⇒ Orchestrator
constructor
A new instance of Orchestrator.
- #stacks ⇒ Object
Constructor Details
#initialize(config) ⇒ Orchestrator
Returns a new instance of Orchestrator.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/stacco.rb', line 151 def initialize(config) @config = config storage_bucket_name = @config['storage_bucket'] s3 = AWS::S3.new( access_key_id: @config['aws']['access_key_id'], secret_access_key: @config['aws']['secret_access_key'], region: @config['aws']['region'] ) @bucket = s3.buckets[storage_bucket_name] s3.buckets.create(storage_bucket_name) unless @bucket.exists? end |
Class Method Details
.from_config(config_body) ⇒ Object
146 147 148 149 |
# File 'lib/stacco.rb', line 146 def self.from_config(config_body) config_body = config_body.read if config_body.respond_to?(:read) self.new YAML.load(config_body) end |
Instance Method Details
#define_stack(config_body) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/stacco.rb', line 170 def define_stack(config_body) config_body = config_body.read if config_body.respond_to?(:read) config = YAML.load(config_body) stack_name = config['name'] stack_object = @bucket.objects["stack/#{stack_name}"] stack_object.write(config.to_yaml) Stacco::Stack.new(stack_object) end |