Asynchronous provisioning

This is a basic package that can provision resources asynchronously, more information on the topic is available on the resource provisioning page in documentation.

The package implements only two resources, globals and provisionable. Both resources are owned by provider: Async Provisioning resource model

provisionable is a dummy resource which does not do anything except provision itself asynchronously.

Actual code responsible for asynchonous provisioning is very short and straightforward:

public function provision() {
    // Throw exception to return code *202 Accepted* to APS controller and start asynchronous phase
    throw new \Rest\Accepted($this, "Provisioning the resource", 30); // tell controller to check back in 30 seconds
}

public function provisionAsync() {
    if (rand(0,1))  // flip a coin  -- it it's heads, let's say that provisioning is not completed
        throw new \Rest\Accepted($this, "Still provisioning", 30);
    // if it's tails, return success -- the resource is provisioned.
}

After deploying the package you can open the instance in provider's panel and click a button to provision a new provisionable, if you go to task manager you will see a task named Provisioning "provisionable" for APS application async-provisioning.

If you click on a task, you will see in task output a message being returned from the provisionAsync function, and in task description -- message initially returned from provision() function.

The package can be downloaded here.

Manual Deployment instructions

  • Deploy the endpoint, standard endpoint.sh script can be used for deployment:

        [root@endpoint ~]# endpoint.sh async-prov async_provisioning-0.1-1.app.zip
        ...
        CONGRATULATIONS! Endpoint configured SUCCESSFULLY
        http endpoint url: http://endpoint.a.developer.apsdemo.org/async-prov
        https endpoint url: https://endpoint.a.developer.apsdemo.org/async-prov
    
  • Import the package into POA.
  • Create an application instance, supply the URL for endpoint created earlier.
  • There is no need to create any resource types or subscriptions, you can open the application instance and experiment with it.

Internal content