Sha256: 23b57821fbb4b007d6bae3804965314fa26e8250ef1ab14d8e582535363c0042

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 Bytes

Contents

require 'opsicle/config'

module Opsicle
  class Client
    attr_reader :aws_client
    attr_reader :config

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

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

    def api_call(command, options={})
      aws_client.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.3.1 lib/opsicle/client.rb
opsicle-0.3.0 lib/opsicle/client.rb