From: garciadeblas Date: Fri, 22 Nov 2019 21:18:09 +0000 (+0100) Subject: Use of PATCH method instead of PUT for projects X-Git-Tag: v7.0.0rc1~6 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=0eefdebca0e3eefaf207bc22bebf5128a7b7717a;p=osm%2Fosmclient.git Use of PATCH method instead of PUT for projects This applies to projects, users, roles, vims, wims and sdncontrollers Change-Id: I81badf6f4117d26c8a8f613336dba520377f9612 Signed-off-by: garciadeblas --- diff --git a/osmclient/sol005/project.py b/osmclient/sol005/project.py index fe0f23c..19a27c3 100644 --- a/osmclient/sol005/project.py +++ b/osmclient/sol005/project.py @@ -64,7 +64,7 @@ class Project(object): """ self._client.get_token() proj = self.get(project) - http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase, proj['_id']), + http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase, proj['_id']), postfields_dict=project_changes) # print('HTTP CODE: {}'.format(http_code)) # print('RESP: {}'.format(resp)) diff --git a/osmclient/sol005/role.py b/osmclient/sol005/role.py index faa381b..01f3bc3 100644 --- a/osmclient/sol005/role.py +++ b/osmclient/sol005/role.py @@ -143,7 +143,7 @@ class Role(object): if not new_role_obj["permissions"]: del new_role_obj["permissions"] - http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase, role_obj['_id']), + http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase, role_obj['_id']), postfields_dict=new_role_obj) # print('HTTP CODE: {}'.format(http_code)) # print('RESP: {}'.format(resp)) diff --git a/osmclient/sol005/sdncontroller.py b/osmclient/sol005/sdncontroller.py index 690fa07..4f3ced4 100644 --- a/osmclient/sol005/sdncontroller.py +++ b/osmclient/sol005/sdncontroller.py @@ -88,7 +88,7 @@ class SdnController(object): self._client.get_token() sdnc = self.get(name) sdnc_id_for_wait = self._get_id_for_wait(name) - http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,sdnc['_id']), + http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase,sdnc['_id']), postfields_dict=sdn_controller) # print('HTTP CODE: {}'.format(http_code)) # print('RESP: {}'.format(resp)) diff --git a/osmclient/sol005/user.py b/osmclient/sol005/user.py index 689d359..64d5c69 100644 --- a/osmclient/sol005/user.py +++ b/osmclient/sol005/user.py @@ -140,7 +140,7 @@ class User(object): if not update_user: raise ClientException("At least something should be changed.") - http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase, myuser['_id']), + http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase, myuser['_id']), postfields_dict=update_user) # print('HTTP CODE: {}'.format(http_code)) # print('RESP: {}'.format(resp)) diff --git a/osmclient/sol005/vim.py b/osmclient/sol005/vim.py index 421f8a5..1af7cc7 100644 --- a/osmclient/sol005/vim.py +++ b/osmclient/sol005/vim.py @@ -126,7 +126,7 @@ class Vim(object): vim_config['sdn-port-mapping'] = yaml.safe_load(f.read()) vim_account['config'] = vim_config #vim_account['config'] = json.dumps(vim_config) - http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,vim['_id']), + http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase,vim['_id']), postfields_dict=vim_account) # print('HTTP CODE: {}'.format(http_code)) # print('RESP: {}'.format(resp)) diff --git a/osmclient/sol005/wim.py b/osmclient/sol005/wim.py index c2ada69..943ceb4 100644 --- a/osmclient/sol005/wim.py +++ b/osmclient/sol005/wim.py @@ -118,7 +118,7 @@ class Wim(object): wim_config['wim_port_mapping'] = yaml.safe_load(f.read()) wim_account['config'] = wim_config #wim_account['config'] = json.dumps(wim_config) - http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,wim['_id']), + http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase,wim['_id']), postfields_dict=wim_account) #print('HTTP CODE: {}'.format(http_code)) #print('RESP: {}'.format(resp))