You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Summary

This is a proposal to refactor current API commands in CloudStack to:

- facilitate better document generation

- parameter validation

- command packaging

- ACL code cleanup and doing existing access checks at API layer

- UUID annotation in all commands

- ID to UUID conversion in all response objects

- List API optimization using DB views

Please check out the proposal here.

Project progress for access check and validation

For milestone 1, the main goal is to make the access control and the validation flow into the API layer.

There are three files handling the API layer checks and validation: apiServet, apiServer and apiDispatcher.
apiSevlet checks the web access is valid;
If it passes, it goes to the apiServer;
apiServer parses the command annotation, and checks access to the adapter and check if cmd exists;
apiDispatcher has the logic to check the ACL access, the parameter valication, the DB access validation.

  • We have separated all the API commands into separate groups according to their functionality. All API commands also moved from the previous com.cloud.api.commands packages to org.apache.cloudstack.api[command.admin|user].{groupname}
    - The separation of user and admin commands is for the developers to get better understanding of the commands and the options for commands;
    - The separation is alos for document generation purpose.

  • ACL as a plugin adapter is integrated into API server;
  • Add entityType to @parameter annotation, it points to the DB View response object;
  • Add the mapping for DB view in response class to the DB entity object;
  • Next we need to add the ACL and validation logic in the command execution context to the apiDispatcher.
  • No labels