Class: EY::CloudClient::Deployment
- Inherits:
-
Object
- Object
- EY::CloudClient::Deployment
- Defined in:
- lib/engineyard-cloud-client/models/deployment.rb
Class Method Summary collapse
- .api_root(app_id, environment_id) ⇒ Object
- .get(api, app_environment, id) ⇒ Object
- .last(api, app_environment) ⇒ Object
- .load_from_response(api, app_environment, response) ⇒ Object
Instance Method Summary collapse
- #app ⇒ Object
- #config ⇒ Object
- #created_at ⇒ Object
- #environment ⇒ Object
- #err ⇒ Object
- #finished ⇒ Object
- #finished? ⇒ Boolean
- #finished_at ⇒ Object
- #migrate ⇒ Object (also: #migrate?)
- #out ⇒ Object
- #output ⇒ Object
- #start ⇒ Object
- #update_with_response(response) ⇒ Object
Class Method Details
.api_root(app_id, environment_id) ⇒ Object
7 8 9 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 7 def self.api_root(app_id, environment_id) "/apps/#{app_id}/environments/#{environment_id}/deployments" end |
.get(api, app_environment, id) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 15 def self.get(api, app_environment, id) uri = api_root(app_environment.app.id, app_environment.environment.id) + "/#{id}" response = api.get(uri) load_from_response api, app_environment, response rescue EY::CloudClient::ResourceNotFound nil end |
.last(api, app_environment) ⇒ Object
11 12 13 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 11 def self.last(api, app_environment) get(api, app_environment, 'last') end |
.load_from_response(api, app_environment, response) ⇒ Object
23 24 25 26 27 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 23 def self.load_from_response(api, app_environment, response) dep = from_hash(api, {:app_environment => app_environment}) dep.update_with_response(response) dep end |
Instance Method Details
#app ⇒ Object
29 30 31 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 29 def app app_environment.app end |
#config ⇒ Object
57 58 59 60 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 57 def config return {} unless deployed_by # not started yet so not all info is here @config ||= {'input_ref' => ref, 'deployed_by' => deployed_by}.merge(extra_config) end |
#created_at ⇒ Object
49 50 51 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 49 def created_at @created_at ||= super && Time.parse(super) end |
#environment ⇒ Object
33 34 35 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 33 def environment app_environment.environment end |
#err ⇒ Object
76 77 78 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 76 def err output end |
#finished ⇒ Object
80 81 82 83 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 80 def finished output.rewind put_to_api({:successful => successful, :output => output.read}) end |
#finished? ⇒ Boolean
85 86 87 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 85 def finished? !finished_at.nil? end |
#finished_at ⇒ Object
53 54 55 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 53 def finished_at @finished_at ||= super && Time.parse(super) end |
#migrate ⇒ Object Also known as: migrate?
37 38 39 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 37 def migrate !migrate_command.nil? && !migrate_command.to_s.empty? end |
#out ⇒ Object
72 73 74 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 72 def out output end |
#output ⇒ Object
68 69 70 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 68 def output @output ||= StringIO.new end |
#start ⇒ Object
62 63 64 65 66 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 62 def start params = { :migrate => migrate, :ref => ref } params[:migrate_command] = migrate_command if migrate post_to_api(params) end |
#update_with_response(response) ⇒ Object
89 90 91 92 93 |
# File 'lib/engineyard-cloud-client/models/deployment.rb', line 89 def update_with_response(response) response['deployment'].each do |key,val| send("#{key}=", val) if respond_to?("#{key}=") end end |