1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package transfer
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/transfer/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Instantiates an autoscaling virtual server based on the selected file transfer
15// protocol in AWS. When you make updates to your file transfer protocol-enabled
16// server or when you work with users, use the service-generated ServerId property
17// that is assigned to the newly created server.
18func (c *Client) CreateServer(ctx context.Context, params *CreateServerInput, optFns ...func(*Options)) (*CreateServerOutput, error) {
19	if params == nil {
20		params = &CreateServerInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "CreateServer", params, optFns, addOperationCreateServerMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*CreateServerOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33type CreateServerInput struct {
34
35	// The Amazon Resource Name (ARN) of the AWS Certificate Manager (ACM) certificate.
36	// Required when Protocols is set to FTPS. To request a new public certificate, see
37	// Request a public certificate
38	// (https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html) in
39	// the AWS Certificate Manager User Guide. To import an existing certificate into
40	// ACM, see Importing certificates into ACM
41	// (https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html) in
42	// the AWS Certificate Manager User Guide. To request a private certificate to use
43	// FTPS through private IP addresses, see Request a private certificate
44	// (https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-private.html)
45	// in the AWS Certificate Manager User Guide. Certificates with the following
46	// cryptographic algorithms and key sizes are supported:
47	//
48	// * 2048-bit RSA
49	// (RSA_2048)
50	//
51	// * 4096-bit RSA (RSA_4096)
52	//
53	// * Elliptic Prime Curve 256 bit
54	// (EC_prime256v1)
55	//
56	// * Elliptic Prime Curve 384 bit (EC_secp384r1)
57	//
58	// * Elliptic Prime
59	// Curve 521 bit (EC_secp521r1)
60	//
61	// The certificate must be a valid SSL/TLS X.509
62	// version 3 certificate with FQDN or IP address specified and information about
63	// the issuer.
64	Certificate *string
65
66	Domain types.Domain
67
68	// The virtual private cloud (VPC) endpoint settings that are configured for your
69	// server. When you host your endpoint within your VPC, you can make it accessible
70	// only to resources within your VPC, or you can attach Elastic IPs and make it
71	// accessible to clients over the internet. Your VPC's default security groups are
72	// automatically assigned to your endpoint.
73	EndpointDetails *types.EndpointDetails
74
75	// The type of VPC endpoint that you want your server to connect to. You can choose
76	// to connect to the public internet or a VPC endpoint. With a VPC endpoint, you
77	// can restrict access to your server and resources only within your VPC. It is
78	// recommended that you use VPC as the EndpointType. With this endpoint type, you
79	// have the option to directly associate up to three Elastic IPv4 addresses (BYO IP
80	// included) with your server's endpoint and use VPC security groups to restrict
81	// traffic by the client's public IP address. This is not possible with
82	// EndpointType set to VPC_ENDPOINT.
83	EndpointType types.EndpointType
84
85	// The RSA private key as generated by the ssh-keygen -N "" -m PEM -f
86	// my-new-server-key command. If you aren't planning to migrate existing users from
87	// an existing SFTP-enabled server to a new server, don't update the host key.
88	// Accidentally changing a server's host key can be disruptive. For more
89	// information, see Change the host key for your SFTP-enabled server
90	// (https://docs.aws.amazon.com/transfer/latest/userguide/edit-server-config.html#configuring-servers-change-host-key)
91	// in the AWS Transfer Family User Guide.
92	HostKey *string
93
94	// Required when IdentityProviderType is set to API_GATEWAY. Accepts an array
95	// containing all of the information required to call a customer-supplied
96	// authentication API, including the API Gateway URL. Not required when
97	// IdentityProviderType is set to SERVICE_MANAGED.
98	IdentityProviderDetails *types.IdentityProviderDetails
99
100	// Specifies the mode of authentication for a server. The default value is
101	// SERVICE_MANAGED, which allows you to store and access user credentials within
102	// the AWS Transfer Family service. Use the API_GATEWAY value to integrate with an
103	// identity provider of your choosing. The API_GATEWAY setting requires you to
104	// provide an API Gateway endpoint URL to call for authentication using the
105	// IdentityProviderDetails parameter.
106	IdentityProviderType types.IdentityProviderType
107
108	// Allows the service to write your users' activity to your Amazon CloudWatch logs
109	// for monitoring and auditing purposes.
110	LoggingRole *string
111
112	// Specifies the file transfer protocol or protocols over which your file transfer
113	// protocol client can connect to your server's endpoint. The available protocols
114	// are:
115	//
116	// * SFTP (Secure Shell (SSH) File Transfer Protocol): File transfer over
117	// SSH
118	//
119	// * FTPS (File Transfer Protocol Secure): File transfer with TLS
120	// encryption
121	//
122	// * FTP (File Transfer Protocol): Unencrypted file transfer
123	//
124	// If you
125	// select FTPS, you must choose a certificate stored in AWS Certificate Manager
126	// (ACM) which will be used to identify your server when clients connect to it over
127	// FTPS. If Protocol includes either FTP or FTPS, then the EndpointType must be VPC
128	// and the IdentityProviderType must be API_GATEWAY. If Protocol includes FTP, then
129	// AddressAllocationIds cannot be associated. If Protocol is set only to SFTP, the
130	// EndpointType can be set to PUBLIC and the IdentityProviderType can be set to
131	// SERVICE_MANAGED.
132	Protocols []types.Protocol
133
134	// Specifies the name of the security policy that is attached to the server.
135	SecurityPolicyName *string
136
137	// Key-value pairs that can be used to group and search for servers.
138	Tags []types.Tag
139}
140
141type CreateServerOutput struct {
142
143	// The service-assigned ID of the server that is created.
144	//
145	// This member is required.
146	ServerId *string
147
148	// Metadata pertaining to the operation's result.
149	ResultMetadata middleware.Metadata
150}
151
152func addOperationCreateServerMiddlewares(stack *middleware.Stack, options Options) (err error) {
153	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateServer{}, middleware.After)
154	if err != nil {
155		return err
156	}
157	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateServer{}, middleware.After)
158	if err != nil {
159		return err
160	}
161	if err = addSetLoggerMiddleware(stack, options); err != nil {
162		return err
163	}
164	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
165		return err
166	}
167	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
168		return err
169	}
170	if err = addResolveEndpointMiddleware(stack, options); err != nil {
171		return err
172	}
173	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
174		return err
175	}
176	if err = addRetryMiddlewares(stack, options); err != nil {
177		return err
178	}
179	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
180		return err
181	}
182	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
183		return err
184	}
185	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
186		return err
187	}
188	if err = addClientUserAgent(stack); err != nil {
189		return err
190	}
191	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
192		return err
193	}
194	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
195		return err
196	}
197	if err = addOpCreateServerValidationMiddleware(stack); err != nil {
198		return err
199	}
200	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateServer(options.Region), middleware.Before); err != nil {
201		return err
202	}
203	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
204		return err
205	}
206	if err = addResponseErrorMiddleware(stack); err != nil {
207		return err
208	}
209	if err = addRequestResponseLogging(stack, options); err != nil {
210		return err
211	}
212	return nil
213}
214
215func newServiceMetadataMiddleware_opCreateServer(region string) *awsmiddleware.RegisterServiceMetadata {
216	return &awsmiddleware.RegisterServiceMetadata{
217		Region:        region,
218		ServiceID:     ServiceID,
219		SigningName:   "transfer",
220		OperationName: "CreateServer",
221	}
222}
223