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.



31
32
33
34
35
# File 'lib/humidifier/sdk_payload.rb', line 31

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

Instance Attribute Details

#max_waitObject

Returns the value of attribute max_wait.



26
27
28
# File 'lib/humidifier/sdk_payload.rb', line 26

def max_wait
  @max_wait
end

#optionsObject

Returns the value of attribute options.



26
27
28
# File 'lib/humidifier/sdk_payload.rb', line 26

def options
  @options
end

#stackObject

Returns the value of attribute stack.



26
27
28
# File 'lib/humidifier/sdk_payload.rb', line 26

def stack
  @stack
end

Instance Method Details

#==(other) ⇒ Object

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



38
39
40
# File 'lib/humidifier/sdk_payload.rb', line 38

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

#create_change_set_paramsObject

Param set for the #create_change_set SDK method



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

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



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

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

#delete_paramsObject

Param set for the #delete_stack SDK method



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

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

#merge(new_options) ⇒ Object

Merge in options



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

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

#template_bodyObject

The body of the template



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

def template_body
  @template_body ||= stack.to_cf
end

#update_paramsObject

Param set for the #update_stack SDK method



72
73
74
# File 'lib/humidifier/sdk_payload.rb', line 72

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

#validate_paramsObject

Param set for the #validate_template SDK method



77
78
79
# File 'lib/humidifier/sdk_payload.rb', line 77

def validate_params
  template_param.merge(options)
end