Class: Marathon::Deployment
Overview
This class represents a Marathon Deployment. See mesosphere.github.io/marathon/docs/rest-api.html#deployments for full list of API’s methods.
Constant Summary collapse
- ACCESSORS =
%w[ id affectedApps version currentStep totalSteps ]
Instance Attribute Summary collapse
-
#currentActions ⇒ Object
readonly
Returns the value of attribute currentActions.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Attributes inherited from Base
Class Method Summary collapse
-
.delete(id, force = false) ⇒ Object
(also: cancel, remove)
Cancel the deployment with id.
-
.list ⇒ Object
List running deployments.
Instance Method Summary collapse
-
#cancel ⇒ Object
Cancel the deployment.
-
#delete(force = false) ⇒ Object
Cancel the deployment.
-
#initialize(hash) ⇒ Deployment
constructor
Create a new deployment object.
- #to_s ⇒ Object
Methods inherited from Base
Methods included from Error
error_class, error_message, from_response
Constructor Details
#initialize(hash) ⇒ Deployment
Create a new deployment object. hash
: Hash including all attributes.
See https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/deployments for full details.
11 12 13 14 15 |
# File 'lib/marathon/deployment.rb', line 11 def initialize(hash) super(hash, ACCESSORS) @currentActions = (info[:currentActions] || []).map { |e| Marathon::DeploymentAction.new(e) } @steps = (info[:steps] || []).map { |e| Marathon::DeploymentStep.new(e) } end |
Instance Attribute Details
#currentActions ⇒ Object (readonly)
Returns the value of attribute currentActions.
6 7 8 |
# File 'lib/marathon/deployment.rb', line 6 def currentActions @currentActions end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
6 7 8 |
# File 'lib/marathon/deployment.rb', line 6 def steps @steps end |
Class Method Details
.delete(id, force = false) ⇒ Object Also known as: cancel, remove
Cancel the deployment with id. id
: Deployment’s id force
: If set to false (the default) then the deployment is canceled and a new deployment
is created to restore the previous configuration. If set to true, then the deployment
is still canceled but no rollback deployment is created.
44 45 46 47 48 49 |
# File 'lib/marathon/deployment.rb', line 44 def delete(id, force = false) query = {} query[:force] = true if force json = Marathon.connection.delete("/v2/deployments/#{id}") Marathon::DeploymentInfo.new(json) end |
.list ⇒ Object
List running deployments.
34 35 36 37 |
# File 'lib/marathon/deployment.rb', line 34 def list json = Marathon.connection.get('/v2/deployments') json.map { |j| new(j) } end |
Instance Method Details
#cancel ⇒ Object
Cancel the deployment. force
: If set to false (the default) then the deployment is canceled and a new deployment
is created to restore the previous configuration. If set to true, then the deployment
is still canceled but no rollback deployment is created.
24 25 26 |
# File 'lib/marathon/deployment.rb', line 24 def delete(force = false) self.class.delete(id, force) end |
#delete(force = false) ⇒ Object
Cancel the deployment. force
: If set to false (the default) then the deployment is canceled and a new deployment
is created to restore the previous configuration. If set to true, then the deployment
is still canceled but no rollback deployment is created.
21 22 23 |
# File 'lib/marathon/deployment.rb', line 21 def delete(force = false) self.class.delete(id, force) end |
#to_s ⇒ Object
26 27 28 29 |
# File 'lib/marathon/deployment.rb', line 26 def to_s "Marathon::Deployment { " \ + ":id => #{id} :affectedApps => #{affectedApps} :currentStep => #{currentStep} :totalSteps => #{totalSteps} }" end |