Sha256: 781b33726473e4675b90ff189d8e74184cebf7f1ceaeaa1678eca31b6670d5f8

Contents?: true

Size: 1.16 KB

Versions: 62

Compression:

Stored size: 1.16 KB

Contents

module Opsicle
  class Deployment

    def initialize(deployment_id, client)
      @deployment_id = deployment_id
      @client = client
    end

    def deployment_id
      deployment[:deployment_id]
    end

    def stack_id
      deployment[:stack_id]
    end

    def app_id
      deployment[:app_id]
    end

    def created_at
      deployment[:created_at]
    end

    def completed_at
      deployment(reload: true)[:completed_at]
    end

    def duration
      deployment(reload: true)[:duration]
    end

    def command
      deployment[:command]
    end

    def status
      deployment(reload: true)[:status]
    end

    def instance_ids
      deployment[:instance_ids]
    end

    %w(running successful failed).each do |status_name|
      define_method("#{status_name}?") { status == status_name }
    end

    def deployment(options={})
      # Only call the API again if you need to
      @deployment = nil if options[:reload]
      @deployment ||= @client.api_call('describe_deployments',
                                       :deployment_ids => [@deployment_id]
                                      )[:deployments].first
    end
    private :deployment

  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
opsicle-2.15.0 lib/opsicle/deployment.rb
opsicle-2.14.2 lib/opsicle/deployment.rb
opsicle-2.14.1 lib/opsicle/deployment.rb
opsicle-2.14.0 lib/opsicle/deployment.rb
opsicle-2.13.1 lib/opsicle/deployment.rb
opsicle-2.13.0 lib/opsicle/deployment.rb
opsicle-2.12.5 lib/opsicle/deployment.rb
opsicle-2.12.3 lib/opsicle/deployment.rb
opsicle-2.12.2 lib/opsicle/deployment.rb
opsicle-2.12.1 lib/opsicle/deployment.rb
opsicle-2.12.0 lib/opsicle/deployment.rb
opsicle-2.11.3 lib/opsicle/deployment.rb
opsicle-2.11.1 lib/opsicle/deployment.rb
opsicle-2.11.0 lib/opsicle/deployment.rb
opsicle-2.10.1 lib/opsicle/deployment.rb
opsicle-2.10.0 lib/opsicle/deployment.rb
opsicle-2.9.6 lib/opsicle/deployment.rb
opsicle-2.9.4 lib/opsicle/deployment.rb
opsicle-2.9.3 lib/opsicle/deployment.rb
opsicle-2.9.2 lib/opsicle/deployment.rb