self._apiResource = '/wim_accounts'
self._apiBase = '{}{}{}'.format(self._apiName,
self._apiVersion, self._apiResource)
+
# WIM '--wait' option
def _wait(self, id, deleteFlag=False):
+ self._client.get_token()
# Endpoint to get operation status
apiUrlStatus = '{}{}{}'.format(self._apiName, self._apiVersion, '/wim_accounts')
# Wait for status for WIM instance creation/deletion
return ''
def create(self, name, wim_input, wim_port_mapping=None, wait=False):
+ self._client.get_token()
if 'wim_type' not in wim_input:
raise Exception("wim type not provided")
raise ClientException("failed to create wim {} - {}".format(name, msg))
def update(self, wim_name, wim_account, wim_port_mapping=None, wait=False):
+ self._client.get_token()
wim = self.get(wim_name)
wim_id_for_wait = self._get_id_for_wait(wim_name)
wim_config = {}
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))
raise NotFound("wim {} not found".format(name))
def delete(self, wim_name, force=False, wait=False):
+ self._client.get_token()
wim_id = wim_name
wim_id_for_wait = self._get_id_for_wait(wim_name)
if not utils.validate_uuid4(wim_name):
def list(self, filter=None):
"""Returns a list of VIM accounts
"""
+ self._client.get_token()
filter_string = ''
if filter:
filter_string = '?{}'.format(filter)
def get(self, name):
"""Returns a VIM account based on name or id
"""
+ self._client.get_token()
wim_id = name
if not utils.validate_uuid4(name):
wim_id = self.get_id(name)