protected override void BeginProcessing()
        {
            try
            {
                var fwApi = new FirewallRuleApi(Utilities.Configuration);

                var fws = fwApi.Delete(DataCenterId, ServerId, NicId, FirewallRuleId, depth: 5);

                WriteObject("Firewall Rule successfuly deleted.");
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null));
            }
        }
        protected override void BeginProcessing()
        {
            try
            {
                var fwApi = new FirewallRuleApi(Utilities.Configuration);

                var newProps = new FirewallruleProperties
                {
                    PortRangeStart = PortRangeStart == null ? null : PortRangeStart,
                    PortRangeEnd   = PortRangeEnd == null ? null : PortRangeEnd,
                    IcmpType       = IcmpType == null ? null : IcmpType,
                    IcmpCode       = IcmpCode == null ? null : IcmpCode
                };

                if (!string.IsNullOrEmpty(Protocol))
                {
                    newProps.Protocol = Protocol;
                }
                if (!string.IsNullOrEmpty(Name))
                {
                    newProps.Name = Name;
                }
                if (!string.IsNullOrEmpty(SourceMac))
                {
                    newProps.SourceMac = SourceMac;
                }
                if (!string.IsNullOrEmpty(SourceIp))
                {
                    newProps.SourceIp = SourceIp;
                }
                if (!string.IsNullOrEmpty(TargetIp))
                {
                    newProps.TargetIp = TargetIp;
                }

                var fw = fwApi.Create(DataCenterId, ServerId, NicId, new FirewallRule {
                    Properties = newProps
                });

                WriteObject(fw);
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null));
            }
        }
        protected override void BeginProcessing()
        {
            try
            {
                var fwApi = new FirewallRuleApi(Utilities.Configuration);
                if (!string.IsNullOrEmpty(FirewallRuleId))
                {
                    var fw = fwApi.FindById(DataCenterId, ServerId, NicId, FirewallRuleId, depth: 5);

                    WriteObject(fw);
                }
                else
                {
                    var fws = fwApi.FindAll(DataCenterId, ServerId, NicId, depth: 5);

                    WriteObject(fws.Items);
                }
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null));
            }
        }