class Dumbwaiter::Deployment
Attributes
opsworks[R]
opsworks_deployment[R]
stack[R]
Public Class Methods
all(stack, opsworks = Aws::OpsWorks::Client.new(region: "us-east-1"))
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 7 def self.all(stack, opsworks = Aws::OpsWorks::Client.new(region: "us-east-1")) opsworks.describe_deployments(stack_id: stack.id).deployments.map { |d| new(stack, d, opsworks) } end
new(stack, opsworks_deployment, opsworks = Aws::OpsWorks::Client.new(region: "us-east-1"))
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 11 def initialize(stack, opsworks_deployment, opsworks = Aws::OpsWorks::Client.new(region: "us-east-1")) @stack = stack @opsworks_deployment = opsworks_deployment @opsworks = opsworks end
Public Instance Methods
command_name()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 21 def command_name opsworks_deployment.command.name end
comment()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 25 def comment opsworks_deployment.comment end
created_at()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 17 def created_at DateTime.parse(opsworks_deployment.created_at) end
revision()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 41 def revision deployment_custom_json.revision || "#{app.revision}@{#{created_at}}" end
status()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 29 def status opsworks_deployment.status end
to_log()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 45 def to_log if command_name == "deploy" "#{created_at} - #{user_name} - #{command_name} - #{status} - #{revision}" else "#{created_at} - #{user_name} - #{command_name} - #{status}" end end
user_name()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 33 def user_name if user_profile.nil? "OpsWorks" else user_profile.name end end
Protected Instance Methods
app()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 55 def app Dumbwaiter::App.find_by_id(stack, opsworks_deployment.app_id, opsworks) end
custom_json()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 67 def custom_json opsworks_deployment.custom_json || "{}" end
deployment_custom_json()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 63 def deployment_custom_json Dumbwaiter::DeploymentCustomJson.from_json(custom_json) end
user_profile()
click to toggle source
# File lib/dumbwaiter/deployment.rb, line 59 def user_profile Dumbwaiter::UserProfile.find(opsworks_deployment.iam_user_arn, opsworks) end