Wait for instance to reach a target state
client.instances.wait(stringid, InstanceWaitParams { state, timeout } query, RequestOptionsoptions?): WaitForStateResponse { state, timed_out, state_error }
/instances/{id}/wait
Blocks until the instance reaches the specified target state, the timeout expires, or the instance enters a terminal/error state. Useful for avoiding client-side polling when waiting for state transitions (e.g. waiting for an instance to become Running).
Parameters
id: string
Returns
Wait for instance to reach a target state
import Hypeman from '@onkernel/hypeman';
const client = new Hypeman({
apiKey: 'My API Key',
});
const waitForStateResponse = await client.instances.wait('id', { state: 'Created' });
console.log(waitForStateResponse.state);
{
"state": "Created",
"timed_out": true,
"state_error": "state_error"
}
Returns Examples
{
"state": "Created",
"timed_out": true,
"state_error": "state_error"
}