/******************************************************************************* * 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.NetworkFirewall; using Amazon.NetworkFirewall.Model; namespace Amazon.PowerShell.Cmdlets.NWFW { /// /// Updates the properties of the specified firewall policy. /// [Cmdlet("Update", "NWFWFirewallPolicy", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("Amazon.NetworkFirewall.Model.UpdateFirewallPolicyResponse")] [AWSCmdlet("Calls the AWS Network Firewall UpdateFirewallPolicy API operation.", Operation = new[] {"UpdateFirewallPolicy"}, SelectReturnType = typeof(Amazon.NetworkFirewall.Model.UpdateFirewallPolicyResponse))] [AWSCmdletOutput("Amazon.NetworkFirewall.Model.UpdateFirewallPolicyResponse", "This cmdlet returns an Amazon.NetworkFirewall.Model.UpdateFirewallPolicyResponse object containing multiple properties. The object can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class UpdateNWFWFirewallPolicyCmdlet : AmazonNetworkFirewallClientCmdlet, IExecutor { #region Parameter Description /// /// /// A description of the firewall policy. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Description { get; set; } #endregion #region Parameter DryRun /// /// /// Indicates whether you want Network Firewall to just check the validity of the request, /// rather than run the request. If set to TRUE, Network Firewall checks whether the request can run successfully, /// but doesn't actually make the requested changes. The call returns the value that the /// request would return if you ran it with dry run set to FALSE, but doesn't /// make additions or changes to your resources. This option allows you to make sure that /// you have the required permissions to run the request and that your request parameters /// are valid. If set to FALSE, Network Firewall makes the requested changes to your /// resources. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? DryRun { get; set; } #endregion #region Parameter FirewallPolicyArn /// /// /// The Amazon Resource Name (ARN) of the firewall policy.You must specify the ARN or the name, and you can specify both. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String FirewallPolicyArn { get; set; } #endregion #region Parameter FirewallPolicyName /// /// /// The descriptive name of the firewall policy. You can't change the name of a firewall /// policy after you create it.You must specify the ARN or the name, and you can specify both. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String FirewallPolicyName { get; set; } #endregion #region Parameter EncryptionConfiguration_KeyId /// /// /// The ID of the Amazon Web Services Key Management Service (KMS) customer managed key. /// You can use any of the key identifiers that KMS supports, unless you're using a key /// that's managed by another account. If you're using a key managed by another account, /// then specify the key ARN. For more information, see Key /// ID in the Amazon Web Services KMS Developer Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String EncryptionConfiguration_KeyId { get; set; } #endregion #region Parameter StatefulEngineOptions_RuleOrder /// /// /// Indicates how to manage the order of stateful rule evaluation for the policy. DEFAULT_ACTION_ORDER /// is the default behavior. Stateful rules are provided to the rule engine as Suricata /// compatible strings, and Suricata evaluates them based on certain settings. For more /// information, see Evaluation /// order for stateful rules in the Network Firewall Developer Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("FirewallPolicy_StatefulEngineOptions_RuleOrder")] [AWSConstantClassSource("Amazon.NetworkFirewall.RuleOrder")] public Amazon.NetworkFirewall.RuleOrder StatefulEngineOptions_RuleOrder { get; set; } #endregion #region Parameter PolicyVariables_RuleVariable /// /// /// The IPv4 or IPv6 addresses in CIDR notation to use for the Suricata HOME_NET /// variable. If your firewall uses an inspection VPC, you might want to override the /// HOME_NET variable with the CIDRs of your home networks. If you don't /// override HOME_NET with your own CIDRs, Network Firewall by default uses /// the CIDR of your inspection VPC. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("FirewallPolicy_PolicyVariables_RuleVariables")] public System.Collections.Hashtable PolicyVariables_RuleVariable { get; set; } #endregion #region Parameter FirewallPolicy_StatefulDefaultAction /// /// /// The default actions to take on a packet that doesn't match any stateful rules. The /// stateful default action is optional, and is only valid when using the strict rule /// order.Valid values of the stateful default action:For more information, see Strict /// evaluation order in the Network Firewall Developer Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("FirewallPolicy_StatefulDefaultActions")] public System.String[] FirewallPolicy_StatefulDefaultAction { get; set; } #endregion #region Parameter FirewallPolicy_StatefulRuleGroupReference /// /// /// References to the stateful rule groups that are used in the policy. These define the /// inspection criteria in stateful rules. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("FirewallPolicy_StatefulRuleGroupReferences")] public Amazon.NetworkFirewall.Model.StatefulRuleGroupReference[] FirewallPolicy_StatefulRuleGroupReference { get; set; } #endregion #region Parameter FirewallPolicy_StatelessCustomAction /// /// /// The custom action definitions that are available for use in the firewall policy's /// StatelessDefaultActions setting. You name each custom action that you /// define, and then you can use it by name in your default actions specifications. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("FirewallPolicy_StatelessCustomActions")] public Amazon.NetworkFirewall.Model.CustomAction[] FirewallPolicy_StatelessCustomAction { get; set; } #endregion #region Parameter FirewallPolicy_StatelessDefaultAction /// /// /// The actions to take on a packet if it doesn't match any of the stateless rules in /// the policy. If you want non-matching packets to be forwarded for stateful inspection, /// specify aws:forward_to_sfe. You must specify one of the standard actions: aws:pass, aws:drop, /// or aws:forward_to_sfe. In addition, you can specify custom actions that /// are compatible with your standard section choice.For example, you could specify ["aws:pass"] or you could specify ["aws:pass", /// “customActionName”]. For information about compatibility, see the custom action /// descriptions under CustomAction. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyCollection] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("FirewallPolicy_StatelessDefaultActions")] public System.String[] FirewallPolicy_StatelessDefaultAction { get; set; } #endregion #region Parameter FirewallPolicy_StatelessFragmentDefaultAction /// /// /// The actions to take on a fragmented UDP packet if it doesn't match any of the stateless /// rules in the policy. Network Firewall only manages UDP packet fragments and silently /// drops packet fragments for other protocols. If you want non-matching fragmented UDP /// packets to be forwarded for stateful inspection, specify aws:forward_to_sfe. /// You must specify one of the standard actions: aws:pass, aws:drop, /// or aws:forward_to_sfe. In addition, you can specify custom actions that /// are compatible with your standard section choice.For example, you could specify ["aws:pass"] or you could specify ["aws:pass", /// “customActionName”]. For information about compatibility, see the custom action /// descriptions under CustomAction. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyCollection] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("FirewallPolicy_StatelessFragmentDefaultActions")] public System.String[] FirewallPolicy_StatelessFragmentDefaultAction { get; set; } #endregion #region Parameter FirewallPolicy_StatelessRuleGroupReference /// /// /// References to the stateless rule groups that are used in the policy. These define /// the matching criteria in stateless rules. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("FirewallPolicy_StatelessRuleGroupReferences")] public Amazon.NetworkFirewall.Model.StatelessRuleGroupReference[] FirewallPolicy_StatelessRuleGroupReference { get; set; } #endregion #region Parameter StatefulEngineOptions_StreamExceptionPolicy /// /// /// Configures how Network Firewall processes traffic when a network connection breaks /// midstream. Network connections can break due to disruptions in external networks or /// within the firewall itself. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("FirewallPolicy_StatefulEngineOptions_StreamExceptionPolicy")] [AWSConstantClassSource("Amazon.NetworkFirewall.StreamExceptionPolicy")] public Amazon.NetworkFirewall.StreamExceptionPolicy StatefulEngineOptions_StreamExceptionPolicy { get; set; } #endregion #region Parameter FirewallPolicy_TLSInspectionConfigurationArn /// /// /// The Amazon Resource Name (ARN) of the TLS inspection configuration. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String FirewallPolicy_TLSInspectionConfigurationArn { get; set; } #endregion #region Parameter EncryptionConfiguration_Type /// /// /// The type of Amazon Web Services KMS key to use for encryption of your Network Firewall /// resources. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.NetworkFirewall.EncryptionType")] public Amazon.NetworkFirewall.EncryptionType EncryptionConfiguration_Type { get; set; } #endregion #region Parameter UpdateToken /// /// /// A token used for optimistic locking. Network Firewall returns a token to your requests /// that access the firewall policy. The token marks the state of the policy resource /// at the time of the request. To make changes to the policy, you provide the token in your request. Network Firewall /// uses the token to ensure that the policy hasn't changed since you last retrieved it. /// If it has changed, the operation fails with an InvalidTokenException. /// If this happens, retrieve the firewall policy again to get a current copy of it with /// current token. Reapply your changes as needed, then try the operation again using /// the new token. /// /// #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 UpdateToken { get; set; } #endregion #region Parameter Select /// /// Use the -Select parameter to control the cmdlet output. The default value is '*'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.NetworkFirewall.Model.UpdateFirewallPolicyResponse). /// Specifying the name of a property of type Amazon.NetworkFirewall.Model.UpdateFirewallPolicyResponse 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; } = "*"; #endregion #region Parameter PassThru /// /// Changes the cmdlet behavior to return the value passed to the UpdateToken parameter. /// The -PassThru parameter is deprecated, use -Select '^UpdateToken' instead. This parameter will be removed in a future version. /// [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^UpdateToken' 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 = string.Empty; if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-NWFWFirewallPolicy (UpdateFirewallPolicy)")) { 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.UpdateToken; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.Description = this.Description; context.DryRun = this.DryRun; context.EncryptionConfiguration_KeyId = this.EncryptionConfiguration_KeyId; context.EncryptionConfiguration_Type = this.EncryptionConfiguration_Type; if (this.PolicyVariables_RuleVariable != null) { context.PolicyVariables_RuleVariable = new Dictionary(StringComparer.Ordinal); foreach (var hashKey in this.PolicyVariables_RuleVariable.Keys) { context.PolicyVariables_RuleVariable.Add((String)hashKey, (IPSet)(this.PolicyVariables_RuleVariable[hashKey])); } } if (this.FirewallPolicy_StatefulDefaultAction != null) { context.FirewallPolicy_StatefulDefaultAction = new List(this.FirewallPolicy_StatefulDefaultAction); } context.StatefulEngineOptions_RuleOrder = this.StatefulEngineOptions_RuleOrder; context.StatefulEngineOptions_StreamExceptionPolicy = this.StatefulEngineOptions_StreamExceptionPolicy; if (this.FirewallPolicy_StatefulRuleGroupReference != null) { context.FirewallPolicy_StatefulRuleGroupReference = new List(this.FirewallPolicy_StatefulRuleGroupReference); } if (this.FirewallPolicy_StatelessCustomAction != null) { context.FirewallPolicy_StatelessCustomAction = new List(this.FirewallPolicy_StatelessCustomAction); } if (this.FirewallPolicy_StatelessDefaultAction != null) { context.FirewallPolicy_StatelessDefaultAction = new List(this.FirewallPolicy_StatelessDefaultAction); } #if MODULAR if (this.FirewallPolicy_StatelessDefaultAction == null && ParameterWasBound(nameof(this.FirewallPolicy_StatelessDefaultAction))) { WriteWarning("You are passing $null as a value for parameter FirewallPolicy_StatelessDefaultAction 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.FirewallPolicy_StatelessFragmentDefaultAction != null) { context.FirewallPolicy_StatelessFragmentDefaultAction = new List(this.FirewallPolicy_StatelessFragmentDefaultAction); } #if MODULAR if (this.FirewallPolicy_StatelessFragmentDefaultAction == null && ParameterWasBound(nameof(this.FirewallPolicy_StatelessFragmentDefaultAction))) { WriteWarning("You are passing $null as a value for parameter FirewallPolicy_StatelessFragmentDefaultAction 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.FirewallPolicy_StatelessRuleGroupReference != null) { context.FirewallPolicy_StatelessRuleGroupReference = new List(this.FirewallPolicy_StatelessRuleGroupReference); } context.FirewallPolicy_TLSInspectionConfigurationArn = this.FirewallPolicy_TLSInspectionConfigurationArn; context.FirewallPolicyArn = this.FirewallPolicyArn; context.FirewallPolicyName = this.FirewallPolicyName; context.UpdateToken = this.UpdateToken; #if MODULAR if (this.UpdateToken == null && ParameterWasBound(nameof(this.UpdateToken))) { WriteWarning("You are passing $null as a value for parameter UpdateToken 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.NetworkFirewall.Model.UpdateFirewallPolicyRequest(); if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.DryRun != null) { request.DryRun = cmdletContext.DryRun.Value; } // populate EncryptionConfiguration var requestEncryptionConfigurationIsNull = true; request.EncryptionConfiguration = new Amazon.NetworkFirewall.Model.EncryptionConfiguration(); System.String requestEncryptionConfiguration_encryptionConfiguration_KeyId = null; if (cmdletContext.EncryptionConfiguration_KeyId != null) { requestEncryptionConfiguration_encryptionConfiguration_KeyId = cmdletContext.EncryptionConfiguration_KeyId; } if (requestEncryptionConfiguration_encryptionConfiguration_KeyId != null) { request.EncryptionConfiguration.KeyId = requestEncryptionConfiguration_encryptionConfiguration_KeyId; requestEncryptionConfigurationIsNull = false; } Amazon.NetworkFirewall.EncryptionType requestEncryptionConfiguration_encryptionConfiguration_Type = null; if (cmdletContext.EncryptionConfiguration_Type != null) { requestEncryptionConfiguration_encryptionConfiguration_Type = cmdletContext.EncryptionConfiguration_Type; } if (requestEncryptionConfiguration_encryptionConfiguration_Type != null) { request.EncryptionConfiguration.Type = requestEncryptionConfiguration_encryptionConfiguration_Type; requestEncryptionConfigurationIsNull = false; } // determine if request.EncryptionConfiguration should be set to null if (requestEncryptionConfigurationIsNull) { request.EncryptionConfiguration = null; } // populate FirewallPolicy var requestFirewallPolicyIsNull = true; request.FirewallPolicy = new Amazon.NetworkFirewall.Model.FirewallPolicy(); List requestFirewallPolicy_firewallPolicy_StatefulDefaultAction = null; if (cmdletContext.FirewallPolicy_StatefulDefaultAction != null) { requestFirewallPolicy_firewallPolicy_StatefulDefaultAction = cmdletContext.FirewallPolicy_StatefulDefaultAction; } if (requestFirewallPolicy_firewallPolicy_StatefulDefaultAction != null) { request.FirewallPolicy.StatefulDefaultActions = requestFirewallPolicy_firewallPolicy_StatefulDefaultAction; requestFirewallPolicyIsNull = false; } List requestFirewallPolicy_firewallPolicy_StatefulRuleGroupReference = null; if (cmdletContext.FirewallPolicy_StatefulRuleGroupReference != null) { requestFirewallPolicy_firewallPolicy_StatefulRuleGroupReference = cmdletContext.FirewallPolicy_StatefulRuleGroupReference; } if (requestFirewallPolicy_firewallPolicy_StatefulRuleGroupReference != null) { request.FirewallPolicy.StatefulRuleGroupReferences = requestFirewallPolicy_firewallPolicy_StatefulRuleGroupReference; requestFirewallPolicyIsNull = false; } List requestFirewallPolicy_firewallPolicy_StatelessCustomAction = null; if (cmdletContext.FirewallPolicy_StatelessCustomAction != null) { requestFirewallPolicy_firewallPolicy_StatelessCustomAction = cmdletContext.FirewallPolicy_StatelessCustomAction; } if (requestFirewallPolicy_firewallPolicy_StatelessCustomAction != null) { request.FirewallPolicy.StatelessCustomActions = requestFirewallPolicy_firewallPolicy_StatelessCustomAction; requestFirewallPolicyIsNull = false; } List requestFirewallPolicy_firewallPolicy_StatelessDefaultAction = null; if (cmdletContext.FirewallPolicy_StatelessDefaultAction != null) { requestFirewallPolicy_firewallPolicy_StatelessDefaultAction = cmdletContext.FirewallPolicy_StatelessDefaultAction; } if (requestFirewallPolicy_firewallPolicy_StatelessDefaultAction != null) { request.FirewallPolicy.StatelessDefaultActions = requestFirewallPolicy_firewallPolicy_StatelessDefaultAction; requestFirewallPolicyIsNull = false; } List requestFirewallPolicy_firewallPolicy_StatelessFragmentDefaultAction = null; if (cmdletContext.FirewallPolicy_StatelessFragmentDefaultAction != null) { requestFirewallPolicy_firewallPolicy_StatelessFragmentDefaultAction = cmdletContext.FirewallPolicy_StatelessFragmentDefaultAction; } if (requestFirewallPolicy_firewallPolicy_StatelessFragmentDefaultAction != null) { request.FirewallPolicy.StatelessFragmentDefaultActions = requestFirewallPolicy_firewallPolicy_StatelessFragmentDefaultAction; requestFirewallPolicyIsNull = false; } List requestFirewallPolicy_firewallPolicy_StatelessRuleGroupReference = null; if (cmdletContext.FirewallPolicy_StatelessRuleGroupReference != null) { requestFirewallPolicy_firewallPolicy_StatelessRuleGroupReference = cmdletContext.FirewallPolicy_StatelessRuleGroupReference; } if (requestFirewallPolicy_firewallPolicy_StatelessRuleGroupReference != null) { request.FirewallPolicy.StatelessRuleGroupReferences = requestFirewallPolicy_firewallPolicy_StatelessRuleGroupReference; requestFirewallPolicyIsNull = false; } System.String requestFirewallPolicy_firewallPolicy_TLSInspectionConfigurationArn = null; if (cmdletContext.FirewallPolicy_TLSInspectionConfigurationArn != null) { requestFirewallPolicy_firewallPolicy_TLSInspectionConfigurationArn = cmdletContext.FirewallPolicy_TLSInspectionConfigurationArn; } if (requestFirewallPolicy_firewallPolicy_TLSInspectionConfigurationArn != null) { request.FirewallPolicy.TLSInspectionConfigurationArn = requestFirewallPolicy_firewallPolicy_TLSInspectionConfigurationArn; requestFirewallPolicyIsNull = false; } Amazon.NetworkFirewall.Model.PolicyVariables requestFirewallPolicy_firewallPolicy_PolicyVariables = null; // populate PolicyVariables var requestFirewallPolicy_firewallPolicy_PolicyVariablesIsNull = true; requestFirewallPolicy_firewallPolicy_PolicyVariables = new Amazon.NetworkFirewall.Model.PolicyVariables(); Dictionary requestFirewallPolicy_firewallPolicy_PolicyVariables_policyVariables_RuleVariable = null; if (cmdletContext.PolicyVariables_RuleVariable != null) { requestFirewallPolicy_firewallPolicy_PolicyVariables_policyVariables_RuleVariable = cmdletContext.PolicyVariables_RuleVariable; } if (requestFirewallPolicy_firewallPolicy_PolicyVariables_policyVariables_RuleVariable != null) { requestFirewallPolicy_firewallPolicy_PolicyVariables.RuleVariables = requestFirewallPolicy_firewallPolicy_PolicyVariables_policyVariables_RuleVariable; requestFirewallPolicy_firewallPolicy_PolicyVariablesIsNull = false; } // determine if requestFirewallPolicy_firewallPolicy_PolicyVariables should be set to null if (requestFirewallPolicy_firewallPolicy_PolicyVariablesIsNull) { requestFirewallPolicy_firewallPolicy_PolicyVariables = null; } if (requestFirewallPolicy_firewallPolicy_PolicyVariables != null) { request.FirewallPolicy.PolicyVariables = requestFirewallPolicy_firewallPolicy_PolicyVariables; requestFirewallPolicyIsNull = false; } Amazon.NetworkFirewall.Model.StatefulEngineOptions requestFirewallPolicy_firewallPolicy_StatefulEngineOptions = null; // populate StatefulEngineOptions var requestFirewallPolicy_firewallPolicy_StatefulEngineOptionsIsNull = true; requestFirewallPolicy_firewallPolicy_StatefulEngineOptions = new Amazon.NetworkFirewall.Model.StatefulEngineOptions(); Amazon.NetworkFirewall.RuleOrder requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_RuleOrder = null; if (cmdletContext.StatefulEngineOptions_RuleOrder != null) { requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_RuleOrder = cmdletContext.StatefulEngineOptions_RuleOrder; } if (requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_RuleOrder != null) { requestFirewallPolicy_firewallPolicy_StatefulEngineOptions.RuleOrder = requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_RuleOrder; requestFirewallPolicy_firewallPolicy_StatefulEngineOptionsIsNull = false; } Amazon.NetworkFirewall.StreamExceptionPolicy requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_StreamExceptionPolicy = null; if (cmdletContext.StatefulEngineOptions_StreamExceptionPolicy != null) { requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_StreamExceptionPolicy = cmdletContext.StatefulEngineOptions_StreamExceptionPolicy; } if (requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_StreamExceptionPolicy != null) { requestFirewallPolicy_firewallPolicy_StatefulEngineOptions.StreamExceptionPolicy = requestFirewallPolicy_firewallPolicy_StatefulEngineOptions_statefulEngineOptions_StreamExceptionPolicy; requestFirewallPolicy_firewallPolicy_StatefulEngineOptionsIsNull = false; } // determine if requestFirewallPolicy_firewallPolicy_StatefulEngineOptions should be set to null if (requestFirewallPolicy_firewallPolicy_StatefulEngineOptionsIsNull) { requestFirewallPolicy_firewallPolicy_StatefulEngineOptions = null; } if (requestFirewallPolicy_firewallPolicy_StatefulEngineOptions != null) { request.FirewallPolicy.StatefulEngineOptions = requestFirewallPolicy_firewallPolicy_StatefulEngineOptions; requestFirewallPolicyIsNull = false; } // determine if request.FirewallPolicy should be set to null if (requestFirewallPolicyIsNull) { request.FirewallPolicy = null; } if (cmdletContext.FirewallPolicyArn != null) { request.FirewallPolicyArn = cmdletContext.FirewallPolicyArn; } if (cmdletContext.FirewallPolicyName != null) { request.FirewallPolicyName = cmdletContext.FirewallPolicyName; } if (cmdletContext.UpdateToken != null) { request.UpdateToken = cmdletContext.UpdateToken; } 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.NetworkFirewall.Model.UpdateFirewallPolicyResponse CallAWSServiceOperation(IAmazonNetworkFirewall client, Amazon.NetworkFirewall.Model.UpdateFirewallPolicyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Network Firewall", "UpdateFirewallPolicy"); try { #if DESKTOP return client.UpdateFirewallPolicy(request); #elif CORECLR return client.UpdateFirewallPolicyAsync(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 Description { get; set; } public System.Boolean? DryRun { get; set; } public System.String EncryptionConfiguration_KeyId { get; set; } public Amazon.NetworkFirewall.EncryptionType EncryptionConfiguration_Type { get; set; } public Dictionary PolicyVariables_RuleVariable { get; set; } public List FirewallPolicy_StatefulDefaultAction { get; set; } public Amazon.NetworkFirewall.RuleOrder StatefulEngineOptions_RuleOrder { get; set; } public Amazon.NetworkFirewall.StreamExceptionPolicy StatefulEngineOptions_StreamExceptionPolicy { get; set; } public List FirewallPolicy_StatefulRuleGroupReference { get; set; } public List FirewallPolicy_StatelessCustomAction { get; set; } public List FirewallPolicy_StatelessDefaultAction { get; set; } public List FirewallPolicy_StatelessFragmentDefaultAction { get; set; } public List FirewallPolicy_StatelessRuleGroupReference { get; set; } public System.String FirewallPolicy_TLSInspectionConfigurationArn { get; set; } public System.String FirewallPolicyArn { get; set; } public System.String FirewallPolicyName { get; set; } public System.String UpdateToken { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response; } } }