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 DB proxy.
15func (c *Client) CreateDBProxy(ctx context.Context, params *CreateDBProxyInput, optFns ...func(*Options)) (*CreateDBProxyOutput, error) {
16	if params == nil {
17		params = &CreateDBProxyInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateDBProxy", params, optFns, addOperationCreateDBProxyMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateDBProxyOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type CreateDBProxyInput struct {
31
32	// The authorization mechanism that the proxy uses.
33	//
34	// This member is required.
35	Auth []types.UserAuthConfig
36
37	// The identifier for the proxy. This name must be unique for all proxies owned by
38	// your AWS account in the specified AWS Region. An identifier must begin with a
39	// letter and must contain only ASCII letters, digits, and hyphens; it can't end
40	// with a hyphen or contain two consecutive hyphens.
41	//
42	// This member is required.
43	DBProxyName *string
44
45	// The kinds of databases that the proxy can connect to. This value determines
46	// which database network protocol the proxy recognizes when it interprets network
47	// traffic to and from the database. The engine family applies to MySQL and
48	// PostgreSQL for both RDS and Aurora.
49	//
50	// This member is required.
51	EngineFamily types.EngineFamily
52
53	// The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access
54	// secrets in AWS Secrets Manager.
55	//
56	// This member is required.
57	RoleArn *string
58
59	// One or more VPC subnet IDs to associate with the new proxy.
60	//
61	// This member is required.
62	VpcSubnetIds []string
63
64	// Whether the proxy includes detailed information about SQL statements in its
65	// logs. This information helps you to debug issues involving SQL behavior or the
66	// performance and scalability of the proxy connections. The debug information
67	// includes the text of SQL statements that you submit through the proxy. Thus,
68	// only enable this setting when needed for debugging, and only when you have
69	// security measures in place to safeguard any sensitive information that appears
70	// in the logs.
71	DebugLogging bool
72
73	// The number of seconds that a connection to the proxy can be inactive before the
74	// proxy disconnects it. You can set this value higher or lower than the connection
75	// timeout limit for the associated database.
76	IdleClientTimeout *int32
77
78	// A Boolean parameter that specifies whether Transport Layer Security (TLS)
79	// encryption is required for connections to the proxy. By enabling this setting,
80	// you can enforce encrypted TLS connections to the proxy.
81	RequireTLS bool
82
83	// An optional set of key-value pairs to associate arbitrary data of your choosing
84	// with the proxy.
85	Tags []types.Tag
86
87	// One or more VPC security group IDs to associate with the new proxy.
88	VpcSecurityGroupIds []string
89}
90
91type CreateDBProxyOutput struct {
92
93	// The DBProxy structure corresponding to the new proxy.
94	DBProxy *types.DBProxy
95
96	// Metadata pertaining to the operation's result.
97	ResultMetadata middleware.Metadata
98}
99
100func addOperationCreateDBProxyMiddlewares(stack *middleware.Stack, options Options) (err error) {
101	err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBProxy{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBProxy{}, middleware.After)
106	if err != nil {
107		return err
108	}
109	if err = addSetLoggerMiddleware(stack, options); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
116		return err
117	}
118	if err = addResolveEndpointMiddleware(stack, options); err != nil {
119		return err
120	}
121	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
122		return err
123	}
124	if err = addRetryMiddlewares(stack, options); err != nil {
125		return err
126	}
127	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
128		return err
129	}
130	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
131		return err
132	}
133	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
134		return err
135	}
136	if err = addClientUserAgent(stack); err != nil {
137		return err
138	}
139	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
140		return err
141	}
142	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addOpCreateDBProxyValidationMiddleware(stack); err != nil {
146		return err
147	}
148	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBProxy(options.Region), middleware.Before); err != nil {
149		return err
150	}
151	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
152		return err
153	}
154	if err = addResponseErrorMiddleware(stack); err != nil {
155		return err
156	}
157	if err = addRequestResponseLogging(stack, options); err != nil {
158		return err
159	}
160	return nil
161}
162
163func newServiceMetadataMiddleware_opCreateDBProxy(region string) *awsmiddleware.RegisterServiceMetadata {
164	return &awsmiddleware.RegisterServiceMetadata{
165		Region:        region,
166		ServiceID:     ServiceID,
167		SigningName:   "rds",
168		OperationName: "CreateDBProxy",
169	}
170}
171