A Node.js driver for oVirt REST API
CoffeeScript JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
.npmignore
Gruntfile.coffee
MIT-LICENSE.txt
README.md
index.coffee
package.json

README.md

Warning

This is a very early alpha that supports only crawling, searching and action performing.

OK. Here are the Node.js to oVirt driver specs.

Connection

  1. We need one entry point object that represents an oVirt instance.
  2. We want to specify "connection" parameters to that object in constructor.
  3. Once this object is constructed we want to retrieve an API root resource object (via the lazy getter).

API root

  1. Such call produces a special object - an API root resource.
  2. Once API root object initialized we could get oVirt main properties withing dedicated method (getProperties).
  3. Also we could access oVirt main properties directly as API root object own properties (via getters?).
  4. Also there is .getPropertyKeys() method that return property keys.
  5. All top-level oVirt collection are lazy-accessible as a hash of properties with getters.

Collection level

  1. Collection getter lazy-loads oVirt collection with corresponding API call.
  2. Each collection is an instance of oVirt collection class.
  3. Every collection instance knows it's owner resource.
  4. For the main collection an owner resource is an API root itself.
  5. Collections could give access to their resources by the resource ID.
  6. Also collections could list their whole content. But this operation could produce a large incoming traffic.
  7. Resource requests are allways lazy.
  8. Some collections could be searched for contained resources by their top-level parameters and some are not.
  9. Collections could be requested to create blank resource object.

Resource level

  1. Retrieved resource should behave as an API root except it has a link to it's collection.
  2. Resources could be retrieved, created, updated and deleted.
  3. Resources doesn't care whether their subresources are changed.
  4. Every time when resource top-level parameters changed the resource comes to "unsaved" state.
  5. Blank resources are always unsaved and also marked as "new".

Resource actions

  1. Resources could have an actions.
  2. Actions are methods that causes API calls which could change the resource state.
  3. Complete action list could be retrieved withing dedicated method .getActions() (which is a getter for .actions property).

API node level

  1. Collections and resources (both regular and the root one) are considered as API nodes.
  2. API nodes doesn't call API during construction but could be refreshed.
  3. Regular refresh doesn't affect child nodes.
  4. Deep refresh implementation could be considered in future releases.
  5. Every node knows it's base URI (an URI of the parent node).
  6. Every node knows how to represent itself as an API URI element.
  7. So, a node knows it's own dedicated API URI.
  8. Every node passes it's dedicated URI to the children as their base URI during their construction.
  9. We do not consider base URI recalculation in current release.
  10. Some API nodes properties (both in collections and resources) could be a links to other resources. And that means that we probably should instantiate their collections (and maybe the owning resources of their collections and so on) once we retrieve them.
  11. To perform API call a node requests oVirt connection to create an API request object, configurates it and executes.

API request

  1. Has a link to connection to retrieve it's parameters.
  2. Accepts API node and an action or operation to perform.
  3. Determines request method which depend on requested operation.
  4. Maps target node to XML if required.
  5. Generates authentication header.
  6. Could perform an HTTP(s) request.
  7. Retrieves the server response, hidrates (currently uses only xml2js) it and then passes to target node.

Author

License

Copyright (C) 2013 Mikhail Zyatin https://github.com/Sitin/ with contributions by several individuals: https://github.com/Sitin/node-ovirt/graphs/contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.