rmp-common-library/src/main/java/org/gcube/resourcemanagement/support/server/gcube/queries/xquery/related/RunningInstance.xq

55 lines
2.0 KiB
Plaintext

<!--
Notice: the <Resources> node must be removed in using the resource grid factory.
-->
let $profiles := collection('/db/Profiles/<RES_TYPE ISdefault ='RunningInstance'>')//Resource[ID/string() eq '<RES_ID/>']
let $relatedghn := collection('/db/Profiles/GHN')//Resource[ID/string() eq $profiles/Profile/GHN/@UniqueID/string()]
let $ghn-name := if (empty($relatedghn/Profile/GHNDescription/Name/string()))
then $profiles/Profile/GHN/@UniqueID/string()
else $relatedghn/Profile/GHNDescription/Name/string()
for $ri in $profiles
return
<Resources>
<Resource>
<Key>ID</Key>
<Value>{$ri//Resource/ID/string()}</Value>
</Resource>
<Resource>
<Key>ServiceStatus</Key>
<Value>{$ri/Profile/DeploymentData/Status/string()}</Value>
</Resource>
<Resource>
<Key>ActivationTime</Key>
<Value>{$ri/Profile/DeploymentData/ActivationTime/@value/string()}</Value>
</Resource>
<Resource>
<Key>GHNName</Key>
<Value>{$ghn-name}</Value>
</Resource>
<Resource>
<Key>GHNSite</Key>
<Value>{$relatedghn/Profile/Site/Domain/string()}</Value>
</Resource>
<Resource>
<Key>GHNStatus</Key>
<Value>{$relatedghn/Profile/GHNDescription/Status/string()}</Value>
</Resource>
<Resource>
<Key>GHNActivationTime</Key>
<Value>{$relatedghn/Profile/GHNDescription/ActivationTime/string()}</Value>
</Resource>
<Resource>
<Key>GHNLastUpdate</Key>
<Value>{$relatedghn/Profile/GHNDescription/LastUpdate/string()}</Value>
</Resource>
<Resource>
<Key>GHNLoad15Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last15Min/string()}</Value>
</Resource>
<Resource>
<Key>GHNLoad5Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last5Min/string()}</Value>
</Resource><Resource>
<Key>GHNLoad1Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last1Min/string()}</Value>
</Resource>
</Resources>