Application Packaging Standard

Last updated 18-Mar-2019

Provisioning Logic

To meet the updated resource model, the application APS types must be updated accordingly.

../../../../_images/user-step-model.png ../../../../_images/user-step-meta.png ../../../../_images/user-step-provision-b.png ../../../../_images/user-step-presentation.png ../../../../_images/user-step-deploy.png ../../../../_images/user-step-provisioning.png

Updates in APS Types

To support relationship with users, each VPS resource must have a relation with a user. The best way is to make the vps APS type implement the UserService standard APS type.

Besides, for convenience, it would be fine to add a property to the VPS type for presenting the VPS owners.

To allow service users to manage the assigned VPSes, the application should have the respective custom operations.

Continue Your Demo Project

This section continues the demo project from the previous step.

Edit the scripts/vpses.php file to update the vps type:

  1. Make the vps type implement the user service type. Therefore, the PHP annotations for the main class must look as follows:

    /**
     * @type("http://aps-standard.org/samples/suwizard1p/vps/1.0")
     * @implements("http://aps-standard.org/types/core/user/service/1.0")
     */
    class vps extends APS\ResourceBase { ... }
    
  2. In the vps class, add the userName property presenting a user as the VPS owner:

    /**
     * @type("string")
     * @title("User Name")
     * @description("VPS Owner Name")
     */
    public $userName;
    
  3. Ensure there are custom operations called on pressing Start and Stop buttons in service user UI:

    /**
     * @verb(GET)
     * @path("/start")
     * @return(string,text/json)
     */
     public function start() {
       $this->state = 'Running';
       $apsc = \APS\Request::getController();
       $apsc->updateResource($this);
    }
    
    /**
    * @verb(GET)
    * @path("/stop")
    * @return(string,text/json)
    */
    public function stop() {
       $this->state = 'Stopped';
       $apsc = \APS\Request::getController();
       $apsc->updateResource($this);
    }
    

Conclusion

This completes the development of the provisioning logic.

The project files you have created and updated are similar to the respective files in the sample package.