1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package cloudformation
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/cloudformation/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Returns information about a new or existing template. The GetTemplateSummary
15// action is useful for viewing parameter information, such as default parameter
16// values and parameter types, before you create or update a stack or stack set.
17// You can use the GetTemplateSummary action when you submit a template, or you can
18// get template information for a stack set, or a running or deleted stack. For
19// deleted stacks, GetTemplateSummary returns the template information for up to 90
20// days after the stack has been deleted. If the template does not exist, a
21// ValidationError is returned.
22func (c *Client) GetTemplateSummary(ctx context.Context, params *GetTemplateSummaryInput, optFns ...func(*Options)) (*GetTemplateSummaryOutput, error) {
23	if params == nil {
24		params = &GetTemplateSummaryInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "GetTemplateSummary", params, optFns, addOperationGetTemplateSummaryMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*GetTemplateSummaryOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37// The input for the GetTemplateSummary action.
38type GetTemplateSummaryInput struct {
39
40	// The name or the stack ID that is associated with the stack, which are not always
41	// interchangeable. For running stacks, you can specify either the stack's name or
42	// its unique stack ID. For deleted stack, you must specify the unique stack ID.
43	// Conditional: You must specify only one of the following parameters: StackName,
44	// StackSetName, TemplateBody, or TemplateURL.
45	StackName *string
46
47	// The name or unique ID of the stack set from which the stack was created.
48	// Conditional: You must specify only one of the following parameters: StackName,
49	// StackSetName, TemplateBody, or TemplateURL.
50	StackSetName *string
51
52	// Structure containing the template body with a minimum length of 1 byte and a
53	// maximum length of 51,200 bytes. For more information about templates, see
54	// Template Anatomy
55	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html)
56	// in the AWS CloudFormation User Guide. Conditional: You must specify only one of
57	// the following parameters: StackName, StackSetName, TemplateBody, or TemplateURL.
58	TemplateBody *string
59
60	// Location of file containing the template body. The URL must point to a template
61	// (max size: 460,800 bytes) that is located in an Amazon S3 bucket. For more
62	// information about templates, see Template Anatomy
63	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html)
64	// in the AWS CloudFormation User Guide. Conditional: You must specify only one of
65	// the following parameters: StackName, StackSetName, TemplateBody, or TemplateURL.
66	TemplateURL *string
67}
68
69// The output for the GetTemplateSummary action.
70type GetTemplateSummaryOutput struct {
71
72	// The capabilities found within the template. If your template contains IAM
73	// resources, you must specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value for
74	// this parameter when you use the CreateStack or UpdateStack actions with your
75	// template; otherwise, those actions return an InsufficientCapabilities error. For
76	// more information, see Acknowledging IAM Resources in AWS CloudFormation
77	// Templates
78	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities).
79	Capabilities []types.Capability
80
81	// The list of resources that generated the values in the Capabilities response
82	// element.
83	CapabilitiesReason *string
84
85	// A list of the transforms that are declared in the template.
86	DeclaredTransforms []string
87
88	// The value that is defined in the Description property of the template.
89	Description *string
90
91	// The value that is defined for the Metadata property of the template.
92	Metadata *string
93
94	// A list of parameter declarations that describe various properties for each
95	// parameter.
96	Parameters []types.ParameterDeclaration
97
98	// A list of resource identifier summaries that describe the target resources of an
99	// import operation and the properties you can provide during the import to
100	// identify the target resources. For example, BucketName is a possible identifier
101	// property for an AWS::S3::Bucket resource.
102	ResourceIdentifierSummaries []types.ResourceIdentifierSummary
103
104	// A list of all the template resource types that are defined in the template, such
105	// as AWS::EC2::Instance, AWS::Dynamo::Table, and Custom::MyCustomInstance.
106	ResourceTypes []string
107
108	// The AWS template format version, which identifies the capabilities of the
109	// template.
110	Version *string
111
112	// Metadata pertaining to the operation's result.
113	ResultMetadata middleware.Metadata
114}
115
116func addOperationGetTemplateSummaryMiddlewares(stack *middleware.Stack, options Options) (err error) {
117	err = stack.Serialize.Add(&awsAwsquery_serializeOpGetTemplateSummary{}, middleware.After)
118	if err != nil {
119		return err
120	}
121	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetTemplateSummary{}, middleware.After)
122	if err != nil {
123		return err
124	}
125	if err = addSetLoggerMiddleware(stack, options); err != nil {
126		return err
127	}
128	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
129		return err
130	}
131	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addResolveEndpointMiddleware(stack, options); err != nil {
135		return err
136	}
137	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
138		return err
139	}
140	if err = addRetryMiddlewares(stack, options); err != nil {
141		return err
142	}
143	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
144		return err
145	}
146	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
147		return err
148	}
149	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
150		return err
151	}
152	if err = addClientUserAgent(stack); err != nil {
153		return err
154	}
155	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
156		return err
157	}
158	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
159		return err
160	}
161	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTemplateSummary(options.Region), middleware.Before); err != nil {
162		return err
163	}
164	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
165		return err
166	}
167	if err = addResponseErrorMiddleware(stack); err != nil {
168		return err
169	}
170	if err = addRequestResponseLogging(stack, options); err != nil {
171		return err
172	}
173	return nil
174}
175
176func newServiceMetadataMiddleware_opGetTemplateSummary(region string) *awsmiddleware.RegisterServiceMetadata {
177	return &awsmiddleware.RegisterServiceMetadata{
178		Region:        region,
179		ServiceID:     ServiceID,
180		SigningName:   "cloudformation",
181		OperationName: "GetTemplateSummary",
182	}
183}
184