1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package quicksight
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/quicksight/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Updates a template from an existing Amazon QuickSight analysis or another
15// template.
16func (c *Client) UpdateTemplate(ctx context.Context, params *UpdateTemplateInput, optFns ...func(*Options)) (*UpdateTemplateOutput, error) {
17	if params == nil {
18		params = &UpdateTemplateInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "UpdateTemplate", params, optFns, addOperationUpdateTemplateMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*UpdateTemplateOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type UpdateTemplateInput struct {
32
33	// The ID of the AWS account that contains the template that you're updating.
34	//
35	// This member is required.
36	AwsAccountId *string
37
38	// The entity that you are using as a source when you update the template. In
39	// SourceEntity, you specify the type of object you're using as source:
40	// SourceTemplate for a template or SourceAnalysis for an analysis. Both of these
41	// require an Amazon Resource Name (ARN). For SourceTemplate, specify the ARN of
42	// the source template. For SourceAnalysis, specify the ARN of the source analysis.
43	// The SourceTemplate ARN can contain any AWS Account and any QuickSight-supported
44	// AWS Region. Use the DataSetReferences entity within SourceTemplate or
45	// SourceAnalysis to list the replacement datasets for the placeholders listed in
46	// the original. The schema in each dataset must match its placeholder.
47	//
48	// This member is required.
49	SourceEntity *types.TemplateSourceEntity
50
51	// The ID for the template.
52	//
53	// This member is required.
54	TemplateId *string
55
56	// The name for the template.
57	Name *string
58
59	// A description of the current template version that is being updated. Every time
60	// you call UpdateTemplate, you create a new version of the template. Each version
61	// of the template maintains a description of the version in the VersionDescription
62	// field.
63	VersionDescription *string
64}
65
66type UpdateTemplateOutput struct {
67
68	// The Amazon Resource Name (ARN) for the template.
69	Arn *string
70
71	// The creation status of the template.
72	CreationStatus types.ResourceStatus
73
74	// The AWS request ID for this operation.
75	RequestId *string
76
77	// The HTTP status of the request.
78	Status int32
79
80	// The ID for the template.
81	TemplateId *string
82
83	// The ARN for the template, including the version information of the first
84	// version.
85	VersionArn *string
86
87	// Metadata pertaining to the operation's result.
88	ResultMetadata middleware.Metadata
89}
90
91func addOperationUpdateTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) {
92	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateTemplate{}, middleware.After)
93	if err != nil {
94		return err
95	}
96	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateTemplate{}, middleware.After)
97	if err != nil {
98		return err
99	}
100	if err = addSetLoggerMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
104		return err
105	}
106	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
107		return err
108	}
109	if err = addResolveEndpointMiddleware(stack, options); err != nil {
110		return err
111	}
112	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
113		return err
114	}
115	if err = addRetryMiddlewares(stack, options); err != nil {
116		return err
117	}
118	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
122		return err
123	}
124	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
125		return err
126	}
127	if err = addClientUserAgent(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
131		return err
132	}
133	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addOpUpdateTemplateValidationMiddleware(stack); err != nil {
137		return err
138	}
139	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateTemplate(options.Region), middleware.Before); err != nil {
140		return err
141	}
142	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addResponseErrorMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addRequestResponseLogging(stack, options); err != nil {
149		return err
150	}
151	return nil
152}
153
154func newServiceMetadataMiddleware_opUpdateTemplate(region string) *awsmiddleware.RegisterServiceMetadata {
155	return &awsmiddleware.RegisterServiceMetadata{
156		Region:        region,
157		ServiceID:     ServiceID,
158		SigningName:   "quicksight",
159		OperationName: "UpdateTemplate",
160	}
161}
162