Sha256: 6ba0a7e1c9b13ec3298768bdf271118ee8017959862bd34c11d9b176c2c1a0dc

Contents?: true

Size: 973 Bytes

Versions: 18

Compression:

Stored size: 973 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, command_args={}, options={})
      opts = command_options(command, command_args, options)
      Output.say_verbose "OpsWorks call: create_deployment(#{opts})"
      opsworks.create_deployment(opts)
    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, command_args={}, options={})
      config.opsworks_config.merge(options).merge({ command: { name: command, args: command_args } })
    end
    private :command_options

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
opsicle-0.18.0 lib/opsicle/client.rb
opsicle-0.16.0 lib/opsicle/client.rb
opsicle-0.15.0 lib/opsicle/client.rb
opsicle-0.14.0 lib/opsicle/client.rb
opsicle-0.13.1 lib/opsicle/client.rb
opsicle-0.13.0 lib/opsicle/client.rb
opsicle-0.12.0 lib/opsicle/client.rb
opsicle-0.11.0 lib/opsicle/client.rb
opsicle-0.10.0 lib/opsicle/client.rb
opsicle-0.9.0 lib/opsicle/client.rb
opsicle-0.8.2 lib/opsicle/client.rb
opsicle-0.8.1 lib/opsicle/client.rb
opsicle-0.8.0 lib/opsicle/client.rb
opsicle-0.7.1 lib/opsicle/client.rb
opsicle-0.7.0 lib/opsicle/client.rb
opsicle-0.6.0 lib/opsicle/client.rb
opsicle-0.5.1 lib/opsicle/client.rb
opsicle-0.5.0 lib/opsicle/client.rb