This is a very early alpha that supports only crawling, searching and action performing.
OK. Here are the Node.js to oVirt driver specs.
- We need one entry point object that represents an oVirt instance.
- We want to specify "connection" parameters to that object in constructor.
- Once this object is constructed we want to retrieve an API root resource object (via the lazy getter).
- Such call produces a special object - an API root resource.
- Once API root object initialized we could get oVirt main properties withing dedicated method (getProperties).
- Also we could access oVirt main properties directly as API root object own properties (via getters?).
- Also there is .getPropertyKeys() method that return property keys.
- All top-level oVirt collection are lazy-accessible as a hash of properties with getters.
- Collection getter lazy-loads oVirt collection with corresponding API call.
- Each collection is an instance of oVirt collection class.
- Every collection instance knows it's owner resource.
- For the main collection an owner resource is an API root itself.
- Collections could give access to their resources by the resource ID.
- Also collections could list their whole content. But this operation could produce a large incoming traffic.
- Resource requests are allways lazy.
- Some collections could be searched for contained resources by their top-level parameters and some are not.
- Collections could be requested to create blank resource object.
- Retrieved resource should behave as an API root except it has a link to it's collection.
- Resources could be retrieved, created, updated and deleted.
- Resources doesn't care whether their subresources are changed.
- Every time when resource top-level parameters changed the resource comes to "unsaved" state.
- Blank resources are always unsaved and also marked as "new".
- Resources could have an actions.
- Actions are methods that causes API calls which could change the resource state.
- Complete action list could be retrieved withing dedicated method .getActions() (which is a getter for .actions property).
API node level
- Collections and resources (both regular and the root one) are considered as API nodes.
- API nodes doesn't call API during construction but could be refreshed.
- Regular refresh doesn't affect child nodes.
- Deep refresh implementation could be considered in future releases.
- Every node knows it's base URI (an URI of the parent node).
- Every node knows how to represent itself as an API URI element.
- So, a node knows it's own dedicated API URI.
- Every node passes it's dedicated URI to the children as their base URI during their construction.
- We do not consider base URI recalculation in current release.
- 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.
- To perform API call a node requests oVirt connection to create an API request object, configurates it and executes.
- Has a link to connection to retrieve it's parameters.
- Accepts API node and an action or operation to perform.
- Determines request method which depend on requested operation.
- Maps target node to XML if required.
- Generates authentication header.
- Could perform an HTTP(s) request.
- Retrieves the server response, hidrates (currently uses only xml2js) it and then passes to target node.
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.