Class: Humidifier::SdkPayload

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/humidifier/sdk_payload.rb

Overview

The payload sent to the shim methods, representing the stack and the options

Defined Under Namespace

Classes: TemplateTooLargeError

Constant Summary collapse

MAX_TEMPLATE_BODY_SIZE =

The maximum size a template body can be before it has to be put somewhere and referenced through a URL

51_200
MAX_TEMPLATE_URL_SIZE =

The maximum size a template body can be inside of an S3 bucket

460_800
MAX_WAIT =

The maximum amount of time that Humidifier should wait for a stack to complete a CRUD operation

600

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stack, options) ⇒ SdkPayload

Returns a new instance of SdkPayload.



48
49
50
51
52
53
# File 'lib/humidifier/sdk_payload.rb', line 48

def initialize(stack, options)
  @stack = stack
  @options = options
  @max_wait = options.delete(:max_wait) || MAX_WAIT
  @force_upload = options.delete(:force_upload)
end

Instance Attribute Details

#force_uploadObject

Force the stack to upload to S3 regardless of the size of the stack.



43
44
45
# File 'lib/humidifier/sdk_payload.rb', line 43

def force_upload
  @force_upload
end

#max_waitObject

The maximum amount of time that ‘humidifier` should wait for the stack to resolve to the desired state. If your stacks are particularly large, you may need to set this to wait longer than the default `MAX_WAIT`.



40
41
42
# File 'lib/humidifier/sdk_payload.rb', line 40

def max_wait
  @max_wait
end

#optionsObject (readonly)

Options that should be passed through to CloudFormation when the desired operation is being performed. Particularly useful for the ‘capabilities` option for acknowledging IAM resource changes.



35
36
37
# File 'lib/humidifier/sdk_payload.rb', line 35

def options
  @options
end

#stackObject (readonly)

The stack on which operations are going to be performed.



30
31
32
# File 'lib/humidifier/sdk_payload.rb', line 30

def stack
  @stack
end

Instance Method Details

#==(other) ⇒ Object

True if the stack and options are the same as the other (used for testing)



56
57
58
# File 'lib/humidifier/sdk_payload.rb', line 56

def ==(other)
  stack == other.stack && options == other.options
end

#create_change_set_paramsObject

Param set for the #create_change_set SDK method



75
76
77
# File 'lib/humidifier/sdk_payload.rb', line 75

def create_change_set_params
  { stack_name: stack.identifier }.merge(template_param).merge(options)
end

#create_paramsObject

Param set for the #create_stack SDK method



80
81
82
# File 'lib/humidifier/sdk_payload.rb', line 80

def create_params
  { stack_name: stack.name }.merge(template_param).merge(options)
end

#delete_paramsObject

Param set for the #delete_stack SDK method



85
86
87
# File 'lib/humidifier/sdk_payload.rb', line 85

def delete_params
  { stack_name: stack.identifier }.merge(options)
end

#merge(new_options) ⇒ Object

Merge in options



61
62
63
# File 'lib/humidifier/sdk_payload.rb', line 61

def merge(new_options)
  @options = new_options.merge(options)
end

#template_bodyObject

The body of the template



66
67
68
# File 'lib/humidifier/sdk_payload.rb', line 66

def template_body
  @template_body ||= stack.to_cf
end

#update_paramsObject

Param set for the #update_stack SDK method



90
91
92
# File 'lib/humidifier/sdk_payload.rb', line 90

def update_params
  { stack_name: stack.identifier }.merge(template_param).merge(options)
end

#validate_paramsObject

Param set for the #validate_template SDK method



95
96
97
# File 'lib/humidifier/sdk_payload.rb', line 95

def validate_params
  template_param.merge(options)
end