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));
            }
        }
        /// <summary>
        /// Partially modify a Firewall Rule You can use update attributes of a resource
        /// </summary>
        /// <param name="datacenterId"></param>
        /// <param name="serverId"></param>
        /// <param name="nicId"></param>
        /// <param name="firewallruleId"></param>
        /// <param name="firewallrule">Modified Firewall Rule</param>
        /// <param name="parameter">Controls whether response is pretty-printed (with indentation and new lines)</param>
        /// <param name="depth">Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n	- depth=0: only direct properties are included. Children (servers etc.) are not included\n	- depth=1: direct properties and children references are included\n	- depth=2: direct properties and children properties are included\n	- depth=3: direct properties and children properties and children&#39;s children are included\n	- depth=... and so on</param>
        /// <returns>Task of ApiResponse (FirewallRule)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<FirewallRule>> PartialUpdateAsyncWithHttpInfo(string datacenterId, string serverId, string nicId, string firewallruleId, FirewallruleProperties firewallrule, bool? parameter = null, int? depth = null)
        {
            // verify the required parameter 'datacenterId' is set
            if (datacenterId == null) throw new ApiException(400, "Missing required parameter 'datacenterId' when calling PartialUpdate");
            // verify the required parameter 'serverId' is set
            if (serverId == null) throw new ApiException(400, "Missing required parameter 'serverId' when calling PartialUpdate");
            // verify the required parameter 'nicId' is set
            if (nicId == null) throw new ApiException(400, "Missing required parameter 'nicId' when calling PartialUpdate");
            // verify the required parameter 'firewallruleId' is set
            if (firewallruleId == null) throw new ApiException(400, "Missing required parameter 'firewallruleId' when calling PartialUpdate");
            // verify the required parameter 'firewallrule' is set
            if (firewallrule == null) throw new ApiException(400, "Missing required parameter 'firewallrule' when calling PartialUpdate");


            var path_ = "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}";

            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            Object postBody = null;

            // to determine the Content-Type header
            String[] httpContentTypes = new String[] {
                "application/vnd.profitbricks.partial-properties+json", "application/json"
            };
            String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes);

            // to determine the Accept header
            String[] httpHeaderAccepts = new String[] {
                "application/vnd.profitbricks.resource+json"
            };
            String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts);
            if (httpHeaderAccept != null)
                headerParams.Add("Accept", httpHeaderAccept);

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            pathParams.Add("format", "json");
            if (datacenterId != null) pathParams.Add("datacenterId", Configuration.ApiClient.ParameterToString(datacenterId)); // path parameter
            if (serverId != null) pathParams.Add("serverId", Configuration.ApiClient.ParameterToString(serverId)); // path parameter
            if (nicId != null) pathParams.Add("nicId", Configuration.ApiClient.ParameterToString(nicId)); // path parameter
            if (firewallruleId != null) pathParams.Add("firewallruleId", Configuration.ApiClient.ParameterToString(firewallruleId)); // path parameter

            if (parameter != null) queryParams.Add("parameter", Configuration.ApiClient.ParameterToString(parameter)); // query parameter
            if (depth != null) queryParams.Add("depth", Configuration.ApiClient.ParameterToString(depth)); // query parameter



            postBody = Configuration.ApiClient.Serialize(firewallrule); // http body (model) parameter



            // authentication (basicAuth) required

            // http basic authentication required
            if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
            {
                headerParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
            }


            // make the HTTP request
            IRestResponse response = (IRestResponse)await Configuration.ApiClient.CallApiAsync(path_,
                Method.PATCH, queryParams, postBody, headerParams, formParams, fileParams,
                pathParams, httpContentType);

            int statusCode = (int)response.StatusCode;

            if (statusCode >= 400)
                throw new ApiException(statusCode, "Error calling PartialUpdate: " + response.Content, response.Content);
            else if (statusCode == 0)
                throw new ApiException(statusCode, "Error calling PartialUpdate: " + response.ErrorMessage, response.ErrorMessage);

            return new ApiResponse<FirewallRule>(statusCode,
                response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (FirewallRule)Configuration.ApiClient.Deserialize(response, typeof(FirewallRule)));

        }
        /// <summary>
        /// Partially modify a Firewall Rule You can use update attributes of a resource
        /// </summary>
        /// <param name="datacenterId"></param>
        /// <param name="serverId"></param>
        /// <param name="nicId"></param>
        /// <param name="firewallruleId"></param>
        /// <param name="firewallrule">Modified Firewall Rule</param>
        /// <param name="parameter">Controls whether response is pretty-printed (with indentation and new lines)</param>
        /// <param name="depth">Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n	- depth=0: only direct properties are included. Children (servers etc.) are not included\n	- depth=1: direct properties and children references are included\n	- depth=2: direct properties and children properties are included\n	- depth=3: direct properties and children properties and children&#39;s children are included\n	- depth=... and so on</param>
        /// <returns>Task of FirewallRule</returns>
        public async System.Threading.Tasks.Task<FirewallRule> PartialUpdateAsync(string datacenterId, string serverId, string nicId, string firewallruleId, FirewallruleProperties firewallrule, bool? parameter = null, int? depth = null)
        {
            ApiResponse<FirewallRule> response = await PartialUpdateAsyncWithHttpInfo(datacenterId, serverId, nicId, firewallruleId, firewallrule, parameter, depth);
            return response.Data;

        }
 /// <summary>
 /// Partially modify a Firewall Rule You can use update attributes of a resource
 /// </summary>
 /// <param name="datacenterId"></param> 
 /// <param name="serverId"></param> 
 /// <param name="nicId"></param> 
 /// <param name="firewallruleId"></param> 
 /// <param name="firewallrule">Modified Firewall Rule</param> 
 /// <param name="parameter">Controls whether response is pretty-printed (with indentation and new lines)</param> 
 /// <param name="depth">Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n	- depth=0: only direct properties are included. Children (servers etc.) are not included\n	- depth=1: direct properties and children references are included\n	- depth=2: direct properties and children properties are included\n	- depth=3: direct properties and children properties and children&#39;s children are included\n	- depth=... and so on</param> 
 /// <returns>FirewallRule</returns>
 public FirewallRule PartialUpdate(string datacenterId, string serverId, string nicId, string firewallruleId, FirewallruleProperties firewallrule, bool? parameter = null, int? depth = null)
 {
     ApiResponse<FirewallRule> response = PartialUpdateWithHttpInfo(datacenterId, serverId, nicId, firewallruleId, firewallrule, parameter, depth);
     return response.Data;
 }