class Fog::AWS::CloudFormation::Real
Public Class Methods
Initialize connection to CloudFormation
Notes¶ ↑
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
Examples¶ ↑
cf = CloudFormation.new( :aws_access_key_id => your_aws_access_key_id, :aws_secret_access_key => your_aws_secret_access_key )
Parameters¶ ↑
-
options<~Hash> - config arguments for connection. Defaults to {}.
Returns¶ ↑
-
CloudFormation
object with connection toAWS
.
# File lib/fog/aws/cloud_formation.rb, line 60 def initialize(options={}) @use_iam_profile = options[:use_iam_profile] @instrumentor = options[:instrumentor] @instrumentor_name = options[:instrumentor_name] || 'fog.aws.cloud_formation' @connection_options = options[:connection_options] || {} options[:region] ||= 'us-east-1' @region = options[:region] @host = options[:host] || "cloudformation.#{options[:region]}.amazonaws.com" @path = options[:path] || '/' @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) setup_credentials(options) end
Public Instance Methods
Cancels an update on the specified stack.
@param stack_name String] Name of the stack to cancel update.
@return [Excon::Response]
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_CancelUpdateStack.html
# File lib/fog/aws/requests/cloud_formation/cancel_update_stack.rb, line 15 def cancel_update_stack(stack_name) request( 'Action' => 'CancelUpdateStack', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::Basic.new ) end
For a specified stack that is in the UPDATE_ROLLBACK_FAILED state, continues rolling it back to the UPDATE_ROLLBACK_COMPLETE state.
@param stack_name [String] The name or the unique ID of the stack that you want to continue rolling back.
@return [Excon::Response]
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_ContinueUpdateRollback.html
# File lib/fog/aws/requests/cloud_formation/continue_update_rollback.rb, line 16 def continue_update_rollback(stack_name) request( 'Action' => 'ContinueUpdateRollback', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::Basic.new ) end
Create a Change Set.
-
stack_name [String] Name of the stack to create.
-
options [Hash]:
-
ChangeSetName [String] The name of the change set.
-
Description [String] A description to help you identify this change set.
-
TemplateBody [String] Structure containing the template body.
or (one of the two Template parameters is required)
-
TemplateURL [String] URL of file containing the template body.
-
UsePreviousTemplate [Boolean] Reuse the template that is associated with the stack to create the change set.
-
NotificationARNs [Array] List of
SNS
topics to publish events to. -
Parameters [Hash] Hash of providers to supply to template.
-
Capabilities [Array] List of capabilties the stack is granted. Currently CAPABILITY_IAM for allowing the creation of
IAM
resources.
-
@return [Excon::Response]:
* body [Hash: * Id [String] - The Amazon Resource Name (ARN) of the change set
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html
# File lib/fog/aws/requests/cloud_formation/create_change_set.rb, line 27 def create_change_set(stack_name, options = {}) params = { 'StackName' => stack_name, } if options['ChangeSetName'] params['ChangeSetName'] = options['ChangeSetName'] end if options['Description'] params['Description'] = options['Description'] end if options['UsePreviousTemplate'] params['UsePreviousTemplate'] = options['UsePreviousTemplate'] end if options['NotificationARNs'] params.merge!(Fog::AWS.indexed_param("NotificationARNs.member", [*options['NotificationARNs']])) end if options['Parameters'] options['Parameters'].keys.each_with_index do |key, index| index += 1 # params are 1-indexed params.merge!({ "Parameters.member.#{index}.ParameterKey" => key, "Parameters.member.#{index}.ParameterValue" => options['Parameters'][key] }) end end if options['TemplateBody'] params['TemplateBody'] = options['TemplateBody'] elsif options['TemplateURL'] params['TemplateURL'] = options['TemplateURL'] end if options['Capabilities'] params.merge!(Fog::AWS.indexed_param("Capabilities.member", [*options['Capabilities']])) end request({ 'Action' => 'CreateChangeSet', :parser => Fog::Parsers::AWS::CloudFormation::CreateChangeSet.new }.merge!(params)) end
Create a stack.
-
stack_name [String] Name of the stack to create.
-
options [Hash]:
-
TemplateBody [String] Structure containing the template body.
or (one of the two Template parameters is required)
-
TemplateURL [String] URL of file containing the template body.
-
DisableRollback [Boolean] Controls rollback on stack creation failure, defaults to false.
-
OnFailure [String] Determines what action will be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE.
-
NotificationARNs [Array] List of
SNS
topics to publish events to. -
Parameters [Hash] Hash of providers to supply to template
-
TimeoutInMinutes [Integer] Minutes to wait before status is set to CREATE_FAILED
-
Capabilities [Array] List of capabilties the stack is granted. Currently CAPABILITY_IAM for allowing the creation of
IAM
resources -
StackPolicyBody [String] Structure containing the stack policy body.
-
StackPolicyURL [String] URL of file containing the stack policy.
-
Tags [Array] Key-value pairs to associate with this stack.
-
@return [Excon::Response]:
* body [Hash: * StackId [String] - Id of the new stack
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html
# File lib/fog/aws/requests/cloud_formation/create_stack.rb, line 30 def create_stack(stack_name, options = {}) params = { 'StackName' => stack_name, } if options['DisableRollback'] params['DisableRollback'] = options['DisableRollback'] end if options['OnFailure'] params['OnFailure'] = options['OnFailure'] end if options['NotificationARNs'] params.merge!(Fog::AWS.indexed_param("NotificationARNs.member", [*options['NotificationARNs']])) end if options['Parameters'] options['Parameters'].keys.each_with_index do |key, index| index += 1 # params are 1-indexed params.merge!({ "Parameters.member.#{index}.ParameterKey" => key, "Parameters.member.#{index}.ParameterValue" => options['Parameters'][key] }) end end num_tags = 0 if options['Tags'] options['Tags'].keys.each_with_index do |key, index| index += 1 # tags are 1-indexed num_tags += 1 # 10 tag max params.merge!({ "Tags.member.#{index}.Key" => key, "Tags.member.#{index}.Value" => options['Tags'][key] }) end end if num_tags > 10 raise ArgumentError.new("a maximum of 10 tags can be specified <#{num_tags}>") end if options['TemplateBody'] params['TemplateBody'] = options['TemplateBody'] elsif options['TemplateURL'] params['TemplateURL'] = options['TemplateURL'] end if options['StackPolicyBody'] params['StackPolicyBody'] = options['StackPolicyBody'] elsif options['StackPolicyURL'] params['StackPolicyURL'] = options['StackPolicyURL'] end if options['TimeoutInMinutes'] params['TimeoutInMinutes'] = options['TimeoutInMinutes'] end if options['Capabilities'] params.merge!(Fog::AWS.indexed_param("Capabilities.member", [*options['Capabilities']])) end request({ 'Action' => 'CreateStack', :parser => Fog::Parsers::AWS::CloudFormation::CreateStack.new }.merge!(params)) end
Delete a change set.
@param ChangeSetName [String] The name of the change set to delete. @option options StackName [String] The Stack name or ID (ARN) that is associated with change set.
@return [Excon::Response]
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DeleteChangeSet.html
# File lib/fog/aws/requests/cloud_formation/delete_change_set.rb, line 16 def delete_change_set(change_set_name, options = {}) options['ChangeSetName'] = change_set_name request({ 'Action' => 'DeleteChangeSet', :parser => Fog::Parsers::AWS::CloudFormation::Basic.new }.merge!(options)) end
Delete a stack.
@param stack_name [String] Name of the stack to create.
@return [Excon::Response]
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DeleteStack.html
# File lib/fog/aws/requests/cloud_formation/delete_stack.rb, line 15 def delete_stack(stack_name) request( 'Action' => 'DeleteStack', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::Basic.new ) end
Describe account_limits.
@return [Excon::Response]
* body [Hash]: * AccountLimits [Array] * member [Hash]: * StackLimit [Integer]
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DescribeAccountLimits.html
# File lib/fog/aws/requests/cloud_formation/describe_account_limits.rb, line 18 def describe_account_limits() request( 'Action' => 'DescribeAccountLimits', :parser => Fog::Parsers::AWS::CloudFormation::DescribeAccountLimits.new ) end
Describe change_set.
-
ChangeSetName [String] The name of the change set to describe.
@param options [Hash] @option options StackName [String] Name of the stack for the change set.
@return [Excon::Response]
* body [Hash]: * ChangeSetId [String] - * ChangeSetName [String] - * Description [String] - * CreationTime [Time] - * ExecutionStatus [String] - * StackId [String] - * StackName [String] - * Status [String] - * StackReason [String] - * NotificationARNs [Array] - * NotificationARN [String] - * Parameters [Array] - * parameter [Hash]: * ParameterKey [String] - * ParameterValue [String] -
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DescribeChangeSet.html
# File lib/fog/aws/requests/cloud_formation/describe_change_set.rb, line 33 def describe_change_set(change_set_name, options = {}) options['ChangeSetName'] = change_set_name request({ 'Action' => 'DescribeChangeSet', :parser => Fog::Parsers::AWS::CloudFormation::DescribeChangeSet.new }.merge!(options)) end
Describe stack events.
@param stack_name [String] stack name to return events for. @param options [Hash] @option options NextToken [String] Identifies the start of the next list of events, if there is one.
@return [Excon::Response]
* body [Hash]: * StackEvents [Array] - Matching resources * event [Hash]: * EventId [String] - * StackId [String] - * StackName [String] - * LogicalResourceId [String] - * PhysicalResourceId [String] - * ResourceType [String] - * Timestamp [Time] - * ResourceStatus [String] - * ResourceStatusReason [String] -
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DescribeStackEvents.html
# File lib/fog/aws/requests/cloud_formation/describe_stack_events.rb, line 29 def describe_stack_events(stack_name, options = {}) request({ 'Action' => 'DescribeStackEvents', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::DescribeStackEvents.new }.merge!(options)) end
Describe stack resource.
@param options Hash]:
* LogicalResourceId [String] Logical name of the resource as specified in the template * StackName [String] The name or the unique stack ID
@return [Excon::Response]
* body [Hash]: * StackResourceDetail [Hash] - Matching resources *Description [String] - * LastUpdatedTimestamp [Timestamp] - * LogicalResourceId [String] - * Metadata [String] - * PhysicalResourceId [String] - * ResourceStatus [String] - * ResourceStatusReason [String] - * ResourceType [String] - * StackId [String] - * StackName [String] -
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DescribeStackResource.html
# File lib/fog/aws/requests/cloud_formation/describe_stack_resource.rb, line 29 def describe_stack_resource(logical_resource_id, stack_name ) request( 'Action' => 'DescribeStackResource', 'LogicalResourceId' => logical_resource_id, 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::DescribeStackResource.new ) end
Describe stack resources.
@param options Hash]:
* PhysicalResourceId [String] name or unique identifier that corresponds to a physical instance ID or (one of PhysicalResourceId and StackName is required) * StackName [String] Only return events related to this stack name * LogicalResourceId [String] Logical name of the resource as specified in the template
@return [Excon::Response]
* body [Hash]: * StackResources [Array] - Matching resources * resource [Hash]: * StackId [String] - * StackName [String] - * LogicalResourceId [String] - * PhysicalResourceId [String] - * ResourceType [String] - * Timestamp [Time] - * ResourceStatus [String] -
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DescribeStackResources.html
# File lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb, line 29 def describe_stack_resources(options = {}) request({ 'Action' => 'DescribeStackResources', :parser => Fog::Parsers::AWS::CloudFormation::DescribeStackResources.new }.merge!(options)) end
Describe stacks.
@param options [Hash] @option options StackName [String] Name of the stack to describe.
@return [Excon::Response]
* body [Hash]: * Stacks [Array] - Matching stacks * stack [Hash]: * StackName [String] - * StackId [String] - * CreationTime [String] - * StackStatus [String] - * DisableRollback [String] - * Outputs [Array] - * output [Hash]: * OutputKey [String] - * OutputValue [String] -
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_DescribeStacks.html
# File lib/fog/aws/requests/cloud_formation/describe_stacks.rb, line 28 def describe_stacks(options = {}) request({ 'Action' => 'DescribeStacks', :parser => Fog::Parsers::AWS::CloudFormation::DescribeStacks.new }.merge!(options)) end
Returns the estimated monthly cost of a template.
-
options [Hash]:
-
TemplateBody [String] Structure containing the template body.
or (one of the two Template parameters is required)
-
TemplateURL [String] URL of file containing the template body.
-
Parameters [Hash] Hash of providers to supply to template
-
@return [Excon::Response]:
* body [Hash: * Url [String] - An AWS Simple Monthly Calculator URL with a query string that describes the resources required to run the template.
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_EstimateTemplateCost.html
# File lib/fog/aws/requests/cloud_formation/estimate_template_cost.rb, line 21 def estimate_template_cost(options = {}) params = {} if options['Parameters'] options['Parameters'].keys.each_with_index do |key, index| index += 1 # params are 1-indexed params.merge!({ "Parameters.member.#{index}.ParameterKey" => key, "Parameters.member.#{index}.ParameterValue" => options['Parameters'][key] }) end end if options['TemplateBody'] params['TemplateBody'] = options['TemplateBody'] elsif options['TemplateURL'] params['TemplateURL'] = options['TemplateURL'] end request({ 'Action' => 'EstimateTemplateCost', :parser => Fog::Parsers::AWS::CloudFormation::EstimateTemplateCost.new }.merge!(params)) end
Execute a change set.
@param ChangeSetName [String] The name of the change set to delete. @option options StackName [String] The Stack name or ID (ARN) that is associated with change set.
@return [Excon::Response]
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html
# File lib/fog/aws/requests/cloud_formation/execute_change_set.rb, line 16 def execute_change_set(change_set_name, options = {}) options['ChangeSetName'] = change_set_name request({ 'Action' => 'ExecuteChangeSet', :parser => Fog::Parsers::AWS::CloudFormation::Basic.new }.merge!(options)) end
Describe stacks.
@param stack_name [String] The name or unique stack ID that is associated with the stack whose policy you want to get.
@return [Excon::Response]
* body [Hash]: * StackPolicyBody [String] - Structure containing the stack policy body.
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_GetStackPolicy.html
# File lib/fog/aws/requests/cloud_formation/get_stack_policy.rb, line 17 def get_stack_policy(stack_name) request( 'Action' => 'GetStackPolicy', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::GetStackPolicy.new ) end
Describe stacks.
@param stack_name [String] stack name to get template from
@return [Excon::Response]
* body [Hash]: * TemplateBody [String] - structure containing the template body (json)
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_GetTemplate.html
# File lib/fog/aws/requests/cloud_formation/get_template.rb, line 17 def get_template(stack_name) request( 'Action' => 'GetTemplate', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::GetTemplate.new ) end
Returns information about a new or existing template.
-
options [Hash]:
-
stack_name [String] Name of the stack or the stack ID.
or
-
TemplateBody [String] Structure containing the template body.
or
-
TemplateURL [String] URL of file containing the template body.
-
@return [Excon::Response]:
* body [Hash: * Capabilities [Array] List of capabilties in the template. * CapabilitiesReason [String] The list of resources that generated the values in the Capabilities response element. * Description [String] Template Description. * Metadata [String] Template Metadata. * Parameters [Array] A list of parameter declarations that describe various properties for each parameter. * ResourceTypes [Array] all the template resource types that are defined in the template
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_GetTemplateSummary.html
# File lib/fog/aws/requests/cloud_formation/get_template_summary.rb, line 27 def get_template_summary(options = {}) params = {} if options['StackName'] params['StackName'] = options['StackName'] elsif options['TemplateBody'] params['TemplateBody'] = options['TemplateBody'] elsif options['TemplateURL'] params['TemplateURL'] = options['TemplateURL'] end request({ 'Action' => 'GetTemplateSummary', :parser => Fog::Parsers::AWS::CloudFormation::GetTemplateSummary.new }.merge!(params)) end
List change sets.
@param stack_name String] Name or the ARN of the stack for which you want to list change sets.
@option options StackName [String] Name of the stack to describe.
@return [Excon::Response]
* body [Hash]: * Summaries [Array] - Matching change sets * stack [Hash]: * ChangeSetId [String] - * ChangeSetName [String] - * Description [String] - * CreationTime [Time] - * ExecutionStatus [String] - * StackId [String] - * StackName [String] - * Status [String] - * StackReason [String] -
@see docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ListChangeSets.html
# File lib/fog/aws/requests/cloud_formation/list_change_sets.rb, line 30 def list_change_sets(stack_name, options = {}) request({ 'Action' => 'ListChangeSets', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::ListChangeSets.new }.merge!(options)) end
List stack resources.
@param options [Hash] @option options StackName [String] Name of the stack to describe.
@return [Excon::Response]
* body [Hash]: * StackResourceSummaries [Array] - Matching stacks * resources [Hash]: * ResourceStatus [String] - * LogicalResourceId [String] - * PhysicalResourceId [String] - * ResourceType [String] - * LastUpdatedTimestamp [Time] -
@see docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ListStacks.html
# File lib/fog/aws/requests/cloud_formation/list_stack_resources.rb, line 25 def list_stack_resources(options = {}) request({ 'Action' => 'ListStackResources', :parser => Fog::Parsers::AWS::CloudFormation::ListStackResources.new }.merge!(options)) end
List stacks.
@param options [Hash]
@return [Excon::Response]
* body [Hash]: * StackSummaries [Array] - Matching stacks * stack [Hash]: * StackId [String] - * StackName [String] - * TemplateDescription [String] - * CreationTime [Time] - * DeletionTime [Time] - * StackStatus [String] - * DeletionTime [String] -
@see docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ListStacks.html
# File lib/fog/aws/requests/cloud_formation/list_stacks.rb, line 26 def list_stacks(options = {}) request({ 'Action' => 'ListStacks', :parser => Fog::Parsers::AWS::CloudFormation::ListStacks.new }.merge!(options)) end
# File lib/fog/aws/cloud_formation.rb, line 79 def reload @connection.reset end
Sets a stack policy for a specified stack.
@param stack_name [String] Name or unique stack ID that you want to associate a policy with.
-
options [Hash]:
-
StackPolicyBody [String] Structure containing the stack policy body.
or (one of the two StackPolicy parameters is required)
-
StackPolicyURL [String] URL of file containing the stack policy.
-
Parameters [Hash] Hash of providers to supply to StackPolicy
-
@return [Excon::Response]:
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_SetStackPolicy.html
# File lib/fog/aws/requests/cloud_formation/set_stack_policy.rb, line 20 def set_stack_policy(stack_name, options = {}) params = {} if options['StackPolicyBody'] params['StackPolicyBody'] = options['StackPolicyBody'] elsif options['StackPolicyURL'] params['StackPolicyURL'] = options['StackPolicyURL'] end request({ 'Action' => 'SetStackPolicy', 'StackName' => stack_name, :parser => Fog::Parsers::AWS::CloudFormation::Basic.new }.merge!(params)) end
Sends a signal to the specified resource.
@param options Hash]:
* LogicalResourceId [String] The logical ID of the resource that you want to signal. * StackName [String] The stack name or unique stack ID that includes the resource that you want to signal. * Status [String] The status of the signal, which is either success or failure. * UniqueId [String] A unique ID of the signal.
@return [Excon::Response]
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_SignalResource.html
# File lib/fog/aws/requests/cloud_formation/signal_resource.rb, line 19 def signal_resource(logical_resource_id, stack_name, status, unique_id ) request( 'Action' => 'SignalResource', 'LogicalResourceId' => logical_resource_id, 'StackName' => stack_name, 'Status' => status, 'UniqueId' => unique_id, :parser => Fog::Parsers::AWS::CloudFormation::Basic.new ) end
Update a stack.
@param [String] stack_name Name of the stack to update. @param [Hash] options
* TemplateBody [String] Structure containing the template body. or (one of the two Template parameters is required) * TemplateURL [String] URL of file containing the template body. * Parameters [Hash] Hash of providers to supply to template. * Capabilities [Array] List of capabilties the stack is granted. Currently CAPABILITY_IAM for allowing the creation of IAM resources. * NotificationARNs [Array] List of SNS topics to publish events to. * ResourceTypes [Array] The template resource types that you have permissions to work. * StackPolicyBody [String] Structure containing the stack policy body. * StackPolicyURL [String] URL of file containing the stack policy. * StackPolicyDuringUpdateBody [String] Structure containing the stack policy body to use during update. * StackPolicyDuringUpdateURL [String] URL of file containing the stack policy to use during update. * Tags [Array] Key-value pairs to associate with this stack. * UsePreviousTemplate [Boolean] Reuse the existing template that is associated with the stack that you are updating.
@return [Excon::Response]
* body [Hash]: * StackId [String] - Id of the stack being updated
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_UpdateStack.html
# File lib/fog/aws/requests/cloud_formation/update_stack.rb, line 31 def update_stack(stack_name, options = {}) params = { 'StackName' => stack_name, } if options['Parameters'] options['Parameters'].keys.each_with_index do |key, index| index += 1 # params are 1-indexed params.merge!({ "Parameters.member.#{index}.ParameterKey" => key, "Parameters.member.#{index}.ParameterValue" => options['Parameters'][key] }) end end if options['TemplateBody'] params['TemplateBody'] = options['TemplateBody'] elsif options['TemplateURL'] params['TemplateURL'] = options['TemplateURL'] end if options['StackPolicyBody'] params['StackPolicyBody'] = options['StackPolicyBody'] elsif options['StackPolicyURL'] params['StackPolicyURL'] = options['StackPolicyURL'] end if options['StackPolicyDuringUpdateBody'] params['StackPolicyDuringUpdateBody'] = options['StackPolicyDuringUpdateBody'] elsif options['StackPolicyDuringUpdateURL'] params['StackPolicyDuringUpdateURL'] = options['StackPolicyDuringUpdateURL'] end num_tags = 0 if options['Tags'] options['Tags'].keys.each_with_index do |key, index| index += 1 # tags are 1-indexed num_tags += 1 # 10 tag max params.merge!({ "Tags.member.#{index}.Key" => key, "Tags.member.#{index}.Value" => options['Tags'][key] }) end end if num_tags > 10 raise ArgumentError.new("a maximum of 10 tags can be specified <#{num_tags}>") end if options['Capabilities'] params.merge!(Fog::AWS.indexed_param("Capabilities.member", [*options['Capabilities']])) end if options['NotificationARNs'] params.merge!(Fog::AWS.indexed_param("NotificationARNs.member", [*options['NotificationARNs']])) end if options['ResourceTypes'] params.merge!(Fog::AWS.indexed_param("ResourceTypes.member", [*options['ResourceTypes']])) end if options['UsePreviousTemplate'] params['UsePreviousTemplate'] = options['UsePreviousTemplate'] end request({ 'Action' => 'UpdateStack', :parser => Fog::Parsers::AWS::CloudFormation::UpdateStack.new }.merge!(params)) end
Describe stacks.
@param [Hash] options @option options [String] TemplateBody template structure @option options [String] TemplateURL template url
@return [Excon::Response]
* body [Hash]: * Description [String] - description found within the template * Parameters [String] - list of template parameter structures
@see docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_ValidateTemplate.html
# File lib/fog/aws/requests/cloud_formation/validate_template.rb, line 20 def validate_template(options = {}) request({ 'Action' => 'ValidateTemplate', :parser => Fog::Parsers::AWS::CloudFormation::ValidateTemplate.new }.merge!(options)) end
Private Instance Methods
# File lib/fog/aws/cloud_formation.rb, line 123 def _request(body, headers, idempotent, parser) @connection.request({ :body => body, :expects => 200, :idempotent => idempotent, :headers => headers, :method => 'POST', :parser => parser }) rescue Excon::Errors::HTTPStatusError => error match = Fog::AWS::Errors.match_error(error) raise if match.empty? raise case match[:code] when 'NotFound', 'ValidationError' Fog::AWS::CloudFormation::NotFound.slurp(error, match[:message]) else Fog::AWS::CloudFormation::Error.slurp(error, "#{match[:code]} => #{match[:message]}") end end
# File lib/fog/aws/cloud_formation.rb, line 94 def request(params) refresh_credentials_if_expired idempotent = params.delete(:idempotent) parser = params.delete(:parser) body, headers = Fog::AWS.signed_params_v4( params, { 'Content-Type' => 'application/x-www-form-urlencoded' }, { :signer => @signer, :aws_session_token => @aws_session_token, :host => @host, :path => @path, :port => @port, :version => '2010-05-15', :method => 'POST' } ) if @instrumentor @instrumentor.instrument("#{@instrumentor_name}.request", params) do _request(body, headers, idempotent, parser) end else _request(body, headers, idempotent, parser) end end
# File lib/fog/aws/cloud_formation.rb, line 85 def setup_credentials(options) @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] @aws_session_token = options[:aws_session_token] @aws_credentials_expire_at = options[:aws_credentials_expire_at] @signer = Fog::AWS::SignatureV4.new( @aws_access_key_id, @aws_secret_access_key, @region, 'cloudformation') end