= Tim == Summary Tim is a Rails Engine responsible for Cloud image management. It allows clients to create, delete and upload images to a multitude of Cloud providers. Tim builds on top of Imagefactory’s cloud abstraction layer. Adding the ability for clients to store meta-data (used for searching and sorting) as well as versioning and support for access control. Tim wraps all this up in a clean, simply RESTful API. You can read the full presentation here[http://www.aeolusproject.org/docs/presentations/2012-nov-conference/tim.odp]. == Configuration === Securing Image Factory requests It is possible to secure Image Factory requests using 2 Legged OAuth. To use 2 Legged OAuth you must set the OAuth consumer key, consumer secret and url in the Tim::ImageFactory::Base.config. Example: oauth_config = {:consumer_key => "mock-key", :consumer_secret => "mock-secret", :site => "http://localhost:8075/imagefactory/"} Tim::ImageFactory::Base.config = oauth_config == Running Tests {Build Status}[http://travis-ci.org/aeolus-incubator/tim] Tests are run from the project root directory. But are run in the context of the dummy app located under test/dummy. In order to run the tests you must first setup dummy app database. rake db:setup; rake -f test/dummy/Rakefile test:prepare Once you have done this cd to the project root and run the following: rake spec == Running the Dummy app This will allow you to runn the commands below to test out the engine in isolation (if mounted in another application, the main difference will just be where the engine gets mounted, so adjust your url accordingly). cd test/dummy; rails s == API Reference === Templates ==== Create Template Request curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data " " http://localhost:3000/tim/templates Response Code: 201 Body: === Show Template Request curl --header "Accept:application/xml" http://localhost:3000/tim/templates/34 Response Code: 200 Body: === List Templates Request curl --header "Accept:application/xml" http://localhost:3000/tim/templates Response Code: 200 Body: === Update Template - Not Allowed === Delete Template Request curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/templates/34 Response Code: 204 Body: === Base Images ==== Create Base Image with Template ===== with Existing Template Request curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data " MyFirstBaseImage This is my very first base image " http://localhost:3000/tim/base_images Response Code: 201 Body: MyFirstBaseImage This is my very first base image ===== with New Template Request curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data " MyFirstBaseImage This is my very first base image " http://localhost:3000/tim/base_images Response Code: 201 Body: MyFirstBaseImage This is my very first base image ==== Create Base Image with Template, a single Image Version with a Single Target Image Request curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data " MyFirstBaseImage ThisIsABaseImage MockSphere " http://localhost:3000/tim/base_images Response Code: 201 Body: MyFirstBaseImage ThisIsABaseImage ==== Import Image curl -X POST --header "Accept: application/xml" --header "Content-Type: application/xml" --data " MyFirstBaseImage This is my very first base image true ec2 Amazon EC2 ami-123456 " http://localhost:3000/tim/base_images ==== Show Base Image Request curl --header "Accept: application/xml" http://localhost:3000/tim/base_images/1 Response Code: 200 Body: MyFirstBaseImage This is my very first base image ==== List Base Images Request curl --header "Accept: application/xml" http://localhost:3000/tim/base_images Response Code: 200 Body: ==== Delete Base Image Request curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/base_images/1 Response Code: 204 Body: === Image Versions ==== Create Image Version Request curl -X POST --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/image_versions --data \ " " Response Code: 201 Body: ==== Show Image Version Request curl --header "Accept: application/xml" http://localhost:3000/tim/image_versions/1 Response Code: 200 Body: ==== List Image Versions Request curl --header "Accept: application/xml" http://localhost:3000/tim/image_versions Response Code: 200 Body: ==== Delete Image Version Request curl -X DELETE--header "Accept: application/xml" http://localhost:3000/tim/image_versions/1 Response Code: 204 Body: ==== Update Image Version Request curl -X PUT --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/image_versions/1 --data \ " " Response Code: 200 body: ==== Create Target Image Request curl -X POST --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/target_images --data \ " " Response Code: 201 Body: EC2 BUILDING 0 ==== Show Target Image Request curl --header "Accept: application/xml" http://localhost:3000/tim/target_images/1 Response Code: 200 Body: EC2 COMPLETE 100 ==== List Target Image Request curl --header "Accept: application/xml" http://localhost:3000/tim/target_images Response Code: 200 Body: ==== Delete Target Image Request curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/target_images/1 Response Code: 204 Body: ==== Update Target Image Request curl -X PUT --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/target_images/2 --data \ " " Response Code: 204 ==== Create Provider Image Request curl -X POST --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/provider_images --data \ " " Response Code: 201 Body: Amazon EC2 ami-123456 false NEW 0 ==== Show Provider Image Request curl --header "Accept: application/xml" http://localhost:3000/tim/provider_images/1 Response Code: 200 Body: Amazon EC2 ami-123456 false NEW 0 ==== List Provider Images Request curl --header "Accept: application/xml" http://localhost:3000/tim/provider_images Response Code: 200 Body: ==== Delete Target Image Request curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/provider_images/1 Response Code: 204 Body: ==== Update Target Image Request curl -X PUT --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/provider_images/2 --data \ " " Response Code: 204 Body: == License Image Management Engine is released under the MIT license.