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, marathon_instance) ⇒ 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, marathon_instance) ⇒ 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 16 |
# File 'lib/marathon/deployment.rb', line 11 def initialize(hash, marathon_instance) super(hash, ACCESSORS) @marathon_instance = marathon_instance @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.
45 46 47 |
# File 'lib/marathon/deployment.rb', line 45 def delete(id, force = false) Marathon.singleton.deployments.delete(id, force) 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.
26 27 28 |
# File 'lib/marathon/deployment.rb', line 26 def delete(force = false) @marathon_instance.deployments.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.
22 23 24 |
# File 'lib/marathon/deployment.rb', line 22 def delete(force = false) @marathon_instance.deployments.delete(id, force) end |
#to_s ⇒ Object
28 29 30 31 |
# File 'lib/marathon/deployment.rb', line 28 def to_s "Marathon::Deployment { " \ + ":id => #{id} :affectedApps => #{affectedApps} :currentStep => #{currentStep} :totalSteps => #{totalSteps} }" end |