camaraproject / EdgeCloud

Repository to describe, develop, document and test the EdgeCloud API family
Apache License 2.0
13 stars 44 forks source link

EAM: Add GET /apps/{appId}/instances/{appInstanceId} API #257

Open gainsley opened 1 month ago

gainsley commented 1 month ago

Problem description No way to poll the status of a single app instance. The only way to get the status of an app instance is to get all app instances.

I believe the general flow is to call POST /apps/{appId}/instances to deploy an instance. This will return 202 and then take some time to actually deploy the instance. The only way for the caller to know if the deployment was successful is to poll GET to watch the status until it changes to Failed or Ready. Having to poll all instances instead of the single one is inefficient and requires more logic on the client side.

Possible evolution Add GET /apps/{appId}/instances/{appInstanceId} API to retrieve info for a single app instance.

Alternative solution Callbacks can be used to notify the client when the operation is complete. Unfortunately callbacks do not work well for clients who are humans and on browsers behind NATs. Alternatively a separate blocking API can be provided that returns only when the operation is complete. For example GET /apps/{appId}/instances/{appInstanceId}/waitdone will block until the status is either Failed/Ready, and then return the full app instance info. This may be useful in addition to the GET of a single instance which has its own advantages and drawbacks.

Additional context