Class: OpsWorks::Stack
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
account, client, #initialize
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8
9
10
|
# File 'lib/opsworks/stack.rb', line 8
def id
@id
end
|
#name ⇒ Object
Returns the value of attribute name.
8
9
10
|
# File 'lib/opsworks/stack.rb', line 8
def name
@name
end
|
Class Method Details
.active ⇒ Object
16
17
18
|
# File 'lib/opsworks/stack.rb', line 16
def self.active
all.select(&:active?)
end
|
.all ⇒ Object
10
11
12
13
14
|
# File 'lib/opsworks/stack.rb', line 10
def self.all
client.describe_stacks.data[:stacks].map do |hash|
new(id: hash[:stack_id], name: hash[:name])
end
end
|
.find_by_name(name) ⇒ Object
20
21
22
|
# File 'lib/opsworks/stack.rb', line 20
def self.find_by_name(name)
all.find { |stack| stack.name == name }
end
|
Instance Method Details
#active? ⇒ Boolean
62
63
64
|
# File 'lib/opsworks/stack.rb', line 62
def active?
instances.any?(&:online?)
end
|
#apps ⇒ Object
24
25
26
|
# File 'lib/opsworks/stack.rb', line 24
def apps
@apps ||= initialize_apps
end
|
#deploy_app(app) ⇒ Object
57
58
59
60
|
# File 'lib/opsworks/stack.rb', line 57
def deploy_app(app)
fail 'App not found' unless app && app.id
create_deployment(app_id: app.id, command: { name: 'deploy' })
end
|
#execute_recipe(recipe) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/opsworks/stack.rb', line 48
def execute_recipe(recipe)
create_deployment(
command: {
name: 'execute_recipes',
args: { 'recipes' => [recipe] }
}
)
end
|
#find_app_by_name(name) ⇒ Object
36
37
38
|
# File 'lib/opsworks/stack.rb', line 36
def find_app_by_name(name)
apps.find { |app| app.name == name }
end
|
#find_permission_by_user(name) ⇒ Object
32
33
34
|
# File 'lib/opsworks/stack.rb', line 32
def find_permission_by_user(name)
permissions.find { |permission| permission.user == name }
end
|
#instances ⇒ Object
40
41
42
|
# File 'lib/opsworks/stack.rb', line 40
def instances
@instances ||= initialize_instances
end
|
#permissions ⇒ Object
28
29
30
|
# File 'lib/opsworks/stack.rb', line 28
def permissions
@permissions ||= initialize_permissions
end
|
#update_custom_cookbooks ⇒ Object
44
45
46
|
# File 'lib/opsworks/stack.rb', line 44
def update_custom_cookbooks
create_deployment(command: { name: 'update_custom_cookbooks' })
end
|