in functions/source/deepsecurity/api/computers_api.py [0:0]
def modify_computer_setting_with_http_info(self, computer_id, name, value, api_version, **kwargs): # noqa: E501
"""Modify a Computer Setting # noqa: E501
Modify the value for a computer setting. # 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_computer_setting_with_http_info(computer_id, name, value, api_version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int computer_id: The ID number of the policy. (required)
:param str name: The name of the setting. (required)
:param SettingValue value: The new value for the setting. (required)
:param str api_version: The version of the api being called. (required)
:param bool overrides: Show the value only if defined for the current computer.
:return: SettingValue
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['computer_id', 'name', 'value', '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_computer_setting" % 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_computer_setting`") # noqa: E501
# verify the required parameter 'name' is set
if ('name' not in params or
params['name'] is None):
raise ValueError("Missing the required parameter `name` when calling `modify_computer_setting`") # noqa: E501
# verify the required parameter 'value' is set
if ('value' not in params or
params['value'] is None):
raise ValueError("Missing the required parameter `value` when calling `modify_computer_setting`") # 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_computer_setting`") # 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_computer_setting`, 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 'name' in params:
if not type(params['name']) is str and type(params['name']) is property:
camel_case_name = ComputerSettings.attribute_map[params['name'].fget.__name__]
params['name'] = camel_case_name
elif params['name'] in ComputerSettings.attribute_map:
params['name'] = ComputerSettings.attribute_map[params['name']]
path_params['name'] = params['name'] # 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 'value' in params:
body_params = params['value']
# 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}/settings/{name}', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SettingValue', # 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)