/******************************************************************************* * Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * ***************************************************************************** * * AWS Tools for Windows (TM) PowerShell (TM) * */ using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using System.Text; using Amazon.PowerShell.Common; using Amazon.Runtime; using Amazon.Transfer; using Amazon.Transfer.Model; namespace Amazon.PowerShell.Cmdlets.TFR { /// /// Updates the file transfer protocol-enabled server's properties after that server has /// been created. /// /// /// /// The UpdateServer call returns the ServerId of the server /// you updated. /// /// [Cmdlet("Update", "TFRServer", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("System.String")] [AWSCmdlet("Calls the AWS Transfer for SFTP UpdateServer API operation.", Operation = new[] {"UpdateServer"}, SelectReturnType = typeof(Amazon.Transfer.Model.UpdateServerResponse))] [AWSCmdletOutput("System.String or Amazon.Transfer.Model.UpdateServerResponse", "This cmdlet returns a System.String object.", "The service call response (type Amazon.Transfer.Model.UpdateServerResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class UpdateTFRServerCmdlet : AmazonTransferClientCmdlet, IExecutor { protected override bool IsSensitiveRequest { get; set; } = true; #region Parameter EndpointDetails_AddressAllocationId /// /// /// A list of address allocation IDs that are required to attach an Elastic IP address /// to your server's endpoint.This property can only be set when EndpointType is set to VPC /// and it is only valid in the UpdateServer API. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("EndpointDetails_AddressAllocationIds")] public System.String[] EndpointDetails_AddressAllocationId { get; set; } #endregion #region Parameter ProtocolDetails_As2Transport /// /// /// Indicates the transport method for the AS2 messages. Currently, only HTTP is supported. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("ProtocolDetails_As2Transports")] public System.String[] ProtocolDetails_As2Transport { get; set; } #endregion #region Parameter Certificate /// /// /// The Amazon Resource Name (ARN) of the Amazon Web ServicesCertificate Manager (ACM) /// certificate. Required when Protocols is set to FTPS.To request a new public certificate, see Request /// a public certificate in the Amazon Web ServicesCertificate Manager User Guide.To import an existing certificate into ACM, see Importing /// certificates into ACM in the Amazon Web ServicesCertificate Manager User Guide.To request a private certificate to use FTPS through private IP addresses, see Request /// a private certificate in the Amazon Web ServicesCertificate Manager User Guide.Certificates with the following cryptographic algorithms and key sizes are supported:The certificate must be a valid SSL/TLS X.509 version 3 certificate with FQDN or IP /// address specified and information about the issuer. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Certificate { get; set; } #endregion #region Parameter IdentityProviderDetails_DirectoryId /// /// /// The identifier of the Directory Service directory that you want to stop sharing. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String IdentityProviderDetails_DirectoryId { get; set; } #endregion #region Parameter EndpointType /// /// /// The type of endpoint that you want your server to use. You can choose to make your /// server's endpoint publicly accessible (PUBLIC) or host it inside your VPC. With an /// endpoint that is hosted in a VPC, you can restrict access to your server and resources /// only within your VPC or choose to make it internet facing by attaching Elastic IP /// addresses directly to it. After May 19, 2021, you won't be able to create a server using EndpointType=VPC_ENDPOINT /// in your Amazon Web Servicesaccount if your account hasn't already done so before May /// 19, 2021. If you have already created servers with EndpointType=VPC_ENDPOINT /// in your Amazon Web Servicesaccount on or before May 19, 2021, you will not be affected. /// After this date, use EndpointType=VPC.For more information, see https://docs.aws.amazon.com/transfer/latest/userguide/create-server-in-vpc.html#deprecate-vpc-endpoint.It is recommended that you use VPC as the EndpointType. /// With this endpoint type, you have the option to directly associate up to three Elastic /// IPv4 addresses (BYO IP included) with your server's endpoint and use VPC security /// groups to restrict traffic by the client's public IP address. This is not possible /// with EndpointType set to VPC_ENDPOINT. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.Transfer.EndpointType")] public Amazon.Transfer.EndpointType EndpointType { get; set; } #endregion #region Parameter IdentityProviderDetails_Function /// /// /// The ARN for a Lambda function to use for the Identity provider. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String IdentityProviderDetails_Function { get; set; } #endregion #region Parameter HostKey /// /// /// The RSA, ECDSA, or ED25519 private key to use for your SFTP-enabled server. You can /// add multiple host keys, in case you want to rotate keys, or have a set of active keys /// that use different algorithms.Use the following command to generate an RSA 2048 bit key with no passphrase:ssh-keygen -t rsa -b 2048 -N "" -m PEM -f my-new-server-key.Use a minimum value of 2048 for the -b option. You can create a stronger /// key by using 3072 or 4096.Use the following command to generate an ECDSA 256 bit key with no passphrase:ssh-keygen -t ecdsa -b 256 -N "" -m PEM -f my-new-server-key.Valid values for the -b option for ECDSA are 256, 384, and 521.Use the following command to generate an ED25519 key with no passphrase:ssh-keygen -t ed25519 -N "" -f my-new-server-key.For all of these commands, you can replace my-new-server-key with a string /// of your choice.If you aren't planning to migrate existing users from an existing SFTP-enabled server /// to a new server, don't update the host key. Accidentally changing a server's host /// key can be disruptive.For more information, see Manage /// host keys for your SFTP-enabled server in the Transfer Family User Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String HostKey { get; set; } #endregion #region Parameter IdentityProviderDetails_InvocationRole /// /// /// This parameter is only applicable if your IdentityProviderType is API_GATEWAY. /// Provides the type of InvocationRole used to authenticate the user account. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String IdentityProviderDetails_InvocationRole { get; set; } #endregion #region Parameter LoggingRole /// /// /// The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role that /// allows a server to turn on Amazon CloudWatch logging for Amazon S3 or Amazon EFSevents. /// When set, you can view user activity in your CloudWatch logs. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String LoggingRole { get; set; } #endregion #region Parameter WorkflowDetails_OnPartialUpload /// /// /// A trigger that starts a workflow if a file is only partially uploaded. You can attach /// a workflow to a server that executes whenever there is a partial upload.A partial upload occurs when a file is open when the session disconnects. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public Amazon.Transfer.Model.WorkflowDetail[] WorkflowDetails_OnPartialUpload { get; set; } #endregion #region Parameter WorkflowDetails_OnUpload /// /// /// A trigger that starts a workflow: the workflow begins to execute after a file is uploaded.To remove an associated workflow from a server, you can provide an empty OnUpload /// object, as in the following example.aws transfer update-server --server-id s-01234567890abcdef --workflow-details /// '{"OnUpload":[]}' /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public Amazon.Transfer.Model.WorkflowDetail[] WorkflowDetails_OnUpload { get; set; } #endregion #region Parameter ProtocolDetails_PassiveIp /// /// /// Indicates passive mode, for FTP and FTPS protocols. Enter a single IPv4 address, /// such as the public IP address of a firewall, router, or load balancer. For example: /// aws transfer update-server --protocol-details PassiveIp=0.0.0.0Replace 0.0.0.0 in the example above with the actual IP address you want /// to use. If you change the PassiveIp value, you must stop and then restart your /// Transfer Family server for the change to take effect. For details on using passive /// mode (PASV) in a NAT environment, see Configuring /// your FTPS server behind a firewall or NAT with Transfer Family. Special valuesThe AUTO and 0.0.0.0 are special values for the PassiveIp /// parameter. The value PassiveIp=AUTO is assigned by default to FTP and /// FTPS type servers. In this case, the server automatically responds with one of the /// endpoint IPs within the PASV response. PassiveIp=0.0.0.0 has a more unique /// application for its usage. For example, if you have a High Availability (HA) Network /// Load Balancer (NLB) environment, where you have 3 subnets, you can only specify a /// single IP address using the PassiveIp parameter. This reduces the effectiveness /// of having High Availability. In this case, you can specify PassiveIp=0.0.0.0. /// This tells the client to use the same IP address as the Control connection and utilize /// all AZs for their connections. Note, however, that not all FTP clients support the /// PassiveIp=0.0.0.0 response. FileZilla and WinSCP do support it. If you /// are using other clients, check to see if your client supports the PassiveIp=0.0.0.0 /// response. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ProtocolDetails_PassiveIp { get; set; } #endregion #region Parameter PostAuthenticationLoginBanner /// /// /// Specifies a string to display when users connect to a server. This string is displayed /// after the user authenticates.The SFTP protocol does not support post-authentication display banners. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String PostAuthenticationLoginBanner { get; set; } #endregion #region Parameter PreAuthenticationLoginBanner /// /// /// Specifies a string to display when users connect to a server. This string is displayed /// before the user authenticates. For example, the following banner displays details /// about using the system:This system is for the use of authorized users only. Individuals using this /// computer system without authority, or in excess of their authority, are subject to /// having all of their activities on this system monitored and recorded by system personnel. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String PreAuthenticationLoginBanner { get; set; } #endregion #region Parameter Protocol /// /// /// Specifies the file transfer protocol or protocols over which your file transfer protocol /// client can connect to your server's endpoint. The available protocols are:
  • If you select FTPS, you must choose a certificate stored in Certificate /// Manager (ACM) which is used to identify your server when clients connect to it over /// FTPS.
  • If Protocol includes either FTP or FTPS, then /// the EndpointType must be VPC and the IdentityProviderType /// must be either AWS_DIRECTORY_SERVICE, AWS_LAMBDA, or API_GATEWAY.
  • If Protocol includes FTP, then AddressAllocationIds /// cannot be associated.
  • If Protocol is set only to SFTP, the EndpointType /// can be set to PUBLIC and the IdentityProviderType can be /// set any of the supported identity types: SERVICE_MANAGED, AWS_DIRECTORY_SERVICE, /// AWS_LAMBDA, or API_GATEWAY.
  • If Protocol includes AS2, then the EndpointType /// must be VPC, and domain must be Amazon S3.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Protocols")] public System.String[] Protocol { get; set; } #endregion #region Parameter EndpointDetails_SecurityGroupId /// /// /// A list of security groups IDs that are available to attach to your server's endpoint.This property can only be set when EndpointType is set to VPC.You can edit the SecurityGroupIds property in the UpdateServer /// API only if you are changing the EndpointType from PUBLIC /// or VPC_ENDPOINT to VPC. To change security groups associated /// with your server's VPC endpoint after creation, use the Amazon EC2 ModifyVpcEndpoint /// API. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("EndpointDetails_SecurityGroupIds")] public System.String[] EndpointDetails_SecurityGroupId { get; set; } #endregion #region Parameter SecurityPolicyName /// /// /// Specifies the name of the security policy that is attached to the server. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String SecurityPolicyName { get; set; } #endregion #region Parameter ServerId /// /// /// A system-assigned unique identifier for a server instance that the Transfer Family /// user is assigned to. /// /// #if !MODULAR [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)] #else [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String ServerId { get; set; } #endregion #region Parameter ProtocolDetails_SetStatOption /// /// /// Use the SetStatOption to ignore the error that is generated when the /// client attempts to use SETSTAT on a file you are uploading to an S3 bucket.Some SFTP file transfer clients can attempt to change the attributes of remote files, /// including timestamp and permissions, using commands, such as SETSTAT /// when uploading the file. However, these commands are not compatible with object storage /// systems, such as Amazon S3. Due to this incompatibility, file uploads from these clients /// can result in errors even when the file is otherwise successfully uploaded.Set the value to ENABLE_NO_OP to have the Transfer Family server ignore /// the SETSTAT command, and upload files without needing to make any changes /// to your SFTP client. While the SetStatOptionENABLE_NO_OP /// setting ignores the error, it does generate a log entry in Amazon CloudWatch Logs, /// so you can determine when the client is making a SETSTAT call.If you want to preserve the original timestamp for your file, and modify other file /// attributes using SETSTAT, you can use Amazon EFS as backend storage with /// Transfer Family. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.Transfer.SetStatOption")] public Amazon.Transfer.SetStatOption ProtocolDetails_SetStatOption { get; set; } #endregion #region Parameter IdentityProviderDetails_SftpAuthenticationMethod /// /// /// For SFTP-enabled servers, and for custom identity providers only, you can specify /// whether to authenticate using a password, SSH key pair, or both. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("IdentityProviderDetails_SftpAuthenticationMethods")] [AWSConstantClassSource("Amazon.Transfer.SftpAuthenticationMethods")] public Amazon.Transfer.SftpAuthenticationMethods IdentityProviderDetails_SftpAuthenticationMethod { get; set; } #endregion #region Parameter StructuredLogDestination /// /// /// Specifies the log groups to which your server logs are sent.To specify a log group, you must provide the ARN for an existing log group. In this /// case, the format of the log group is as follows:arn:aws:logs:region-name:amazon-account-id:log-group:log-group-name:*For example, arn:aws:logs:us-east-1:111122223333:log-group:mytestgroup:*If you have previously specified a log group for a server, you can clear it, and in /// effect turn off structured logging, by providing an empty value for this parameter /// in an update-server call. For example:update-server --server-id s-1234567890abcdef0 --structured-log-destinations /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("StructuredLogDestinations")] public System.String[] StructuredLogDestination { get; set; } #endregion #region Parameter EndpointDetails_SubnetId /// /// /// A list of subnet IDs that are required to host your server endpoint in your VPC.This property can only be set when EndpointType is set to VPC. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("EndpointDetails_SubnetIds")] public System.String[] EndpointDetails_SubnetId { get; set; } #endregion #region Parameter ProtocolDetails_TlsSessionResumptionMode /// /// /// A property used with Transfer Family servers that use the FTPS protocol. TLS Session /// Resumption provides a mechanism to resume or share a negotiated secret key between /// the control and data connection for an FTPS session. TlsSessionResumptionMode /// determines whether or not the server resumes recent, negotiated sessions through a /// unique session ID. This property is available during CreateServer and /// UpdateServer calls. If a TlsSessionResumptionMode value /// is not specified during CreateServer, it is set to ENFORCED /// by default. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.Transfer.TlsSessionResumptionMode")] public Amazon.Transfer.TlsSessionResumptionMode ProtocolDetails_TlsSessionResumptionMode { get; set; } #endregion #region Parameter IdentityProviderDetails_Url /// /// /// Provides the location of the service endpoint used to authenticate users. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String IdentityProviderDetails_Url { get; set; } #endregion #region Parameter EndpointDetails_VpcEndpointId /// /// /// The identifier of the VPC endpoint.This property can only be set when EndpointType is set to VPC_ENDPOINT.For more information, see https://docs.aws.amazon.com/transfer/latest/userguide/create-server-in-vpc.html#deprecate-vpc-endpoint. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String EndpointDetails_VpcEndpointId { get; set; } #endregion #region Parameter EndpointDetails_VpcId /// /// /// The VPC identifier of the VPC in which a server's endpoint will be hosted.This property can only be set when EndpointType is set to VPC. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String EndpointDetails_VpcId { get; set; } #endregion #region Parameter Select /// /// Use the -Select parameter to control the cmdlet output. The default value is 'ServerId'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.Transfer.Model.UpdateServerResponse). /// Specifying the name of a property of type Amazon.Transfer.Model.UpdateServerResponse will result in that property being returned. /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "ServerId"; #endregion #region Parameter PassThru /// /// Changes the cmdlet behavior to return the value passed to the ServerId parameter. /// The -PassThru parameter is deprecated, use -Select '^ServerId' instead. This parameter will be removed in a future version. /// [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^ServerId' instead. This parameter will be removed in a future version.")] [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter PassThru { get; set; } #endregion #region Parameter Force /// /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { this._AWSSignerType = "v4"; base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.ServerId), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-TFRServer (UpdateServer)")) { return; } var context = new CmdletContext(); // allow for manipulation of parameters prior to loading into context PreExecutionContextLoad(context); #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (ParameterWasBound(nameof(this.Select))) { context.Select = CreateSelectDelegate(Select) ?? throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select)); if (this.PassThru.IsPresent) { throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select)); } } else if (this.PassThru.IsPresent) { context.Select = (response, cmdlet) => this.ServerId; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.Certificate = this.Certificate; if (this.EndpointDetails_AddressAllocationId != null) { context.EndpointDetails_AddressAllocationId = new List(this.EndpointDetails_AddressAllocationId); } if (this.EndpointDetails_SecurityGroupId != null) { context.EndpointDetails_SecurityGroupId = new List(this.EndpointDetails_SecurityGroupId); } if (this.EndpointDetails_SubnetId != null) { context.EndpointDetails_SubnetId = new List(this.EndpointDetails_SubnetId); } context.EndpointDetails_VpcEndpointId = this.EndpointDetails_VpcEndpointId; context.EndpointDetails_VpcId = this.EndpointDetails_VpcId; context.EndpointType = this.EndpointType; context.HostKey = this.HostKey; context.IdentityProviderDetails_DirectoryId = this.IdentityProviderDetails_DirectoryId; context.IdentityProviderDetails_Function = this.IdentityProviderDetails_Function; context.IdentityProviderDetails_InvocationRole = this.IdentityProviderDetails_InvocationRole; context.IdentityProviderDetails_SftpAuthenticationMethod = this.IdentityProviderDetails_SftpAuthenticationMethod; context.IdentityProviderDetails_Url = this.IdentityProviderDetails_Url; context.LoggingRole = this.LoggingRole; context.PostAuthenticationLoginBanner = this.PostAuthenticationLoginBanner; context.PreAuthenticationLoginBanner = this.PreAuthenticationLoginBanner; if (this.ProtocolDetails_As2Transport != null) { context.ProtocolDetails_As2Transport = new List(this.ProtocolDetails_As2Transport); } context.ProtocolDetails_PassiveIp = this.ProtocolDetails_PassiveIp; context.ProtocolDetails_SetStatOption = this.ProtocolDetails_SetStatOption; context.ProtocolDetails_TlsSessionResumptionMode = this.ProtocolDetails_TlsSessionResumptionMode; if (this.Protocol != null) { context.Protocol = new List(this.Protocol); } context.SecurityPolicyName = this.SecurityPolicyName; context.ServerId = this.ServerId; #if MODULAR if (this.ServerId == null && ParameterWasBound(nameof(this.ServerId))) { WriteWarning("You are passing $null as a value for parameter ServerId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif if (this.StructuredLogDestination != null) { context.StructuredLogDestination = new List(this.StructuredLogDestination); } if (this.WorkflowDetails_OnPartialUpload != null) { context.WorkflowDetails_OnPartialUpload = new List(this.WorkflowDetails_OnPartialUpload); } if (this.WorkflowDetails_OnUpload != null) { context.WorkflowDetails_OnUpload = new List(this.WorkflowDetails_OnUpload); } // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Transfer.Model.UpdateServerRequest(); if (cmdletContext.Certificate != null) { request.Certificate = cmdletContext.Certificate; } // populate EndpointDetails var requestEndpointDetailsIsNull = true; request.EndpointDetails = new Amazon.Transfer.Model.EndpointDetails(); List requestEndpointDetails_endpointDetails_AddressAllocationId = null; if (cmdletContext.EndpointDetails_AddressAllocationId != null) { requestEndpointDetails_endpointDetails_AddressAllocationId = cmdletContext.EndpointDetails_AddressAllocationId; } if (requestEndpointDetails_endpointDetails_AddressAllocationId != null) { request.EndpointDetails.AddressAllocationIds = requestEndpointDetails_endpointDetails_AddressAllocationId; requestEndpointDetailsIsNull = false; } List requestEndpointDetails_endpointDetails_SecurityGroupId = null; if (cmdletContext.EndpointDetails_SecurityGroupId != null) { requestEndpointDetails_endpointDetails_SecurityGroupId = cmdletContext.EndpointDetails_SecurityGroupId; } if (requestEndpointDetails_endpointDetails_SecurityGroupId != null) { request.EndpointDetails.SecurityGroupIds = requestEndpointDetails_endpointDetails_SecurityGroupId; requestEndpointDetailsIsNull = false; } List requestEndpointDetails_endpointDetails_SubnetId = null; if (cmdletContext.EndpointDetails_SubnetId != null) { requestEndpointDetails_endpointDetails_SubnetId = cmdletContext.EndpointDetails_SubnetId; } if (requestEndpointDetails_endpointDetails_SubnetId != null) { request.EndpointDetails.SubnetIds = requestEndpointDetails_endpointDetails_SubnetId; requestEndpointDetailsIsNull = false; } System.String requestEndpointDetails_endpointDetails_VpcEndpointId = null; if (cmdletContext.EndpointDetails_VpcEndpointId != null) { requestEndpointDetails_endpointDetails_VpcEndpointId = cmdletContext.EndpointDetails_VpcEndpointId; } if (requestEndpointDetails_endpointDetails_VpcEndpointId != null) { request.EndpointDetails.VpcEndpointId = requestEndpointDetails_endpointDetails_VpcEndpointId; requestEndpointDetailsIsNull = false; } System.String requestEndpointDetails_endpointDetails_VpcId = null; if (cmdletContext.EndpointDetails_VpcId != null) { requestEndpointDetails_endpointDetails_VpcId = cmdletContext.EndpointDetails_VpcId; } if (requestEndpointDetails_endpointDetails_VpcId != null) { request.EndpointDetails.VpcId = requestEndpointDetails_endpointDetails_VpcId; requestEndpointDetailsIsNull = false; } // determine if request.EndpointDetails should be set to null if (requestEndpointDetailsIsNull) { request.EndpointDetails = null; } if (cmdletContext.EndpointType != null) { request.EndpointType = cmdletContext.EndpointType; } if (cmdletContext.HostKey != null) { request.HostKey = cmdletContext.HostKey; } // populate IdentityProviderDetails var requestIdentityProviderDetailsIsNull = true; request.IdentityProviderDetails = new Amazon.Transfer.Model.IdentityProviderDetails(); System.String requestIdentityProviderDetails_identityProviderDetails_DirectoryId = null; if (cmdletContext.IdentityProviderDetails_DirectoryId != null) { requestIdentityProviderDetails_identityProviderDetails_DirectoryId = cmdletContext.IdentityProviderDetails_DirectoryId; } if (requestIdentityProviderDetails_identityProviderDetails_DirectoryId != null) { request.IdentityProviderDetails.DirectoryId = requestIdentityProviderDetails_identityProviderDetails_DirectoryId; requestIdentityProviderDetailsIsNull = false; } System.String requestIdentityProviderDetails_identityProviderDetails_Function = null; if (cmdletContext.IdentityProviderDetails_Function != null) { requestIdentityProviderDetails_identityProviderDetails_Function = cmdletContext.IdentityProviderDetails_Function; } if (requestIdentityProviderDetails_identityProviderDetails_Function != null) { request.IdentityProviderDetails.Function = requestIdentityProviderDetails_identityProviderDetails_Function; requestIdentityProviderDetailsIsNull = false; } System.String requestIdentityProviderDetails_identityProviderDetails_InvocationRole = null; if (cmdletContext.IdentityProviderDetails_InvocationRole != null) { requestIdentityProviderDetails_identityProviderDetails_InvocationRole = cmdletContext.IdentityProviderDetails_InvocationRole; } if (requestIdentityProviderDetails_identityProviderDetails_InvocationRole != null) { request.IdentityProviderDetails.InvocationRole = requestIdentityProviderDetails_identityProviderDetails_InvocationRole; requestIdentityProviderDetailsIsNull = false; } Amazon.Transfer.SftpAuthenticationMethods requestIdentityProviderDetails_identityProviderDetails_SftpAuthenticationMethod = null; if (cmdletContext.IdentityProviderDetails_SftpAuthenticationMethod != null) { requestIdentityProviderDetails_identityProviderDetails_SftpAuthenticationMethod = cmdletContext.IdentityProviderDetails_SftpAuthenticationMethod; } if (requestIdentityProviderDetails_identityProviderDetails_SftpAuthenticationMethod != null) { request.IdentityProviderDetails.SftpAuthenticationMethods = requestIdentityProviderDetails_identityProviderDetails_SftpAuthenticationMethod; requestIdentityProviderDetailsIsNull = false; } System.String requestIdentityProviderDetails_identityProviderDetails_Url = null; if (cmdletContext.IdentityProviderDetails_Url != null) { requestIdentityProviderDetails_identityProviderDetails_Url = cmdletContext.IdentityProviderDetails_Url; } if (requestIdentityProviderDetails_identityProviderDetails_Url != null) { request.IdentityProviderDetails.Url = requestIdentityProviderDetails_identityProviderDetails_Url; requestIdentityProviderDetailsIsNull = false; } // determine if request.IdentityProviderDetails should be set to null if (requestIdentityProviderDetailsIsNull) { request.IdentityProviderDetails = null; } if (cmdletContext.LoggingRole != null) { request.LoggingRole = cmdletContext.LoggingRole; } if (cmdletContext.PostAuthenticationLoginBanner != null) { request.PostAuthenticationLoginBanner = cmdletContext.PostAuthenticationLoginBanner; } if (cmdletContext.PreAuthenticationLoginBanner != null) { request.PreAuthenticationLoginBanner = cmdletContext.PreAuthenticationLoginBanner; } // populate ProtocolDetails var requestProtocolDetailsIsNull = true; request.ProtocolDetails = new Amazon.Transfer.Model.ProtocolDetails(); List requestProtocolDetails_protocolDetails_As2Transport = null; if (cmdletContext.ProtocolDetails_As2Transport != null) { requestProtocolDetails_protocolDetails_As2Transport = cmdletContext.ProtocolDetails_As2Transport; } if (requestProtocolDetails_protocolDetails_As2Transport != null) { request.ProtocolDetails.As2Transports = requestProtocolDetails_protocolDetails_As2Transport; requestProtocolDetailsIsNull = false; } System.String requestProtocolDetails_protocolDetails_PassiveIp = null; if (cmdletContext.ProtocolDetails_PassiveIp != null) { requestProtocolDetails_protocolDetails_PassiveIp = cmdletContext.ProtocolDetails_PassiveIp; } if (requestProtocolDetails_protocolDetails_PassiveIp != null) { request.ProtocolDetails.PassiveIp = requestProtocolDetails_protocolDetails_PassiveIp; requestProtocolDetailsIsNull = false; } Amazon.Transfer.SetStatOption requestProtocolDetails_protocolDetails_SetStatOption = null; if (cmdletContext.ProtocolDetails_SetStatOption != null) { requestProtocolDetails_protocolDetails_SetStatOption = cmdletContext.ProtocolDetails_SetStatOption; } if (requestProtocolDetails_protocolDetails_SetStatOption != null) { request.ProtocolDetails.SetStatOption = requestProtocolDetails_protocolDetails_SetStatOption; requestProtocolDetailsIsNull = false; } Amazon.Transfer.TlsSessionResumptionMode requestProtocolDetails_protocolDetails_TlsSessionResumptionMode = null; if (cmdletContext.ProtocolDetails_TlsSessionResumptionMode != null) { requestProtocolDetails_protocolDetails_TlsSessionResumptionMode = cmdletContext.ProtocolDetails_TlsSessionResumptionMode; } if (requestProtocolDetails_protocolDetails_TlsSessionResumptionMode != null) { request.ProtocolDetails.TlsSessionResumptionMode = requestProtocolDetails_protocolDetails_TlsSessionResumptionMode; requestProtocolDetailsIsNull = false; } // determine if request.ProtocolDetails should be set to null if (requestProtocolDetailsIsNull) { request.ProtocolDetails = null; } if (cmdletContext.Protocol != null) { request.Protocols = cmdletContext.Protocol; } if (cmdletContext.SecurityPolicyName != null) { request.SecurityPolicyName = cmdletContext.SecurityPolicyName; } if (cmdletContext.ServerId != null) { request.ServerId = cmdletContext.ServerId; } if (cmdletContext.StructuredLogDestination != null) { request.StructuredLogDestinations = cmdletContext.StructuredLogDestination; } // populate WorkflowDetails var requestWorkflowDetailsIsNull = true; request.WorkflowDetails = new Amazon.Transfer.Model.WorkflowDetails(); List requestWorkflowDetails_workflowDetails_OnPartialUpload = null; if (cmdletContext.WorkflowDetails_OnPartialUpload != null) { requestWorkflowDetails_workflowDetails_OnPartialUpload = cmdletContext.WorkflowDetails_OnPartialUpload; } if (requestWorkflowDetails_workflowDetails_OnPartialUpload != null) { request.WorkflowDetails.OnPartialUpload = requestWorkflowDetails_workflowDetails_OnPartialUpload; requestWorkflowDetailsIsNull = false; } List requestWorkflowDetails_workflowDetails_OnUpload = null; if (cmdletContext.WorkflowDetails_OnUpload != null) { requestWorkflowDetails_workflowDetails_OnUpload = cmdletContext.WorkflowDetails_OnUpload; } if (requestWorkflowDetails_workflowDetails_OnUpload != null) { request.WorkflowDetails.OnUpload = requestWorkflowDetails_workflowDetails_OnUpload; requestWorkflowDetailsIsNull = false; } // determine if request.WorkflowDetails should be set to null if (requestWorkflowDetailsIsNull) { request.WorkflowDetails = null; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return output; } public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.Transfer.Model.UpdateServerResponse CallAWSServiceOperation(IAmazonTransfer client, Amazon.Transfer.Model.UpdateServerRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Transfer for SFTP", "UpdateServer"); try { #if DESKTOP return client.UpdateServer(request); #elif CORECLR return client.UpdateServerAsync(request).GetAwaiter().GetResult(); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.String Certificate { get; set; } public List EndpointDetails_AddressAllocationId { get; set; } public List EndpointDetails_SecurityGroupId { get; set; } public List EndpointDetails_SubnetId { get; set; } public System.String EndpointDetails_VpcEndpointId { get; set; } public System.String EndpointDetails_VpcId { get; set; } public Amazon.Transfer.EndpointType EndpointType { get; set; } public System.String HostKey { get; set; } public System.String IdentityProviderDetails_DirectoryId { get; set; } public System.String IdentityProviderDetails_Function { get; set; } public System.String IdentityProviderDetails_InvocationRole { get; set; } public Amazon.Transfer.SftpAuthenticationMethods IdentityProviderDetails_SftpAuthenticationMethod { get; set; } public System.String IdentityProviderDetails_Url { get; set; } public System.String LoggingRole { get; set; } public System.String PostAuthenticationLoginBanner { get; set; } public System.String PreAuthenticationLoginBanner { get; set; } public List ProtocolDetails_As2Transport { get; set; } public System.String ProtocolDetails_PassiveIp { get; set; } public Amazon.Transfer.SetStatOption ProtocolDetails_SetStatOption { get; set; } public Amazon.Transfer.TlsSessionResumptionMode ProtocolDetails_TlsSessionResumptionMode { get; set; } public List Protocol { get; set; } public System.String SecurityPolicyName { get; set; } public System.String ServerId { get; set; } public List StructuredLogDestination { get; set; } public List WorkflowDetails_OnPartialUpload { get; set; } public List WorkflowDetails_OnUpload { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response.ServerId; } } }