Sha256: 5c55fe4a58f927a98b5cf289552d9866a099d7d0feea823962823a61b7537c2c

Contents?: true

Size: 818 Bytes

Versions: 2

Compression:

Stored size: 818 Bytes

Contents

require 'opsicle/config'

module Opsicle
  class Client
    attr_reader :opsworks
    attr_reader :s3
    attr_reader :config

    def initialize(environment)
      @config = Config.new(environment)
      @config.configure_aws!
      @opsworks = AWS::OpsWorks.new.client
      @s3 = AWS::S3.new
    end

    def run_command(command, options={})
      opsworks.create_deployment(command_options(command, options))
    end

    def api_call(command, options={})
      opsworks.public_send(command, options)
    end

    def opsworks_url
      "https://console.aws.amazon.com/opsworks/home?#/stack/#{@config.opsworks_config[:stack_id]}"
    end

    def command_options(command, options={})
      config.opsworks_config.merge(options).merge({ command: { name: command } })
    end
    private :command_options

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opsicle-0.4.2 lib/opsicle/client.rb
opsicle-0.4.0 lib/opsicle/client.rb