Class: Serverspec::Type::AWS::CloudFormation::Stack

Inherits:
Base
  • Object
show all
Defined in:
lib/resources/cloudformation/stack.rb

Overview

The Stack class exposes the CloudFormation::Stack resources

Instance Method Summary collapse

Constructor Details

#initialize(stack_name, instance = nil) ⇒ Stack

AWS SDK for Ruby v2 Aws::CloudFormation::Client wrapper for initializing a Stack resource

Parameters:

  • stack_name (String)

    The name of the Stack

  • instance (Class) (defaults to: nil)

    Aws::CloudFormation::Client instance

Raises:

  • (RuntimeError)

    if stack_name.nil?

  • (RuntimeError)

    if stacks.length == 0

  • (RuntimeError)

    if stacks.length > 1



15
16
17
18
19
20
# File 'lib/resources/cloudformation/stack.rb', line 15

def initialize(stack_name, instance = nil)
  check_init_arg 'stack_name', 'CloudFormation::Stack', stack_name
  @stack_name = stack_name
  @aws = instance.nil? ? Aws::CloudFormation::Client.new : instance
  get_stack stack_name
end

Instance Method Details

#capabilitiesArray(String)

The capabilities allowed in the Stack

Returns:

  • (Array(String))


71
72
73
# File 'lib/resources/cloudformation/stack.rb', line 71

def capabilities
  @stack.capabilities
end

#descriptionString

User defined description associated with the Stack

Returns:

  • (String)


41
42
43
# File 'lib/resources/cloudformation/stack.rb', line 41

def description
  @stack.description
end

#notification_arnsArray(String)

SNS topic ARNs to which Stack related events are published

Returns:

  • (Array(String))


59
60
61
# File 'lib/resources/cloudformation/stack.rb', line 59

def notification_arns
  @stack.notification_arns
end

#ok?Boolean

Check if the Stack is in CREATE_COMPLETE or UPDATE_COMPLETE status

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/resources/cloudformation/stack.rb', line 34

def ok?
  @stack.stack_status == 'CREATE_COMPLETE' ||
    @stack.stack_status == 'UPDATE_COMPLETE'
end

#outputsArray(Hash)

A list of output structures

Returns:

  • (Array(Hash))


77
78
79
# File 'lib/resources/cloudformation/stack.rb', line 77

def outputs
  @stack.outputs
end

#parametersArray(Hash)

A list of Parameter structures

Returns:

  • (Array(Hash))


47
48
49
# File 'lib/resources/cloudformation/stack.rb', line 47

def parameters
  @stack.parameters
end

#rollback_disabled?Boolean

Check whether the rollback on Stack creation failures is disabled

Returns:

  • (Boolean)


29
30
31
# File 'lib/resources/cloudformation/stack.rb', line 29

def rollback_disabled?
  @stack.disable_rollback
end

#stack_statusString

Current status of the Stack

Returns:

  • (String)


53
54
55
# File 'lib/resources/cloudformation/stack.rb', line 53

def stack_status
  @stack.stack_status
end

#tagsArray(Hash)

A list of tags that specify cost allocation information for the Stack

Returns:

  • (Array(Hash))


84
85
86
# File 'lib/resources/cloudformation/stack.rb', line 84

def tags
  @stack.tags
end

#timeout_in_minutesInteger

The amount of time within which Stack creation should complete

Returns:

  • (Integer)


65
66
67
# File 'lib/resources/cloudformation/stack.rb', line 65

def timeout_in_minutes
  @stack.timeout_in_minutes
end

#to_sString

Returns the String representation of CloudFormation::Stack

Returns:

  • (String)


24
25
26
# File 'lib/resources/cloudformation/stack.rb', line 24

def to_s
  "CloudFormation Stack: #{@stack_name}"
end