Class: Ncf::Client

Inherits:
AceClient::Query2
  • Object
show all
Defined in:
lib/ncf/client.rb

Defined Under Namespace

Classes: ResponseError

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.



7
8
9
# File 'lib/ncf/client.rb', line 7

def initialize(options)
	super(options)
end

Instance Method Details

#describe_stack(exec_id) ⇒ Object



17
18
19
20
21
# File 'lib/ncf/client.rb', line 17

def describe_stack(exec_id)
	@response = self.action('DescribeStack', 'ExecutionId' => exec_id)
	raise_if_response_error
	@response
end

#execute_stack(json) ⇒ Object



11
12
13
14
15
# File 'lib/ncf/client.rb', line 11

def execute_stack(json)
	@response = self.action('ExecuteStack', 'TemplateBody' => json)
	raise_if_response_error
	@response
end

#raise_if_response_errorObject



23
24
25
26
27
28
29
# File 'lib/ncf/client.rb', line 23

def raise_if_response_error
	if @response.code != 200
		code = @response['ErrorResponse']['Error']['Code']
		message = @response['ErrorResponse']['Error']['Message']
		raise ResponseError, "#{code}: #{message}"
	end
end