1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package rds
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/rds/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new option group. You can create up to 20 option groups.
15func (c *Client) CreateOptionGroup(ctx context.Context, params *CreateOptionGroupInput, optFns ...func(*Options)) (*CreateOptionGroupOutput, error) {
16	if params == nil {
17		params = &CreateOptionGroupInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateOptionGroup", params, optFns, addOperationCreateOptionGroupMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateOptionGroupOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30//
31type CreateOptionGroupInput struct {
32
33	// Specifies the name of the engine that this option group should be associated
34	// with. Valid Values:
35	//
36	// * mariadb
37	//
38	// * mysql
39	//
40	// * oracle-ee
41	//
42	// * oracle-se2
43	//
44	// *
45	// oracle-se1
46	//
47	// * oracle-se
48	//
49	// * postgres
50	//
51	// * sqlserver-ee
52	//
53	// * sqlserver-se
54	//
55	// *
56	// sqlserver-ex
57	//
58	// * sqlserver-web
59	//
60	// This member is required.
61	EngineName *string
62
63	// Specifies the major version of the engine that this option group should be
64	// associated with.
65	//
66	// This member is required.
67	MajorEngineVersion *string
68
69	// The description of the option group.
70	//
71	// This member is required.
72	OptionGroupDescription *string
73
74	// Specifies the name of the option group to be created. Constraints:
75	//
76	// * Must be 1
77	// to 255 letters, numbers, or hyphens
78	//
79	// * First character must be a letter
80	//
81	// * Can't
82	// end with a hyphen or contain two consecutive hyphens
83	//
84	// Example: myoptiongroup
85	//
86	// This member is required.
87	OptionGroupName *string
88
89	// Tags to assign to the option group.
90	Tags []types.Tag
91}
92
93type CreateOptionGroupOutput struct {
94
95	//
96	OptionGroup *types.OptionGroup
97
98	// Metadata pertaining to the operation's result.
99	ResultMetadata middleware.Metadata
100}
101
102func addOperationCreateOptionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
103	err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateOptionGroup{}, middleware.After)
104	if err != nil {
105		return err
106	}
107	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateOptionGroup{}, middleware.After)
108	if err != nil {
109		return err
110	}
111	if err = addSetLoggerMiddleware(stack, options); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
118		return err
119	}
120	if err = addResolveEndpointMiddleware(stack, options); err != nil {
121		return err
122	}
123	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
124		return err
125	}
126	if err = addRetryMiddlewares(stack, options); err != nil {
127		return err
128	}
129	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
130		return err
131	}
132	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
133		return err
134	}
135	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
136		return err
137	}
138	if err = addClientUserAgent(stack); err != nil {
139		return err
140	}
141	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
142		return err
143	}
144	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addOpCreateOptionGroupValidationMiddleware(stack); err != nil {
148		return err
149	}
150	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateOptionGroup(options.Region), middleware.Before); err != nil {
151		return err
152	}
153	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
154		return err
155	}
156	if err = addResponseErrorMiddleware(stack); err != nil {
157		return err
158	}
159	if err = addRequestResponseLogging(stack, options); err != nil {
160		return err
161	}
162	return nil
163}
164
165func newServiceMetadataMiddleware_opCreateOptionGroup(region string) *awsmiddleware.RegisterServiceMetadata {
166	return &awsmiddleware.RegisterServiceMetadata{
167		Region:        region,
168		ServiceID:     ServiceID,
169		SigningName:   "rds",
170		OperationName: "CreateOptionGroup",
171	}
172}
173