def create(self, **kwargs): new = {} for (key, value) in kwargs.items(): if key in CREATION_ATTRIBUTES: new[key] = value else: raise exc.InvalidAttribute() return self._create(self._path(), new)
def service_create(self, **kwargs): new = {} for (key, value) in kwargs.items(): if key in ['name', 'enabled', 'region_name', 'capabilities']: new[key] = value else: raise exc.InvalidAttribute() return self._create(self._path(), new)
def upload(self, file, **kwargs): data = {} for (key, value) in kwargs.items(): if key in CREATION_ATTRIBUTES: data[key] = value else: raise exc.InvalidAttribute('%s' % key) return self._upload_multipart(self._path(), dict(file=file), data=data)
def create(self, **kwargs): path = '/v1/iinterfaces' new = {} for (key, value) in kwargs.items(): if key in CREATION_ATTRIBUTES: new[key] = value else: raise exc.InvalidAttribute('%s' % key) return self._create(path, new)
def create(self, **kwargs): # path = '/v1/controller_fs' new = {} for (key, value) in kwargs.items(): if key in CREATION_ATTRIBUTES: new[key] = value else: raise exc.InvalidAttribute('%s' % key) return self._create(self._path(), new)
def create(self, **kwargs): path = '/v1/ethernet_ports/' new = {} for (key, value) in kwargs.items(): if key in CREATION_ATTRIBUTES: new[key] = value else: raise exc.InvalidAttribute(key) return self._create(path, new)
def create(self, **kwargs): new = {} for (key, value) in kwargs.items(): if key in CREATION_ATTRIBUTES: new[key] = value if key == 'services': new[key] = [value] else: raise exc.InvalidAttribute('%s' % key) return self._create(self._path(), new)
def import_load(self, **kwargs): path = '/v1/loads/import_load' new = {} for (key, value) in kwargs.items(): if key in IMPORT_ATTRIBUTES: new[key] = value else: raise exc.InvalidAttribute(key) res, body = self.api.json_request('POST', path, body=new) return body
def create(self, **kwargs): new = {} for (key, value) in kwargs.items(): if key in CREATION_ATTRIBUTES: new[key] = value else: raise exc.InvalidAttribute('%s' % key) self.upload_file(new) ceph_conf_file = new.get('ceph_conf', None) new.update({'ceph_conf': os.path.basename(ceph_conf_file)}) return self._create(self._path(), new)
def import_load(self, **kwargs): path = '/v1/loads/import_load' active = None load_info = {} for (key, value) in kwargs.items(): if key in IMPORT_ATTRIBUTES: if key == 'active': active = value else: load_info[key] = value else: raise exc.InvalidAttribute(key) json_data = self._upload_multipart( path, body=load_info, data={'active': active}, check_exceptions=True) return self.resource_class(self, json_data)
def _create_load(self, load, path): if set(list(load.keys())) != set(CREATION_ATTRIBUTES): raise exc.InvalidAttribute() return self._create(path, load)