api_op_StopRelationalDatabase.go raw
1 // Code generated by smithy-go-codegen DO NOT EDIT.
2
3 package lightsail
4
5 import (
6 "context"
7 "fmt"
8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9 "github.com/aws/aws-sdk-go-v2/service/lightsail/types"
10 "github.com/aws/smithy-go/middleware"
11 smithyhttp "github.com/aws/smithy-go/transport/http"
12 )
13
14 // Stops a specific database that is currently running in Amazon Lightsail.
15 //
16 // If you don't manually start your database instance after it has been stopped
17 // for seven consecutive days, Amazon Lightsail automatically starts it for you.
18 // This action helps ensure that your database instance doesn't fall behind on any
19 // required maintenance updates.
20 //
21 // The stop relational database operation supports tag-based access control via
22 // resource tags applied to the resource identified by relationalDatabaseName. For
23 // more information, see the [Amazon Lightsail Developer Guide].
24 //
25 // [Amazon Lightsail Developer Guide]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-controlling-access-using-tags
26 func (c *Client) StopRelationalDatabase(ctx context.Context, params *StopRelationalDatabaseInput, optFns ...func(*Options)) (*StopRelationalDatabaseOutput, error) {
27 if params == nil {
28 params = &StopRelationalDatabaseInput{}
29 }
30
31 result, metadata, err := c.invokeOperation(ctx, "StopRelationalDatabase", params, optFns, c.addOperationStopRelationalDatabaseMiddlewares)
32 if err != nil {
33 return nil, err
34 }
35
36 out := result.(*StopRelationalDatabaseOutput)
37 out.ResultMetadata = metadata
38 return out, nil
39 }
40
41 type StopRelationalDatabaseInput struct {
42
43 // The name of your database to stop.
44 //
45 // This member is required.
46 RelationalDatabaseName *string
47
48 // The name of your new database snapshot to be created before stopping your
49 // database.
50 RelationalDatabaseSnapshotName *string
51
52 noSmithyDocumentSerde
53 }
54
55 type StopRelationalDatabaseOutput struct {
56
57 // An array of objects that describe the result of the action, such as the status
58 // of the request, the timestamp of the request, and the resources affected by the
59 // request.
60 Operations []types.Operation
61
62 // Metadata pertaining to the operation's result.
63 ResultMetadata middleware.Metadata
64
65 noSmithyDocumentSerde
66 }
67
68 func (c *Client) addOperationStopRelationalDatabaseMiddlewares(stack *middleware.Stack, options Options) (err error) {
69 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
70 return err
71 }
72 err = stack.Serialize.Add(&awsAwsjson11_serializeOpStopRelationalDatabase{}, middleware.After)
73 if err != nil {
74 return err
75 }
76 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStopRelationalDatabase{}, middleware.After)
77 if err != nil {
78 return err
79 }
80 if err := addProtocolFinalizerMiddlewares(stack, options, "StopRelationalDatabase"); err != nil {
81 return fmt.Errorf("add protocol finalizers: %v", err)
82 }
83
84 if err = addlegacyEndpointContextSetter(stack, options); err != nil {
85 return err
86 }
87 if err = addSetLoggerMiddleware(stack, options); err != nil {
88 return err
89 }
90 if err = addClientRequestID(stack); err != nil {
91 return err
92 }
93 if err = addComputeContentLength(stack); err != nil {
94 return err
95 }
96 if err = addResolveEndpointMiddleware(stack, options); err != nil {
97 return err
98 }
99 if err = addComputePayloadSHA256(stack); err != nil {
100 return err
101 }
102 if err = addRetry(stack, options); err != nil {
103 return err
104 }
105 if err = addRawResponseToMetadata(stack); err != nil {
106 return err
107 }
108 if err = addRecordResponseTiming(stack); err != nil {
109 return err
110 }
111 if err = addSpanRetryLoop(stack, options); err != nil {
112 return err
113 }
114 if err = addClientUserAgent(stack, options); err != nil {
115 return err
116 }
117 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
118 return err
119 }
120 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
121 return err
122 }
123 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
124 return err
125 }
126 if err = addTimeOffsetBuild(stack, c); err != nil {
127 return err
128 }
129 if err = addUserAgentRetryMode(stack, options); err != nil {
130 return err
131 }
132 if err = addCredentialSource(stack, options); err != nil {
133 return err
134 }
135 if err = addOpStopRelationalDatabaseValidationMiddleware(stack); err != nil {
136 return err
137 }
138 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStopRelationalDatabase(options.Region), middleware.Before); err != nil {
139 return err
140 }
141 if err = addRecursionDetection(stack); err != nil {
142 return err
143 }
144 if err = addRequestIDRetrieverMiddleware(stack); err != nil {
145 return err
146 }
147 if err = addResponseErrorMiddleware(stack); err != nil {
148 return err
149 }
150 if err = addRequestResponseLogging(stack, options); err != nil {
151 return err
152 }
153 if err = addDisableHTTPSMiddleware(stack, options); err != nil {
154 return err
155 }
156 if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
157 return err
158 }
159 if err = addInterceptAttempt(stack, options); err != nil {
160 return err
161 }
162 if err = addInterceptors(stack, options); err != nil {
163 return err
164 }
165 return nil
166 }
167
168 func newServiceMetadataMiddleware_opStopRelationalDatabase(region string) *awsmiddleware.RegisterServiceMetadata {
169 return &awsmiddleware.RegisterServiceMetadata{
170 Region: region,
171 ServiceID: ServiceID,
172 OperationName: "StopRelationalDatabase",
173 }
174 }
175