1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package lightsail
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/lightsail/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Allows the update of one or more attributes of a database in Amazon Lightsail.
15// Updates are applied immediately, or in cases where the updates could result in
16// an outage, are applied during the database's predefined maintenance window. The
17// update relational database operation supports tag-based access control via
18// resource tags applied to the resource identified by relationalDatabaseName. For
19// more information, see the Lightsail Dev Guide
20// (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags).
21func (c *Client) UpdateRelationalDatabase(ctx context.Context, params *UpdateRelationalDatabaseInput, optFns ...func(*Options)) (*UpdateRelationalDatabaseOutput, error) {
22	if params == nil {
23		params = &UpdateRelationalDatabaseInput{}
24	}
25
26	result, metadata, err := c.invokeOperation(ctx, "UpdateRelationalDatabase", params, optFns, addOperationUpdateRelationalDatabaseMiddlewares)
27	if err != nil {
28		return nil, err
29	}
30
31	out := result.(*UpdateRelationalDatabaseOutput)
32	out.ResultMetadata = metadata
33	return out, nil
34}
35
36type UpdateRelationalDatabaseInput struct {
37
38	// The name of your Lightsail database resource to update.
39	//
40	// This member is required.
41	RelationalDatabaseName *string
42
43	// When true, applies changes immediately. When false, applies changes during the
44	// preferred maintenance window. Some changes may cause an outage. Default: false
45	ApplyImmediately *bool
46
47	// Indicates the certificate that needs to be associated with the database.
48	CaCertificateIdentifier *string
49
50	// When true, disables automated backup retention for your database. Disabling
51	// backup retention deletes all automated database backups. Before disabling this,
52	// you may want to create a snapshot of your database using the create relational
53	// database snapshot operation. Updates are applied during the next maintenance
54	// window because this can result in an outage.
55	DisableBackupRetention *bool
56
57	// When true, enables automated backup retention for your database. Updates are
58	// applied during the next maintenance window because this can result in an outage.
59	EnableBackupRetention *bool
60
61	// The password for the master user. The password can include any printable ASCII
62	// character except "/", """, or "@". MySQL Constraints: Must contain from 8 to 41
63	// characters. PostgreSQL Constraints: Must contain from 8 to 128 characters.
64	MasterUserPassword *string
65
66	// The daily time range during which automated backups are created for your
67	// database if automated backups are enabled. Constraints:
68	//
69	// * Must be in the
70	// hh24:mi-hh24:mi format. Example: 16:00-16:30
71	//
72	// * Specified in Coordinated
73	// Universal Time (UTC).
74	//
75	// * Must not conflict with the preferred maintenance
76	// window.
77	//
78	// * Must be at least 30 minutes.
79	PreferredBackupWindow *string
80
81	// The weekly time range during which system maintenance can occur on your
82	// database. The default is a 30-minute window selected at random from an 8-hour
83	// block of time for each AWS Region, occurring on a random day of the week.
84	// Constraints:
85	//
86	// * Must be in the ddd:hh24:mi-ddd:hh24:mi format.
87	//
88	// * Valid days:
89	// Mon, Tue, Wed, Thu, Fri, Sat, Sun.
90	//
91	// * Must be at least 30 minutes.
92	//
93	// * Specified
94	// in Coordinated Universal Time (UTC).
95	//
96	// * Example: Tue:17:00-Tue:17:30
97	PreferredMaintenanceWindow *string
98
99	// Specifies the accessibility options for your database. A value of true specifies
100	// a database that is available to resources outside of your Lightsail account. A
101	// value of false specifies a database that is available only to your Lightsail
102	// resources in the same region as your database.
103	PubliclyAccessible *bool
104
105	// When true, the master user password is changed to a new strong password
106	// generated by Lightsail. Use the get relational database master user password
107	// operation to get the new password.
108	RotateMasterUserPassword *bool
109}
110
111type UpdateRelationalDatabaseOutput struct {
112
113	// An array of objects that describe the result of the action, such as the status
114	// of the request, the timestamp of the request, and the resources affected by the
115	// request.
116	Operations []types.Operation
117
118	// Metadata pertaining to the operation's result.
119	ResultMetadata middleware.Metadata
120}
121
122func addOperationUpdateRelationalDatabaseMiddlewares(stack *middleware.Stack, options Options) (err error) {
123	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateRelationalDatabase{}, middleware.After)
124	if err != nil {
125		return err
126	}
127	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateRelationalDatabase{}, middleware.After)
128	if err != nil {
129		return err
130	}
131	if err = addSetLoggerMiddleware(stack, options); err != nil {
132		return err
133	}
134	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
135		return err
136	}
137	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addResolveEndpointMiddleware(stack, options); err != nil {
141		return err
142	}
143	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
144		return err
145	}
146	if err = addRetryMiddlewares(stack, options); err != nil {
147		return err
148	}
149	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
150		return err
151	}
152	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
153		return err
154	}
155	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
156		return err
157	}
158	if err = addClientUserAgent(stack); err != nil {
159		return err
160	}
161	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
162		return err
163	}
164	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
165		return err
166	}
167	if err = addOpUpdateRelationalDatabaseValidationMiddleware(stack); err != nil {
168		return err
169	}
170	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateRelationalDatabase(options.Region), middleware.Before); err != nil {
171		return err
172	}
173	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
174		return err
175	}
176	if err = addResponseErrorMiddleware(stack); err != nil {
177		return err
178	}
179	if err = addRequestResponseLogging(stack, options); err != nil {
180		return err
181	}
182	return nil
183}
184
185func newServiceMetadataMiddleware_opUpdateRelationalDatabase(region string) *awsmiddleware.RegisterServiceMetadata {
186	return &awsmiddleware.RegisterServiceMetadata{
187		Region:        region,
188		ServiceID:     ServiceID,
189		SigningName:   "lightsail",
190		OperationName: "UpdateRelationalDatabase",
191	}
192}
193