Sha256: 9356082dc7d1839f8d4fa51fdc560ff9e2faf2dcf8edd01282c9be75fced9a70
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'aws/with-stacco-patches' require 'yaml' require 'stacco/base' class Stacco::Orchestrator def self.from_config(config_body) config_body = config_body.read if config_body.respond_to?(:read) self.new YAML.load(config_body) end 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 def stacks @bucket.objects.with_prefix('stack/').to_a[1..-1].map{ |obj| Stacco::Stack.new(obj) } end 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stacco-0.1.17 | ./lib/stacco/orchestrator.rb |