1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package docdb
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/docdb/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Modifies settings for an instance. You can change one or more database
15// configuration parameters by specifying these parameters and the new values in
16// the request.
17func (c *Client) ModifyDBInstance(ctx context.Context, params *ModifyDBInstanceInput, optFns ...func(*Options)) (*ModifyDBInstanceOutput, error) {
18	if params == nil {
19		params = &ModifyDBInstanceInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "ModifyDBInstance", params, optFns, c.addOperationModifyDBInstanceMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*ModifyDBInstanceOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32// Represents the input to ModifyDBInstance.
33type ModifyDBInstanceInput struct {
34
35	// The instance identifier. This value is stored as a lowercase string.
36	// Constraints:
37	//
38	// * Must match the identifier of an existing DBInstance.
39	//
40	// This member is required.
41	DBInstanceIdentifier *string
42
43	// Specifies whether the modifications in this request and any pending
44	// modifications are asynchronously applied as soon as possible, regardless of the
45	// PreferredMaintenanceWindow setting for the instance. If this parameter is set to
46	// false, changes to the instance are applied during the next maintenance window.
47	// Some parameter changes can cause an outage and are applied on the next reboot.
48	// Default: false
49	ApplyImmediately bool
50
51	// This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB does not
52	// perform minor version upgrades regardless of the value set.
53	AutoMinorVersionUpgrade *bool
54
55	// Indicates the certificate that needs to be associated with the instance.
56	CACertificateIdentifier *string
57
58	// The new compute and memory capacity of the instance; for example, db.r5.large.
59	// Not all instance classes are available in all Regions. If you modify the
60	// instance class, an outage occurs during the change. The change is applied during
61	// the next maintenance window, unless ApplyImmediately is specified as true for
62	// this request. Default: Uses existing setting.
63	DBInstanceClass *string
64
65	// The new instance identifier for the instance when renaming an instance. When you
66	// change the instance identifier, an instance reboot occurs immediately if you set
67	// Apply Immediately to true. It occurs during the next maintenance window if you
68	// set Apply Immediately to false. This value is stored as a lowercase string.
69	// Constraints:
70	//
71	// * Must contain from 1 to 63 letters, numbers, or hyphens.
72	//
73	// * The
74	// first character must be a letter.
75	//
76	// * Cannot end with a hyphen or contain two
77	// consecutive hyphens.
78	//
79	// Example: mydbinstance
80	NewDBInstanceIdentifier *string
81
82	// The weekly time range (in UTC) during which system maintenance can occur, which
83	// might result in an outage. Changing this parameter doesn't result in an outage
84	// except in the following situation, and the change is asynchronously applied as
85	// soon as possible. If there are pending actions that cause a reboot, and the
86	// maintenance window is changed to include the current time, changing this
87	// parameter causes a reboot of the instance. If you are moving this window to the
88	// current time, there must be at least 30 minutes between the current time and end
89	// of the window to ensure that pending changes are applied. Default: Uses existing
90	// setting. Format: ddd:hh24:mi-ddd:hh24:mi Valid days: Mon, Tue, Wed, Thu, Fri,
91	// Sat, Sun Constraints: Must be at least 30 minutes.
92	PreferredMaintenanceWindow *string
93
94	// A value that specifies the order in which an Amazon DocumentDB replica is
95	// promoted to the primary instance after a failure of the existing primary
96	// instance. Default: 1 Valid values: 0-15
97	PromotionTier *int32
98
99	noSmithyDocumentSerde
100}
101
102type ModifyDBInstanceOutput struct {
103
104	// Detailed information about an instance.
105	DBInstance *types.DBInstance
106
107	// Metadata pertaining to the operation's result.
108	ResultMetadata middleware.Metadata
109
110	noSmithyDocumentSerde
111}
112
113func (c *Client) addOperationModifyDBInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
114	err = stack.Serialize.Add(&awsAwsquery_serializeOpModifyDBInstance{}, middleware.After)
115	if err != nil {
116		return err
117	}
118	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpModifyDBInstance{}, middleware.After)
119	if err != nil {
120		return err
121	}
122	if err = addSetLoggerMiddleware(stack, options); err != nil {
123		return err
124	}
125	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addResolveEndpointMiddleware(stack, options); err != nil {
132		return err
133	}
134	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
135		return err
136	}
137	if err = addRetryMiddlewares(stack, options); err != nil {
138		return err
139	}
140	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
141		return err
142	}
143	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
144		return err
145	}
146	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
147		return err
148	}
149	if err = addClientUserAgent(stack); err != nil {
150		return err
151	}
152	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
153		return err
154	}
155	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
156		return err
157	}
158	if err = addOpModifyDBInstanceValidationMiddleware(stack); err != nil {
159		return err
160	}
161	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opModifyDBInstance(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_opModifyDBInstance(region string) *awsmiddleware.RegisterServiceMetadata {
177	return &awsmiddleware.RegisterServiceMetadata{
178		Region:        region,
179		ServiceID:     ServiceID,
180		SigningName:   "rds",
181		OperationName: "ModifyDBInstance",
182	}
183}
184