1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package databasemigrationservice
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/databasemigrationservice/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates an endpoint using the provided settings.
15func (c *Client) CreateEndpoint(ctx context.Context, params *CreateEndpointInput, optFns ...func(*Options)) (*CreateEndpointOutput, error) {
16	if params == nil {
17		params = &CreateEndpointInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateEndpoint", params, optFns, addOperationCreateEndpointMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateEndpointOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30//
31type CreateEndpointInput struct {
32
33	// The database endpoint identifier. Identifiers must begin with a letter and must
34	// contain only ASCII letters, digits, and hyphens. They can't end with a hyphen,
35	// or contain two consecutive hyphens.
36	//
37	// This member is required.
38	EndpointIdentifier *string
39
40	// The type of endpoint. Valid values are source and target.
41	//
42	// This member is required.
43	EndpointType types.ReplicationEndpointTypeValue
44
45	// The type of engine for the endpoint. Valid values, depending on the EndpointType
46	// value, include "mysql", "oracle", "postgres", "mariadb", "aurora",
47	// "aurora-postgresql", "redshift", "s3", "db2", "azuredb", "sybase", "dynamodb",
48	// "mongodb", "kinesis", "kafka", "elasticsearch", "docdb", "sqlserver", and
49	// "neptune".
50	//
51	// This member is required.
52	EngineName *string
53
54	// The Amazon Resource Name (ARN) for the certificate.
55	CertificateArn *string
56
57	// The name of the endpoint database.
58	DatabaseName *string
59
60	// The settings in JSON format for the DMS transfer type of source endpoint.
61	// Possible settings include the following:
62	//
63	// * ServiceAccessRoleArn - The IAM role
64	// that has permission to access the Amazon S3 bucket.
65	//
66	// * BucketName - The name of
67	// the S3 bucket to use.
68	//
69	// * CompressionType - An optional parameter to use GZIP to
70	// compress the target files. To use GZIP, set this value to NONE (the default). To
71	// keep the files uncompressed, don't use this value.
72	//
73	// Shorthand syntax for these
74	// settings is as follows:
75	// ServiceAccessRoleArn=string,BucketName=string,CompressionType=string JSON syntax
76	// for these settings is as follows: { "ServiceAccessRoleArn": "string",
77	// "BucketName": "string", "CompressionType": "none"|"gzip" }
78	DmsTransferSettings *types.DmsTransferSettings
79
80	// Provides information that defines a DocumentDB endpoint.
81	DocDbSettings *types.DocDbSettings
82
83	// Settings in JSON format for the target Amazon DynamoDB endpoint. For information
84	// about other available settings, see Using Object Mapping to Migrate Data to
85	// DynamoDB
86	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.DynamoDB.html) in
87	// the AWS Database Migration Service User Guide.
88	DynamoDbSettings *types.DynamoDbSettings
89
90	// Settings in JSON format for the target Elasticsearch endpoint. For more
91	// information about the available settings, see Extra Connection Attributes When
92	// Using Elasticsearch as a Target for AWS DMS
93	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Elasticsearch.html#CHAP_Target.Elasticsearch.Configuration)
94	// in the AWS Database Migration Service User Guide.
95	ElasticsearchSettings *types.ElasticsearchSettings
96
97	// The external table definition.
98	ExternalTableDefinition *string
99
100	// Additional attributes associated with the connection. Each attribute is
101	// specified as a name-value pair associated by an equal sign (=). Multiple
102	// attributes are separated by a semicolon (;) with no additional white space. For
103	// information on the attributes available for connecting your source or target
104	// endpoint, see Working with AWS DMS Endpoints
105	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html) in the
106	// AWS Database Migration Service User Guide.
107	ExtraConnectionAttributes *string
108
109	// Settings in JSON format for the source IBM Db2 LUW endpoint. For information
110	// about other available settings, see Extra connection attributes when using Db2
111	// LUW as a source for AWS DMS
112	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.DB2.html) in the
113	// AWS Database Migration Service User Guide.
114	IBMDb2Settings *types.IBMDb2Settings
115
116	// Settings in JSON format for the target Apache Kafka endpoint. For more
117	// information about the available settings, see Using Apache Kafka as a Target for
118	// AWS Database Migration Service
119	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Kafka.html) in the
120	// AWS Database Migration Service User Guide.
121	KafkaSettings *types.KafkaSettings
122
123	// Settings in JSON format for the target endpoint for Amazon Kinesis Data Streams.
124	// For more information about the available settings, see Using Amazon Kinesis Data
125	// Streams as a Target for AWS Database Migration Service
126	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Kinesis.html) in
127	// the AWS Database Migration Service User Guide.
128	KinesisSettings *types.KinesisSettings
129
130	// An AWS KMS key identifier that is used to encrypt the connection parameters for
131	// the endpoint. If you don't specify a value for the KmsKeyId parameter, then AWS
132	// DMS uses your default encryption key. AWS KMS creates the default encryption key
133	// for your AWS account. Your AWS account has a different default encryption key
134	// for each AWS Region.
135	KmsKeyId *string
136
137	// Settings in JSON format for the source and target Microsoft SQL Server endpoint.
138	// For information about other available settings, see Extra connection attributes
139	// when using SQL Server as a source for AWS DMS
140	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.SQLServer.html)
141	// and  Extra connection attributes when using SQL Server as a target for AWS DMS
142	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.SQLServer.html) in
143	// the AWS Database Migration Service User Guide.
144	MicrosoftSQLServerSettings *types.MicrosoftSQLServerSettings
145
146	// Settings in JSON format for the source MongoDB endpoint. For more information
147	// about the available settings, see Using MongoDB as a Target for AWS Database
148	// Migration Service
149	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MongoDB.html#CHAP_Source.MongoDB.Configuration)
150	// in the AWS Database Migration Service User Guide.
151	MongoDbSettings *types.MongoDbSettings
152
153	// Settings in JSON format for the source and target MySQL endpoint. For
154	// information about other available settings, see Extra connection attributes when
155	// using MySQL as a source for AWS DMS
156	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MySQL.html) and
157	// Extra connection attributes when using a MySQL-compatible database as a target
158	// for AWS DMS
159	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.MySQL.html) in the
160	// AWS Database Migration Service User Guide.
161	MySQLSettings *types.MySQLSettings
162
163	// Settings in JSON format for the target Amazon Neptune endpoint. For more
164	// information about the available settings, see Specifying Endpoint Settings for
165	// Amazon Neptune as a Target
166	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Neptune.html#CHAP_Target.Neptune.EndpointSettings)
167	// in the AWS Database Migration Service User Guide.
168	NeptuneSettings *types.NeptuneSettings
169
170	// Settings in JSON format for the source and target Oracle endpoint. For
171	// information about other available settings, see Extra connection attributes when
172	// using Oracle as a source for AWS DMS
173	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.Oracle.html) and
174	// Extra connection attributes when using Oracle as a target for AWS DMS
175	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Oracle.html) in
176	// the AWS Database Migration Service User Guide.
177	OracleSettings *types.OracleSettings
178
179	// The password to be used to log in to the endpoint database.
180	Password *string
181
182	// The port used by the endpoint database.
183	Port *int32
184
185	// Settings in JSON format for the source and target PostgreSQL endpoint. For
186	// information about other available settings, see Extra connection attributes when
187	// using PostgreSQL as a source for AWS DMS
188	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.PostgreSQL.html)
189	// and  Extra connection attributes when using PostgreSQL as a target for AWS DMS
190	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.PostgreSQL.html)
191	// in the AWS Database Migration Service User Guide.
192	PostgreSQLSettings *types.PostgreSQLSettings
193
194	// Provides information that defines an Amazon Redshift endpoint.
195	RedshiftSettings *types.RedshiftSettings
196
197	// A friendly name for the resource identifier at the end of the EndpointArn
198	// response parameter that is returned in the created Endpoint object. The value
199	// for this parameter can have up to 31 characters. It can contain only ASCII
200	// letters, digits, and hyphen ('-'). Also, it can't end with a hyphen or contain
201	// two consecutive hyphens, and can only begin with a letter, such as
202	// Example-App-ARN1. For example, this value might result in the EndpointArn value
203	// arn:aws:dms:eu-west-1:012345678901:rep:Example-App-ARN1. If you don't specify a
204	// ResourceIdentifier value, AWS DMS generates a default identifier value for the
205	// end of EndpointArn.
206	ResourceIdentifier *string
207
208	// Settings in JSON format for the target Amazon S3 endpoint. For more information
209	// about the available settings, see Extra Connection Attributes When Using Amazon
210	// S3 as a Target for AWS DMS
211	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.S3.html#CHAP_Target.S3.Configuring)
212	// in the AWS Database Migration Service User Guide.
213	S3Settings *types.S3Settings
214
215	// The name of the server where the endpoint database resides.
216	ServerName *string
217
218	// The Amazon Resource Name (ARN) for the service access role that you want to use
219	// to create the endpoint.
220	ServiceAccessRoleArn *string
221
222	// The Secure Sockets Layer (SSL) mode to use for the SSL connection. The default
223	// is none
224	SslMode types.DmsSslModeValue
225
226	// Settings in JSON format for the source and target SAP ASE endpoint. For
227	// information about other available settings, see Extra connection attributes when
228	// using SAP ASE as a source for AWS DMS
229	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.SAP.html) and
230	// Extra connection attributes when using SAP ASE as a target for AWS DMS
231	// (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.SAP.html) in the
232	// AWS Database Migration Service User Guide.
233	SybaseSettings *types.SybaseSettings
234
235	// One or more tags to be assigned to the endpoint.
236	Tags []types.Tag
237
238	// The user name to be used to log in to the endpoint database.
239	Username *string
240}
241
242//
243type CreateEndpointOutput struct {
244
245	// The endpoint that was created.
246	Endpoint *types.Endpoint
247
248	// Metadata pertaining to the operation's result.
249	ResultMetadata middleware.Metadata
250}
251
252func addOperationCreateEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
253	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateEndpoint{}, middleware.After)
254	if err != nil {
255		return err
256	}
257	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateEndpoint{}, middleware.After)
258	if err != nil {
259		return err
260	}
261	if err = addSetLoggerMiddleware(stack, options); err != nil {
262		return err
263	}
264	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
265		return err
266	}
267	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
268		return err
269	}
270	if err = addResolveEndpointMiddleware(stack, options); err != nil {
271		return err
272	}
273	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
274		return err
275	}
276	if err = addRetryMiddlewares(stack, options); err != nil {
277		return err
278	}
279	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
280		return err
281	}
282	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
283		return err
284	}
285	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
286		return err
287	}
288	if err = addClientUserAgent(stack); err != nil {
289		return err
290	}
291	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
292		return err
293	}
294	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
295		return err
296	}
297	if err = addOpCreateEndpointValidationMiddleware(stack); err != nil {
298		return err
299	}
300	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEndpoint(options.Region), middleware.Before); err != nil {
301		return err
302	}
303	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
304		return err
305	}
306	if err = addResponseErrorMiddleware(stack); err != nil {
307		return err
308	}
309	if err = addRequestResponseLogging(stack, options); err != nil {
310		return err
311	}
312	return nil
313}
314
315func newServiceMetadataMiddleware_opCreateEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
316	return &awsmiddleware.RegisterServiceMetadata{
317		Region:        region,
318		ServiceID:     ServiceID,
319		SigningName:   "dms",
320		OperationName: "CreateEndpoint",
321	}
322}
323