AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Updates a generated template. This can be used to change the name, add and remove resources, refresh resources, and change the DeletionPolicy and UpdateReplacePolicy settings. You can check the status of the update to the generated template using the DescribeGeneratedTemplate API action.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to UpdateGeneratedTemplateAsync.

Namespace: Amazon.CloudFormation
Assembly: AWSSDK.CloudFormation.dll
Version: 3.x.y.z

Syntax

C#
public abstract UpdateGeneratedTemplateResponse UpdateGeneratedTemplate(
         UpdateGeneratedTemplateRequest request
)

Parameters

request
Type: Amazon.CloudFormation.Model.UpdateGeneratedTemplateRequest

Container for the necessary parameters to execute the UpdateGeneratedTemplate service method.

Return Value


The response from the UpdateGeneratedTemplate service method, as returned by CloudFormation.

Exceptions

ExceptionCondition
AlreadyExistsException The resource with the name requested already exists.
GeneratedTemplateNotFoundException The generated template was not found.
LimitExceededException The quota for the resource has already been reached. For information about resource and stack limitations, see CloudFormation quotas in the CloudFormation User Guide.

Examples

This example updates a generated template with a new name.

To update a generated template's name


var client = new AmazonCloudFormationClient();
var response = client.UpdateGeneratedTemplate(new UpdateGeneratedTemplateRequest 
{
    GeneratedTemplateName = "JazzyTemplate",
    NewGeneratedTemplateName = "JazzierTemplate"
});

string generatedTemplateId = response.GeneratedTemplateId;

            

This example removes resources from a generated template

To remove resources from a generated template


var client = new AmazonCloudFormationClient();
var response = client.UpdateGeneratedTemplate(new UpdateGeneratedTemplateRequest 
{
    GeneratedTemplateName = "JazzyTemplate",
    RemoveResources = new List<string> {
        "LogicalResourceId1",
        "LogicalResourceId2"
    }
});

string generatedTemplateId = response.GeneratedTemplateId;

            

This example adds resources to a generated template

To add resources to a generated template


var client = new AmazonCloudFormationClient();
var response = client.UpdateGeneratedTemplate(new UpdateGeneratedTemplateRequest 
{
    AddResources = new List<ResourceDefinition> {
        new ResourceDefinition {
            ResourceIdentifier = new Dictionary<string, string> {
                { "BucketName", "jazz-bucket" }
            },
            ResourceType = "AWS::S3::Bucket"
        },
        new ResourceDefinition {
            ResourceIdentifier = new Dictionary<string, string> {
                { "DhcpOptionsId", "random-id123" }
            },
            ResourceType = "AWS::EC2::DHCPOptions"
        }
    },
    GeneratedTemplateName = "JazzyTemplate"
});

string generatedTemplateId = response.GeneratedTemplateId;

            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

See Also