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