/*******************************************************************************
* 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.EC2;
using Amazon.EC2.Model;
namespace Amazon.PowerShell.Cmdlets.EC2
{
///
/// Modifies the options for a VPN tunnel in an Amazon Web Services Site-to-Site VPN connection.
/// You can modify multiple options for a tunnel in a single request, but you can only
/// modify one tunnel at a time. For more information, see Site-to-Site
/// VPN tunnel options for your Site-to-Site VPN connection in the Amazon Web Services
/// Site-to-Site VPN User Guide.
///
[Cmdlet("Edit", "EC2VpnTunnelOption", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType("Amazon.EC2.Model.VpnConnection")]
[AWSCmdlet("Calls the Amazon Elastic Compute Cloud (EC2) ModifyVpnTunnelOptions API operation.", Operation = new[] {"ModifyVpnTunnelOptions"}, SelectReturnType = typeof(Amazon.EC2.Model.ModifyVpnTunnelOptionsResponse))]
[AWSCmdletOutput("Amazon.EC2.Model.VpnConnection or Amazon.EC2.Model.ModifyVpnTunnelOptionsResponse",
"This cmdlet returns an Amazon.EC2.Model.VpnConnection object.",
"The service call response (type Amazon.EC2.Model.ModifyVpnTunnelOptionsResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class EditEC2VpnTunnelOptionCmdlet : AmazonEC2ClientCmdlet, IExecutor
{
protected override bool IsSensitiveRequest { get; set; } = true;
protected override bool IsSensitiveResponse { get; set; } = true;
#region Parameter TunnelOptions_DPDTimeoutAction
///
///
/// The action to take after DPD timeout occurs. Specify restart
to restart
/// the IKE initiation. Specify clear
to end the IKE session.Valid Values: clear
| none
| restart
Default: clear
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String TunnelOptions_DPDTimeoutAction { get; set; }
#endregion
#region Parameter TunnelOptions_DPDTimeoutSecond
///
///
/// The number of seconds after which a DPD timeout occurs.Constraints: A value greater than or equal to 30.Default: 30
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_DPDTimeoutSeconds")]
public System.Int32? TunnelOptions_DPDTimeoutSecond { get; set; }
#endregion
#region Parameter TunnelOptions_EnableTunnelLifecycleControl
///
///
/// Turn on or off tunnel endpoint lifecycle control feature.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? TunnelOptions_EnableTunnelLifecycleControl { get; set; }
#endregion
#region Parameter TunnelOptions_IKEVersion
///
///
/// The IKE versions that are permitted for the VPN tunnel.Valid values: ikev1
| ikev2
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_IKEVersions")]
public Amazon.EC2.Model.IKEVersionsRequestListValue[] TunnelOptions_IKEVersion { get; set; }
#endregion
#region Parameter CloudWatchLogOptions_LogEnabled
///
///
/// Enable or disable VPN tunnel logging feature. Default value is False
.Valid values: True
| False
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_LogOptions_CloudWatchLogOptions_LogEnabled")]
public System.Boolean? CloudWatchLogOptions_LogEnabled { get; set; }
#endregion
#region Parameter CloudWatchLogOptions_LogGroupArn
///
///
/// The Amazon Resource Name (ARN) of the CloudWatch log group to send logs to.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_LogOptions_CloudWatchLogOptions_LogGroupArn")]
public System.String CloudWatchLogOptions_LogGroupArn { get; set; }
#endregion
#region Parameter CloudWatchLogOptions_LogOutputFormat
///
///
/// Set log format. Default format is json
.Valid values: json
| text
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_LogOptions_CloudWatchLogOptions_LogOutputFormat")]
public System.String CloudWatchLogOptions_LogOutputFormat { get; set; }
#endregion
#region Parameter TunnelOptions_Phase1DHGroupNumber
///
///
/// One or more Diffie-Hellman group numbers that are permitted for the VPN tunnel for
/// phase 1 IKE negotiations.Valid values: 2
| 14
| 15
| 16
/// | 17
| 18
| 19
| 20
| 21
/// | 22
| 23
| 24
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase1DHGroupNumbers")]
public Amazon.EC2.Model.Phase1DHGroupNumbersRequestListValue[] TunnelOptions_Phase1DHGroupNumber { get; set; }
#endregion
#region Parameter TunnelOptions_Phase1EncryptionAlgorithm
///
///
/// One or more encryption algorithms that are permitted for the VPN tunnel for phase
/// 1 IKE negotiations.Valid values: AES128
| AES256
| AES128-GCM-16
/// | AES256-GCM-16
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase1EncryptionAlgorithms")]
public Amazon.EC2.Model.Phase1EncryptionAlgorithmsRequestListValue[] TunnelOptions_Phase1EncryptionAlgorithm { get; set; }
#endregion
#region Parameter TunnelOptions_Phase1IntegrityAlgorithm
///
///
/// One or more integrity algorithms that are permitted for the VPN tunnel for phase 1
/// IKE negotiations.Valid values: SHA1
| SHA2-256
| SHA2-384
|
/// SHA2-512
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase1IntegrityAlgorithms")]
public Amazon.EC2.Model.Phase1IntegrityAlgorithmsRequestListValue[] TunnelOptions_Phase1IntegrityAlgorithm { get; set; }
#endregion
#region Parameter TunnelOptions_Phase1LifetimeSecond
///
///
/// The lifetime for phase 1 of the IKE negotiation, in seconds.Constraints: A value between 900 and 28,800.Default: 28800
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase1LifetimeSeconds")]
public System.Int32? TunnelOptions_Phase1LifetimeSecond { get; set; }
#endregion
#region Parameter TunnelOptions_Phase2DHGroupNumber
///
///
/// One or more Diffie-Hellman group numbers that are permitted for the VPN tunnel for
/// phase 2 IKE negotiations.Valid values: 2
| 5
| 14
| 15
/// | 16
| 17
| 18
| 19
| 20
/// | 21
| 22
| 23
| 24
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase2DHGroupNumbers")]
public Amazon.EC2.Model.Phase2DHGroupNumbersRequestListValue[] TunnelOptions_Phase2DHGroupNumber { get; set; }
#endregion
#region Parameter TunnelOptions_Phase2EncryptionAlgorithm
///
///
/// One or more encryption algorithms that are permitted for the VPN tunnel for phase
/// 2 IKE negotiations.Valid values: AES128
| AES256
| AES128-GCM-16
/// | AES256-GCM-16
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase2EncryptionAlgorithms")]
public Amazon.EC2.Model.Phase2EncryptionAlgorithmsRequestListValue[] TunnelOptions_Phase2EncryptionAlgorithm { get; set; }
#endregion
#region Parameter TunnelOptions_Phase2IntegrityAlgorithm
///
///
/// One or more integrity algorithms that are permitted for the VPN tunnel for phase 2
/// IKE negotiations.Valid values: SHA1
| SHA2-256
| SHA2-384
|
/// SHA2-512
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase2IntegrityAlgorithms")]
public Amazon.EC2.Model.Phase2IntegrityAlgorithmsRequestListValue[] TunnelOptions_Phase2IntegrityAlgorithm { get; set; }
#endregion
#region Parameter TunnelOptions_Phase2LifetimeSecond
///
///
/// The lifetime for phase 2 of the IKE negotiation, in seconds.Constraints: A value between 900 and 3,600. The value must be less than the value
/// for Phase1LifetimeSeconds
.Default: 3600
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_Phase2LifetimeSeconds")]
public System.Int32? TunnelOptions_Phase2LifetimeSecond { get; set; }
#endregion
#region Parameter TunnelOptions_PreSharedKey
///
///
/// The pre-shared key (PSK) to establish initial authentication between the virtual private
/// gateway and the customer gateway.Constraints: Allowed characters are alphanumeric characters, periods (.), and underscores
/// (_). Must be between 8 and 64 characters in length and cannot start with zero (0).
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String TunnelOptions_PreSharedKey { get; set; }
#endregion
#region Parameter TunnelOptions_RekeyFuzzPercentage
///
///
/// The percentage of the rekey window (determined by RekeyMarginTimeSeconds
)
/// during which the rekey time is randomly selected.Constraints: A value between 0 and 100.Default: 100
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? TunnelOptions_RekeyFuzzPercentage { get; set; }
#endregion
#region Parameter TunnelOptions_RekeyMarginTimeSecond
///
///
/// The margin time, in seconds, before the phase 2 lifetime expires, during which the
/// Amazon Web Services side of the VPN connection performs an IKE rekey. The exact time
/// of the rekey is randomly selected based on the value for RekeyFuzzPercentage
.Constraints: A value between 60 and half of Phase2LifetimeSeconds
.Default: 540
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("TunnelOptions_RekeyMarginTimeSeconds")]
public System.Int32? TunnelOptions_RekeyMarginTimeSecond { get; set; }
#endregion
#region Parameter TunnelOptions_ReplayWindowSize
///
///
/// The number of packets in an IKE replay window.Constraints: A value between 64 and 2048.Default: 1024
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? TunnelOptions_ReplayWindowSize { get; set; }
#endregion
#region Parameter SkipTunnelReplacement
///
///
/// Choose whether or not to trigger immediate tunnel replacement.Valid values: True
| False
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? SkipTunnelReplacement { get; set; }
#endregion
#region Parameter TunnelOptions_StartupAction
///
///
/// The action to take when the establishing the tunnel for the VPN connection. By default,
/// your customer gateway device must initiate the IKE negotiation and bring up the tunnel.
/// Specify start
for Amazon Web Services to initiate the IKE negotiation.Valid Values: add
| start
Default: add
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String TunnelOptions_StartupAction { get; set; }
#endregion
#region Parameter TunnelOptions_TunnelInsideCidr
///
///
/// The range of inside IPv4 addresses for the tunnel. Any specified CIDR blocks must
/// be unique across all VPN connections that use the same virtual private gateway. Constraints: A size /30 CIDR block from the 169.254.0.0/16
range. The
/// following CIDR blocks are reserved and cannot be used:169.254.0.0/30
169.254.1.0/30
169.254.2.0/30
169.254.3.0/30
169.254.4.0/30
169.254.5.0/30
169.254.169.252/30
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String TunnelOptions_TunnelInsideCidr { get; set; }
#endregion
#region Parameter TunnelOptions_TunnelInsideIpv6Cidr
///
///
/// The range of inside IPv6 addresses for the tunnel. Any specified CIDR blocks must
/// be unique across all VPN connections that use the same transit gateway.Constraints: A size /126 CIDR block from the local fd00::/8
range.
///
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String TunnelOptions_TunnelInsideIpv6Cidr { get; set; }
#endregion
#region Parameter VpnConnectionId
///
///
/// The ID of the Amazon Web Services Site-to-Site VPN connection.
///
///
#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 VpnConnectionId { get; set; }
#endregion
#region Parameter VpnTunnelOutsideIpAddress
///
///
/// The external IP address of the VPN tunnel.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String VpnTunnelOutsideIpAddress { get; set; }
#endregion
#region Parameter Select
///
/// Use the -Select parameter to control the cmdlet output. The default value is 'VpnConnection'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.EC2.Model.ModifyVpnTunnelOptionsResponse).
/// Specifying the name of a property of type Amazon.EC2.Model.ModifyVpnTunnelOptionsResponse 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; } = "VpnConnection";
#endregion
#region Parameter PassThru
///
/// Changes the cmdlet behavior to return the value passed to the VpnConnectionId parameter.
/// The -PassThru parameter is deprecated, use -Select '^VpnConnectionId' instead. This parameter will be removed in a future version.
///
[System.Obsolete("The -PassThru parameter is deprecated, use -Select '^VpnConnectionId' 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.VpnConnectionId), MyInvocation.BoundParameters);
if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Edit-EC2VpnTunnelOption (ModifyVpnTunnelOptions)"))
{
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.VpnConnectionId;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.SkipTunnelReplacement = this.SkipTunnelReplacement;
context.TunnelOptions_DPDTimeoutAction = this.TunnelOptions_DPDTimeoutAction;
context.TunnelOptions_DPDTimeoutSecond = this.TunnelOptions_DPDTimeoutSecond;
context.TunnelOptions_EnableTunnelLifecycleControl = this.TunnelOptions_EnableTunnelLifecycleControl;
if (this.TunnelOptions_IKEVersion != null)
{
context.TunnelOptions_IKEVersion = new List(this.TunnelOptions_IKEVersion);
}
context.CloudWatchLogOptions_LogEnabled = this.CloudWatchLogOptions_LogEnabled;
context.CloudWatchLogOptions_LogGroupArn = this.CloudWatchLogOptions_LogGroupArn;
context.CloudWatchLogOptions_LogOutputFormat = this.CloudWatchLogOptions_LogOutputFormat;
if (this.TunnelOptions_Phase1DHGroupNumber != null)
{
context.TunnelOptions_Phase1DHGroupNumber = new List(this.TunnelOptions_Phase1DHGroupNumber);
}
if (this.TunnelOptions_Phase1EncryptionAlgorithm != null)
{
context.TunnelOptions_Phase1EncryptionAlgorithm = new List(this.TunnelOptions_Phase1EncryptionAlgorithm);
}
if (this.TunnelOptions_Phase1IntegrityAlgorithm != null)
{
context.TunnelOptions_Phase1IntegrityAlgorithm = new List(this.TunnelOptions_Phase1IntegrityAlgorithm);
}
context.TunnelOptions_Phase1LifetimeSecond = this.TunnelOptions_Phase1LifetimeSecond;
if (this.TunnelOptions_Phase2DHGroupNumber != null)
{
context.TunnelOptions_Phase2DHGroupNumber = new List(this.TunnelOptions_Phase2DHGroupNumber);
}
if (this.TunnelOptions_Phase2EncryptionAlgorithm != null)
{
context.TunnelOptions_Phase2EncryptionAlgorithm = new List(this.TunnelOptions_Phase2EncryptionAlgorithm);
}
if (this.TunnelOptions_Phase2IntegrityAlgorithm != null)
{
context.TunnelOptions_Phase2IntegrityAlgorithm = new List(this.TunnelOptions_Phase2IntegrityAlgorithm);
}
context.TunnelOptions_Phase2LifetimeSecond = this.TunnelOptions_Phase2LifetimeSecond;
context.TunnelOptions_PreSharedKey = this.TunnelOptions_PreSharedKey;
context.TunnelOptions_RekeyFuzzPercentage = this.TunnelOptions_RekeyFuzzPercentage;
context.TunnelOptions_RekeyMarginTimeSecond = this.TunnelOptions_RekeyMarginTimeSecond;
context.TunnelOptions_ReplayWindowSize = this.TunnelOptions_ReplayWindowSize;
context.TunnelOptions_StartupAction = this.TunnelOptions_StartupAction;
context.TunnelOptions_TunnelInsideCidr = this.TunnelOptions_TunnelInsideCidr;
context.TunnelOptions_TunnelInsideIpv6Cidr = this.TunnelOptions_TunnelInsideIpv6Cidr;
context.VpnConnectionId = this.VpnConnectionId;
#if MODULAR
if (this.VpnConnectionId == null && ParameterWasBound(nameof(this.VpnConnectionId)))
{
WriteWarning("You are passing $null as a value for parameter VpnConnectionId 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
context.VpnTunnelOutsideIpAddress = this.VpnTunnelOutsideIpAddress;
#if MODULAR
if (this.VpnTunnelOutsideIpAddress == null && ParameterWasBound(nameof(this.VpnTunnelOutsideIpAddress)))
{
WriteWarning("You are passing $null as a value for parameter VpnTunnelOutsideIpAddress 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
// 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.EC2.Model.ModifyVpnTunnelOptionsRequest();
if (cmdletContext.SkipTunnelReplacement != null)
{
request.SkipTunnelReplacement = cmdletContext.SkipTunnelReplacement.Value;
}
// populate TunnelOptions
var requestTunnelOptionsIsNull = true;
request.TunnelOptions = new Amazon.EC2.Model.ModifyVpnTunnelOptionsSpecification();
System.String requestTunnelOptions_tunnelOptions_DPDTimeoutAction = null;
if (cmdletContext.TunnelOptions_DPDTimeoutAction != null)
{
requestTunnelOptions_tunnelOptions_DPDTimeoutAction = cmdletContext.TunnelOptions_DPDTimeoutAction;
}
if (requestTunnelOptions_tunnelOptions_DPDTimeoutAction != null)
{
request.TunnelOptions.DPDTimeoutAction = requestTunnelOptions_tunnelOptions_DPDTimeoutAction;
requestTunnelOptionsIsNull = false;
}
System.Int32? requestTunnelOptions_tunnelOptions_DPDTimeoutSecond = null;
if (cmdletContext.TunnelOptions_DPDTimeoutSecond != null)
{
requestTunnelOptions_tunnelOptions_DPDTimeoutSecond = cmdletContext.TunnelOptions_DPDTimeoutSecond.Value;
}
if (requestTunnelOptions_tunnelOptions_DPDTimeoutSecond != null)
{
request.TunnelOptions.DPDTimeoutSeconds = requestTunnelOptions_tunnelOptions_DPDTimeoutSecond.Value;
requestTunnelOptionsIsNull = false;
}
System.Boolean? requestTunnelOptions_tunnelOptions_EnableTunnelLifecycleControl = null;
if (cmdletContext.TunnelOptions_EnableTunnelLifecycleControl != null)
{
requestTunnelOptions_tunnelOptions_EnableTunnelLifecycleControl = cmdletContext.TunnelOptions_EnableTunnelLifecycleControl.Value;
}
if (requestTunnelOptions_tunnelOptions_EnableTunnelLifecycleControl != null)
{
request.TunnelOptions.EnableTunnelLifecycleControl = requestTunnelOptions_tunnelOptions_EnableTunnelLifecycleControl.Value;
requestTunnelOptionsIsNull = false;
}
List requestTunnelOptions_tunnelOptions_IKEVersion = null;
if (cmdletContext.TunnelOptions_IKEVersion != null)
{
requestTunnelOptions_tunnelOptions_IKEVersion = cmdletContext.TunnelOptions_IKEVersion;
}
if (requestTunnelOptions_tunnelOptions_IKEVersion != null)
{
request.TunnelOptions.IKEVersions = requestTunnelOptions_tunnelOptions_IKEVersion;
requestTunnelOptionsIsNull = false;
}
List requestTunnelOptions_tunnelOptions_Phase1DHGroupNumber = null;
if (cmdletContext.TunnelOptions_Phase1DHGroupNumber != null)
{
requestTunnelOptions_tunnelOptions_Phase1DHGroupNumber = cmdletContext.TunnelOptions_Phase1DHGroupNumber;
}
if (requestTunnelOptions_tunnelOptions_Phase1DHGroupNumber != null)
{
request.TunnelOptions.Phase1DHGroupNumbers = requestTunnelOptions_tunnelOptions_Phase1DHGroupNumber;
requestTunnelOptionsIsNull = false;
}
List requestTunnelOptions_tunnelOptions_Phase1EncryptionAlgorithm = null;
if (cmdletContext.TunnelOptions_Phase1EncryptionAlgorithm != null)
{
requestTunnelOptions_tunnelOptions_Phase1EncryptionAlgorithm = cmdletContext.TunnelOptions_Phase1EncryptionAlgorithm;
}
if (requestTunnelOptions_tunnelOptions_Phase1EncryptionAlgorithm != null)
{
request.TunnelOptions.Phase1EncryptionAlgorithms = requestTunnelOptions_tunnelOptions_Phase1EncryptionAlgorithm;
requestTunnelOptionsIsNull = false;
}
List requestTunnelOptions_tunnelOptions_Phase1IntegrityAlgorithm = null;
if (cmdletContext.TunnelOptions_Phase1IntegrityAlgorithm != null)
{
requestTunnelOptions_tunnelOptions_Phase1IntegrityAlgorithm = cmdletContext.TunnelOptions_Phase1IntegrityAlgorithm;
}
if (requestTunnelOptions_tunnelOptions_Phase1IntegrityAlgorithm != null)
{
request.TunnelOptions.Phase1IntegrityAlgorithms = requestTunnelOptions_tunnelOptions_Phase1IntegrityAlgorithm;
requestTunnelOptionsIsNull = false;
}
System.Int32? requestTunnelOptions_tunnelOptions_Phase1LifetimeSecond = null;
if (cmdletContext.TunnelOptions_Phase1LifetimeSecond != null)
{
requestTunnelOptions_tunnelOptions_Phase1LifetimeSecond = cmdletContext.TunnelOptions_Phase1LifetimeSecond.Value;
}
if (requestTunnelOptions_tunnelOptions_Phase1LifetimeSecond != null)
{
request.TunnelOptions.Phase1LifetimeSeconds = requestTunnelOptions_tunnelOptions_Phase1LifetimeSecond.Value;
requestTunnelOptionsIsNull = false;
}
List requestTunnelOptions_tunnelOptions_Phase2DHGroupNumber = null;
if (cmdletContext.TunnelOptions_Phase2DHGroupNumber != null)
{
requestTunnelOptions_tunnelOptions_Phase2DHGroupNumber = cmdletContext.TunnelOptions_Phase2DHGroupNumber;
}
if (requestTunnelOptions_tunnelOptions_Phase2DHGroupNumber != null)
{
request.TunnelOptions.Phase2DHGroupNumbers = requestTunnelOptions_tunnelOptions_Phase2DHGroupNumber;
requestTunnelOptionsIsNull = false;
}
List requestTunnelOptions_tunnelOptions_Phase2EncryptionAlgorithm = null;
if (cmdletContext.TunnelOptions_Phase2EncryptionAlgorithm != null)
{
requestTunnelOptions_tunnelOptions_Phase2EncryptionAlgorithm = cmdletContext.TunnelOptions_Phase2EncryptionAlgorithm;
}
if (requestTunnelOptions_tunnelOptions_Phase2EncryptionAlgorithm != null)
{
request.TunnelOptions.Phase2EncryptionAlgorithms = requestTunnelOptions_tunnelOptions_Phase2EncryptionAlgorithm;
requestTunnelOptionsIsNull = false;
}
List requestTunnelOptions_tunnelOptions_Phase2IntegrityAlgorithm = null;
if (cmdletContext.TunnelOptions_Phase2IntegrityAlgorithm != null)
{
requestTunnelOptions_tunnelOptions_Phase2IntegrityAlgorithm = cmdletContext.TunnelOptions_Phase2IntegrityAlgorithm;
}
if (requestTunnelOptions_tunnelOptions_Phase2IntegrityAlgorithm != null)
{
request.TunnelOptions.Phase2IntegrityAlgorithms = requestTunnelOptions_tunnelOptions_Phase2IntegrityAlgorithm;
requestTunnelOptionsIsNull = false;
}
System.Int32? requestTunnelOptions_tunnelOptions_Phase2LifetimeSecond = null;
if (cmdletContext.TunnelOptions_Phase2LifetimeSecond != null)
{
requestTunnelOptions_tunnelOptions_Phase2LifetimeSecond = cmdletContext.TunnelOptions_Phase2LifetimeSecond.Value;
}
if (requestTunnelOptions_tunnelOptions_Phase2LifetimeSecond != null)
{
request.TunnelOptions.Phase2LifetimeSeconds = requestTunnelOptions_tunnelOptions_Phase2LifetimeSecond.Value;
requestTunnelOptionsIsNull = false;
}
System.String requestTunnelOptions_tunnelOptions_PreSharedKey = null;
if (cmdletContext.TunnelOptions_PreSharedKey != null)
{
requestTunnelOptions_tunnelOptions_PreSharedKey = cmdletContext.TunnelOptions_PreSharedKey;
}
if (requestTunnelOptions_tunnelOptions_PreSharedKey != null)
{
request.TunnelOptions.PreSharedKey = requestTunnelOptions_tunnelOptions_PreSharedKey;
requestTunnelOptionsIsNull = false;
}
System.Int32? requestTunnelOptions_tunnelOptions_RekeyFuzzPercentage = null;
if (cmdletContext.TunnelOptions_RekeyFuzzPercentage != null)
{
requestTunnelOptions_tunnelOptions_RekeyFuzzPercentage = cmdletContext.TunnelOptions_RekeyFuzzPercentage.Value;
}
if (requestTunnelOptions_tunnelOptions_RekeyFuzzPercentage != null)
{
request.TunnelOptions.RekeyFuzzPercentage = requestTunnelOptions_tunnelOptions_RekeyFuzzPercentage.Value;
requestTunnelOptionsIsNull = false;
}
System.Int32? requestTunnelOptions_tunnelOptions_RekeyMarginTimeSecond = null;
if (cmdletContext.TunnelOptions_RekeyMarginTimeSecond != null)
{
requestTunnelOptions_tunnelOptions_RekeyMarginTimeSecond = cmdletContext.TunnelOptions_RekeyMarginTimeSecond.Value;
}
if (requestTunnelOptions_tunnelOptions_RekeyMarginTimeSecond != null)
{
request.TunnelOptions.RekeyMarginTimeSeconds = requestTunnelOptions_tunnelOptions_RekeyMarginTimeSecond.Value;
requestTunnelOptionsIsNull = false;
}
System.Int32? requestTunnelOptions_tunnelOptions_ReplayWindowSize = null;
if (cmdletContext.TunnelOptions_ReplayWindowSize != null)
{
requestTunnelOptions_tunnelOptions_ReplayWindowSize = cmdletContext.TunnelOptions_ReplayWindowSize.Value;
}
if (requestTunnelOptions_tunnelOptions_ReplayWindowSize != null)
{
request.TunnelOptions.ReplayWindowSize = requestTunnelOptions_tunnelOptions_ReplayWindowSize.Value;
requestTunnelOptionsIsNull = false;
}
System.String requestTunnelOptions_tunnelOptions_StartupAction = null;
if (cmdletContext.TunnelOptions_StartupAction != null)
{
requestTunnelOptions_tunnelOptions_StartupAction = cmdletContext.TunnelOptions_StartupAction;
}
if (requestTunnelOptions_tunnelOptions_StartupAction != null)
{
request.TunnelOptions.StartupAction = requestTunnelOptions_tunnelOptions_StartupAction;
requestTunnelOptionsIsNull = false;
}
System.String requestTunnelOptions_tunnelOptions_TunnelInsideCidr = null;
if (cmdletContext.TunnelOptions_TunnelInsideCidr != null)
{
requestTunnelOptions_tunnelOptions_TunnelInsideCidr = cmdletContext.TunnelOptions_TunnelInsideCidr;
}
if (requestTunnelOptions_tunnelOptions_TunnelInsideCidr != null)
{
request.TunnelOptions.TunnelInsideCidr = requestTunnelOptions_tunnelOptions_TunnelInsideCidr;
requestTunnelOptionsIsNull = false;
}
System.String requestTunnelOptions_tunnelOptions_TunnelInsideIpv6Cidr = null;
if (cmdletContext.TunnelOptions_TunnelInsideIpv6Cidr != null)
{
requestTunnelOptions_tunnelOptions_TunnelInsideIpv6Cidr = cmdletContext.TunnelOptions_TunnelInsideIpv6Cidr;
}
if (requestTunnelOptions_tunnelOptions_TunnelInsideIpv6Cidr != null)
{
request.TunnelOptions.TunnelInsideIpv6Cidr = requestTunnelOptions_tunnelOptions_TunnelInsideIpv6Cidr;
requestTunnelOptionsIsNull = false;
}
Amazon.EC2.Model.VpnTunnelLogOptionsSpecification requestTunnelOptions_tunnelOptions_LogOptions = null;
// populate LogOptions
var requestTunnelOptions_tunnelOptions_LogOptionsIsNull = true;
requestTunnelOptions_tunnelOptions_LogOptions = new Amazon.EC2.Model.VpnTunnelLogOptionsSpecification();
Amazon.EC2.Model.CloudWatchLogOptionsSpecification requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions = null;
// populate CloudWatchLogOptions
var requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptionsIsNull = true;
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions = new Amazon.EC2.Model.CloudWatchLogOptionsSpecification();
System.Boolean? requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogEnabled = null;
if (cmdletContext.CloudWatchLogOptions_LogEnabled != null)
{
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogEnabled = cmdletContext.CloudWatchLogOptions_LogEnabled.Value;
}
if (requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogEnabled != null)
{
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions.LogEnabled = requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogEnabled.Value;
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptionsIsNull = false;
}
System.String requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogGroupArn = null;
if (cmdletContext.CloudWatchLogOptions_LogGroupArn != null)
{
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogGroupArn = cmdletContext.CloudWatchLogOptions_LogGroupArn;
}
if (requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogGroupArn != null)
{
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions.LogGroupArn = requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogGroupArn;
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptionsIsNull = false;
}
System.String requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogOutputFormat = null;
if (cmdletContext.CloudWatchLogOptions_LogOutputFormat != null)
{
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogOutputFormat = cmdletContext.CloudWatchLogOptions_LogOutputFormat;
}
if (requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogOutputFormat != null)
{
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions.LogOutputFormat = requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions_cloudWatchLogOptions_LogOutputFormat;
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptionsIsNull = false;
}
// determine if requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions should be set to null
if (requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptionsIsNull)
{
requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions = null;
}
if (requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions != null)
{
requestTunnelOptions_tunnelOptions_LogOptions.CloudWatchLogOptions = requestTunnelOptions_tunnelOptions_LogOptions_tunnelOptions_LogOptions_CloudWatchLogOptions;
requestTunnelOptions_tunnelOptions_LogOptionsIsNull = false;
}
// determine if requestTunnelOptions_tunnelOptions_LogOptions should be set to null
if (requestTunnelOptions_tunnelOptions_LogOptionsIsNull)
{
requestTunnelOptions_tunnelOptions_LogOptions = null;
}
if (requestTunnelOptions_tunnelOptions_LogOptions != null)
{
request.TunnelOptions.LogOptions = requestTunnelOptions_tunnelOptions_LogOptions;
requestTunnelOptionsIsNull = false;
}
// determine if request.TunnelOptions should be set to null
if (requestTunnelOptionsIsNull)
{
request.TunnelOptions = null;
}
if (cmdletContext.VpnConnectionId != null)
{
request.VpnConnectionId = cmdletContext.VpnConnectionId;
}
if (cmdletContext.VpnTunnelOutsideIpAddress != null)
{
request.VpnTunnelOutsideIpAddress = cmdletContext.VpnTunnelOutsideIpAddress;
}
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.EC2.Model.ModifyVpnTunnelOptionsResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.ModifyVpnTunnelOptionsRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "ModifyVpnTunnelOptions");
try
{
#if DESKTOP
return client.ModifyVpnTunnelOptions(request);
#elif CORECLR
return client.ModifyVpnTunnelOptionsAsync(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.Boolean? SkipTunnelReplacement { get; set; }
public System.String TunnelOptions_DPDTimeoutAction { get; set; }
public System.Int32? TunnelOptions_DPDTimeoutSecond { get; set; }
public System.Boolean? TunnelOptions_EnableTunnelLifecycleControl { get; set; }
public List TunnelOptions_IKEVersion { get; set; }
public System.Boolean? CloudWatchLogOptions_LogEnabled { get; set; }
public System.String CloudWatchLogOptions_LogGroupArn { get; set; }
public System.String CloudWatchLogOptions_LogOutputFormat { get; set; }
public List TunnelOptions_Phase1DHGroupNumber { get; set; }
public List TunnelOptions_Phase1EncryptionAlgorithm { get; set; }
public List TunnelOptions_Phase1IntegrityAlgorithm { get; set; }
public System.Int32? TunnelOptions_Phase1LifetimeSecond { get; set; }
public List TunnelOptions_Phase2DHGroupNumber { get; set; }
public List TunnelOptions_Phase2EncryptionAlgorithm { get; set; }
public List TunnelOptions_Phase2IntegrityAlgorithm { get; set; }
public System.Int32? TunnelOptions_Phase2LifetimeSecond { get; set; }
public System.String TunnelOptions_PreSharedKey { get; set; }
public System.Int32? TunnelOptions_RekeyFuzzPercentage { get; set; }
public System.Int32? TunnelOptions_RekeyMarginTimeSecond { get; set; }
public System.Int32? TunnelOptions_ReplayWindowSize { get; set; }
public System.String TunnelOptions_StartupAction { get; set; }
public System.String TunnelOptions_TunnelInsideCidr { get; set; }
public System.String TunnelOptions_TunnelInsideIpv6Cidr { get; set; }
public System.String VpnConnectionId { get; set; }
public System.String VpnTunnelOutsideIpAddress { get; set; }
public System.Func Select { get; set; } =
(response, cmdlet) => response.VpnConnection;
}
}
}