VMware Micro Cloud Foundry
This repository contains build scripts, the console application, the REST API and the web GUI for the Micro Cloud Foundry.
The Micro Cloud has a hypermedia/REST API. Starting at the root resource, each resource is exposed via named links in the _links element. The links give the client the expected HTTP method, URL and content type for each state.
Clients should start at the root and navigate through links for each request. They should use the methods, URLs and content types that are returned and not build any URLs themselves.
The API is browsable using a browser with a JSON formatting plugin like JSONView installed.
/ edit link / send request with http_proxy set
/ edit link / send request with internet_connected = true or false
/ edit link / send request with is_powered_on = false
/ administrator link / edit link / send request with email field set
/ administrator link / edit link / send request with password field set
/ domain_name link / edit link / send request with name field set
/ domain_name link / edit link / send request with token field set
Update the Micro Cloud DynDNS hostname with the VM's current IP address.
/ domain_name link / edit link / send request with synched = true
/ network_interface link / edit link / send request with ip_address, netmask, gateway and nameservers set
/ network_interface link / edit link / send request with is_dhcp = true
/ services link / select service by name and follow edit link / send request with enabled = true or false
Each resource has a media type class that is a subclass of Engine::MediaType. Subclasses define a MediaType class constant for their content type and a set of links to other resources.
The format of the links in JSON is based on the link format of HAL with a few additions: http://stateless.co/hal_specification.html
The MediaTypeSerial Rack middleware automatically parses incoming JSON into the correct MediaType subclass based on its content type. The media type object is set as env['media_type_object'] in Rack environment.
This middleware also serializes MediaType subclasses to JSON based on their instance variables and sets the correct content type on responses.
Classes in the Routes module are automatically registered in the Sinatra app.
The Engine module is intended for generic hypermedia API code that might eventually be moved to a separate project.