def create_by(stxobj: StxGenericModel, parentid: str) -> ResourcePool:
content = json.loads(stxobj.content)
- globalcloudId = stxobj.id # to be updated
+ globalLocationId = '' # to be updated
description = "A Resource Pool"
+ location = content['location'] if content['location'] is not None else ''
resourcepool = ResourcePool(stxobj.id, stxobj.name,
- content['location'],
- parentid, globalcloudId, description)
+ location,
+ parentid, globalLocationId, description)
resourcepool.createtime = stxobj.createtime
resourcepool.updatetime = stxobj.updatetime
resourcepool.hash = stxobj.hash
-
+ resourcepool.events.append(events.ResourcePoolChanged(
+ id=stxobj.id,
+ notificationEventType=NotificationEventEnum.CREATE,
+ updatetime=stxobj.updatetime
+ ))
return resourcepool
raise MismatchedModel("Mismatched Id")
content = json.loads(stxobj.content)
target.name = stxobj.name
- target.location = content['location']
- target.createtime = stxobj.createtime
+ target.location = content['location'] if content['location'] is not None \
+ else ''
target.updatetime = stxobj.updatetime
- target.hash = stxobj.hash
target.oCloudId = parentid
+
+ target.hash = stxobj.hash
target.version_number = target.version_number + 1
target.events.append(events.ResourcePoolChanged(
id=stxobj.id,