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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11	"time"
12)
13
14// Deletes an analysis from Amazon QuickSight. You can optionally include a
15// recovery window during which you can restore the analysis. If you don't specify
16// a recovery window value, the operation defaults to 30 days. QuickSight attaches
17// a DeletionTime stamp to the response that specifies the end of the recovery
18// window. At the end of the recovery window, QuickSight deletes the analysis
19// permanently. At any time before recovery window ends, you can use the
20// RestoreAnalysis API operation to remove the DeletionTime stamp and cancel the
21// deletion of the analysis. The analysis remains visible in the API until it's
22// deleted, so you can describe it but you can't make a template from it. An
23// analysis that's scheduled for deletion isn't accessible in the QuickSight
24// console. To access it in the console, restore it. Deleting an analysis doesn't
25// delete the dashboards that you publish from it.
26func (c *Client) DeleteAnalysis(ctx context.Context, params *DeleteAnalysisInput, optFns ...func(*Options)) (*DeleteAnalysisOutput, error) {
27	if params == nil {
28		params = &DeleteAnalysisInput{}
29	}
30
31	result, metadata, err := c.invokeOperation(ctx, "DeleteAnalysis", params, optFns, addOperationDeleteAnalysisMiddlewares)
32	if err != nil {
33		return nil, err
34	}
35
36	out := result.(*DeleteAnalysisOutput)
37	out.ResultMetadata = metadata
38	return out, nil
39}
40
41type DeleteAnalysisInput struct {
42
43	// The ID of the analysis that you're deleting.
44	//
45	// This member is required.
46	AnalysisId *string
47
48	// The ID of the AWS account where you want to delete an analysis.
49	//
50	// This member is required.
51	AwsAccountId *string
52
53	// This option defaults to the value NoForceDeleteWithoutRecovery. To immediately
54	// delete the analysis, add the ForceDeleteWithoutRecovery option. You can't
55	// restore an analysis after it's deleted.
56	ForceDeleteWithoutRecovery bool
57
58	// A value that specifies the number of days that QuickSight waits before it
59	// deletes the analysis. You can't use this parameter with the
60	// ForceDeleteWithoutRecovery option in the same API call. The default value is 30.
61	RecoveryWindowInDays *int64
62}
63
64type DeleteAnalysisOutput struct {
65
66	// The ID of the deleted analysis.
67	AnalysisId *string
68
69	// The Amazon Resource Name (ARN) of the deleted analysis.
70	Arn *string
71
72	// The date and time that the analysis is scheduled to be deleted.
73	DeletionTime *time.Time
74
75	// The AWS request ID for this operation.
76	RequestId *string
77
78	// The HTTP status of the request.
79	Status int32
80
81	// Metadata pertaining to the operation's result.
82	ResultMetadata middleware.Metadata
83}
84
85func addOperationDeleteAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) {
86	err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteAnalysis{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteAnalysis{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	if err = addSetLoggerMiddleware(stack, options); err != nil {
95		return err
96	}
97	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
98		return err
99	}
100	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
101		return err
102	}
103	if err = addResolveEndpointMiddleware(stack, options); err != nil {
104		return err
105	}
106	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
107		return err
108	}
109	if err = addRetryMiddlewares(stack, options); err != nil {
110		return err
111	}
112	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
119		return err
120	}
121	if err = addClientUserAgent(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addOpDeleteAnalysisValidationMiddleware(stack); err != nil {
131		return err
132	}
133	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAnalysis(options.Region), middleware.Before); err != nil {
134		return err
135	}
136	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addResponseErrorMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addRequestResponseLogging(stack, options); err != nil {
143		return err
144	}
145	return nil
146}
147
148func newServiceMetadataMiddleware_opDeleteAnalysis(region string) *awsmiddleware.RegisterServiceMetadata {
149	return &awsmiddleware.RegisterServiceMetadata{
150		Region:        region,
151		ServiceID:     ServiceID,
152		SigningName:   "quicksight",
153		OperationName: "DeleteAnalysis",
154	}
155}
156