1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package elasticache
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/elasticache/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Modifies the settings for a Global datastore.
15func (c *Client) ModifyGlobalReplicationGroup(ctx context.Context, params *ModifyGlobalReplicationGroupInput, optFns ...func(*Options)) (*ModifyGlobalReplicationGroupOutput, error) {
16	if params == nil {
17		params = &ModifyGlobalReplicationGroupInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "ModifyGlobalReplicationGroup", params, optFns, c.addOperationModifyGlobalReplicationGroupMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*ModifyGlobalReplicationGroupOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type ModifyGlobalReplicationGroupInput struct {
31
32	// This parameter causes the modifications in this request and any pending
33	// modifications to be applied, asynchronously and as soon as possible.
34	// Modifications to Global Replication Groups cannot be requested to be applied in
35	// PreferredMaintenceWindow.
36	//
37	// This member is required.
38	ApplyImmediately bool
39
40	// The name of the Global datastore
41	//
42	// This member is required.
43	GlobalReplicationGroupId *string
44
45	// Determines whether a read replica is automatically promoted to read/write
46	// primary if the existing primary encounters a failure.
47	AutomaticFailoverEnabled *bool
48
49	// A valid cache node type that you want to scale this Global datastore to.
50	CacheNodeType *string
51
52	// The name of the cache parameter group to use with the Global datastore. It must
53	// be compatible with the major engine version used by the Global datastore.
54	CacheParameterGroupName *string
55
56	// The upgraded version of the cache engine to be run on the clusters in the Global
57	// datastore.
58	EngineVersion *string
59
60	// A description of the Global datastore
61	GlobalReplicationGroupDescription *string
62
63	noSmithyDocumentSerde
64}
65
66type ModifyGlobalReplicationGroupOutput struct {
67
68	// Consists of a primary cluster that accepts writes and an associated secondary
69	// cluster that resides in a different Amazon region. The secondary cluster accepts
70	// only reads. The primary cluster automatically replicates updates to the
71	// secondary cluster.
72	//
73	// * The GlobalReplicationGroupIdSuffix represents the name of
74	// the Global datastore, which is what you use to associate a secondary cluster.
75	GlobalReplicationGroup *types.GlobalReplicationGroup
76
77	// Metadata pertaining to the operation's result.
78	ResultMetadata middleware.Metadata
79
80	noSmithyDocumentSerde
81}
82
83func (c *Client) addOperationModifyGlobalReplicationGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
84	err = stack.Serialize.Add(&awsAwsquery_serializeOpModifyGlobalReplicationGroup{}, middleware.After)
85	if err != nil {
86		return err
87	}
88	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpModifyGlobalReplicationGroup{}, middleware.After)
89	if err != nil {
90		return err
91	}
92	if err = addSetLoggerMiddleware(stack, options); err != nil {
93		return err
94	}
95	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
96		return err
97	}
98	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
99		return err
100	}
101	if err = addResolveEndpointMiddleware(stack, options); err != nil {
102		return err
103	}
104	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
105		return err
106	}
107	if err = addRetryMiddlewares(stack, options); err != nil {
108		return err
109	}
110	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
111		return err
112	}
113	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
114		return err
115	}
116	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
117		return err
118	}
119	if err = addClientUserAgent(stack); err != nil {
120		return err
121	}
122	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
123		return err
124	}
125	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
126		return err
127	}
128	if err = addOpModifyGlobalReplicationGroupValidationMiddleware(stack); err != nil {
129		return err
130	}
131	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opModifyGlobalReplicationGroup(options.Region), middleware.Before); err != nil {
132		return err
133	}
134	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
135		return err
136	}
137	if err = addResponseErrorMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addRequestResponseLogging(stack, options); err != nil {
141		return err
142	}
143	return nil
144}
145
146func newServiceMetadataMiddleware_opModifyGlobalReplicationGroup(region string) *awsmiddleware.RegisterServiceMetadata {
147	return &awsmiddleware.RegisterServiceMetadata{
148		Region:        region,
149		ServiceID:     ServiceID,
150		SigningName:   "elasticache",
151		OperationName: "ModifyGlobalReplicationGroup",
152	}
153}
154