Class: Ey::Core::Client::Cluster
- Inherits:
-
Model
- Object
- Cistern::Model
- Model
- Ey::Core::Client::Cluster
show all
- Extended by:
- Associations
- Defined in:
- lib/vendor/core/ey-core/models/cluster.rb
Instance Method Summary
collapse
assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader
Methods inherited from Model
#destroy, range_parser, #save, #update!, #url
Instance Method Details
#deploy(application, opts = {}) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/vendor/core/ey-core/models/cluster.rb', line 25
def deploy(application, opts={})
task = opts.dup
if archive = task.delete(:archive)
task["archive_id"] = archive.id
end
run_action(application, "deploy", task)
end
|
#destroy! ⇒ Object
77
78
79
|
# File 'lib/vendor/core/ey-core/models/cluster.rb', line 77
def destroy!
connection.requests.new(connection.destroy_cluster(id).body["request"])
end
|
#run_action(application, action, task = {}) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/vendor/core/ey-core/models/cluster.rb', line 38
def run_action(application, action, task={})
requires :id
response = self.connection.run_cluster_application_action(
"cluster" => self.id,
"application" => application.id,
"task" => task,
"action" => action,
)
connection.requests.new(response.body["request"])
end
|
#save! ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/vendor/core/ey-core/models/cluster.rb', line 50
def save!
if new_record?
requires :name, :location, :provider_id
params = {
"cluster" => {
"location" => self.location,
"name" => self.name,
"provider" => self.provider_id,
"release_label" => self.release_label,
"configuration" => self.configuration,
},
"environment" => self.environment_id,
"url" => self.collection.url,
}
merge_attributes(self.connection.create_cluster(params).body["cluster"])
else
params = {
"id" => id,
"cluster" => {
"release_label" => self.release_label,
"configuration" => self.configuration,
}
}
merge_attributes(self.connection.update_cluster(params).body["cluster"])
end
end
|