VMware Cloud Community
TomKol
Contributor
Contributor
Jump to solution

Query for all expired vApps using REST API

Hi,

I am not able to find query that will return me a list of expired vApps. I see that there is result set for vApp templates which have isExpired field, but this field is missing for vApp result set. Does anyone know how to achieve this so I do not need to query vApps by one?

Thanks,

Tomas

Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

The storage lease information is available only in the LeaseSettingsSection (aka LeaseSettingsSectionType), which I don't think is queryable using the query service.

The only place where I see a query that might work is the adminVApp query which has an autoDeleteDate attribute that appears to be the ISO 8601 timestamp when the (storage) lease expires or expired. Although I can't get it work in a filter expression because there's no date comparison operators, so you'd have to know the specific value to match on...

View solution in original post

Reply
0 Kudos
6 Replies
denovojeff
Contributor
Contributor
Jump to solution

I am out of the office 3/12 through 3/16. For urgent issues, please contact the Service Desk.

Thank you,

Jeff

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

The storage lease information is available only in the LeaseSettingsSection (aka LeaseSettingsSectionType), which I don't think is queryable using the query service.

The only place where I see a query that might work is the adminVApp query which has an autoDeleteDate attribute that appears to be the ISO 8601 timestamp when the (storage) lease expires or expired. Although I can't get it work in a filter expression because there's no date comparison operators, so you'd have to know the specific value to match on...

Reply
0 Kudos
TomKol
Contributor
Contributor
Jump to solution

Thanks for help. It is really helpful. XSD definition is missing these attributes so I did not see it. Here are others that are comming over the wire and is not defined.

autoDeleteDate
autoUndeployDate
honorBootOrder
lowestHardwareVersionInVApp
pvdcHighestSupportedHardwareVersion
task
taskStatus
taskStatusName

Thanks again

Tomas

Reply
0 Kudos
Todor_Todorov
Hot Shot
Hot Shot
Jump to solution

Next version of vCD will have a searchable 'isExpired' field in vApp query.

Reply
0 Kudos
TomKol
Contributor
Contributor
Jump to solution

Now I see that I was probably too optimistic with that result.

I  am able to get autoDeleteDate and autoUndeployDate values, but both  expired and stopped (but not expired) vApps have autoDeleteDate set to  some value and autoUndeployDate unset so I am not able to distinguish  them from each other.

Does anybody know any workaround how to get by bulk query a list of expired vApps with current version of vCloud API?

Reply
0 Kudos
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

You could do a query for tasks with the name jobUndeploy and ObjectType vapp. You could probably filter it further if you know the UUID of 'system', which is going to be the undeployer.

Something like this?

GET https://VCDSERVER/api/query?type=adminTask&format=idrecords&filter=name==jobUndeploy;objectType==vap...

You could filter it by day if you wanted to, do checks to see if the vApp in question is still undeployed, etc.

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
Reply
0 Kudos