in functions/source/deepsecurity/api/computer_firewall_rule_details_api.py [0:0]
def modify_firewall_rule_on_computer_with_http_info(self, computer_id, firewall_rule_id, firewall_rule, api_version, **kwargs): # noqa: E501
"""Modify a firewall rule # noqa: E501
Modify a firewall rule assigned to a computer. Any unset elements will be left unchanged. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.modify_firewall_rule_on_computer_with_http_info(computer_id, firewall_rule_id, firewall_rule, api_version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int computer_id: The ID number of the computer. (required)
:param int firewall_rule_id: The ID number of the firewall rule to modify. (required)
:param FirewallRule firewall_rule: The settings of the firewall rule to modify. (required)
:param str api_version: The version of the api being called. (required)
:param bool overrides: Show only overrides defined for the current computer.
:return: FirewallRule
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['computer_id', 'firewall_rule_id', 'firewall_rule', 'api_version', 'overrides'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method modify_firewall_rule_on_computer" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'computer_id' is set
if ('computer_id' not in params or
params['computer_id'] is None):
raise ValueError("Missing the required parameter `computer_id` when calling `modify_firewall_rule_on_computer`") # noqa: E501
# verify the required parameter 'firewall_rule_id' is set
if ('firewall_rule_id' not in params or
params['firewall_rule_id'] is None):
raise ValueError("Missing the required parameter `firewall_rule_id` when calling `modify_firewall_rule_on_computer`") # noqa: E501
# verify the required parameter 'firewall_rule' is set
if ('firewall_rule' not in params or
params['firewall_rule'] is None):
raise ValueError("Missing the required parameter `firewall_rule` when calling `modify_firewall_rule_on_computer`") # noqa: E501
# verify the required parameter 'api_version' is set
if ('api_version' not in params or
params['api_version'] is None):
raise ValueError("Missing the required parameter `api_version` when calling `modify_firewall_rule_on_computer`") # noqa: E501
if 'computer_id' in params and not re.search('\\d+', str(params['computer_id'])): # noqa: E501
raise ValueError("Invalid value for parameter `computer_id` when calling `modify_firewall_rule_on_computer`, must conform to the pattern `/\\d+/`") # noqa: E501
if 'firewall_rule_id' in params and not re.search('\\d+', str(params['firewall_rule_id'])): # noqa: E501
raise ValueError("Invalid value for parameter `firewall_rule_id` when calling `modify_firewall_rule_on_computer`, must conform to the pattern `/\\d+/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'computer_id' in params:
path_params['computerID'] = params['computer_id'] # noqa: E501
if 'firewall_rule_id' in params:
path_params['firewallRuleID'] = params['firewall_rule_id'] # noqa: E501
query_params = []
if 'overrides' in params:
query_params.append(('overrides', params['overrides'])) # noqa: E501
header_params = {}
if 'api_version' in params:
header_params['api-version'] = params['api_version'] # noqa: E501
form_params = []
local_var_files = {}
body_params = None
if 'firewall_rule' in params:
body_params = params['firewall_rule']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['DefaultAuthentication'] # noqa: E501
return self.api_client.call_api(
'/computers/{computerID}/firewall/rules/{firewallRuleID}', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='FirewallRule', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)