Advertisement
Guest User

OCCI Entities JSON rendering suggestion (FF) v3

a guest
Feb 29th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GET /
  2. Access: application/occi-collection+json
  3. Content-Type: application/occi-collection+json
  4. {
  5.   "compute": ["http://myservice.tld/compute"],
  6.   "storage": ["http://myservice.tld/storage"],
  7.   "network": ["http://myservice.tld/network"]
  8. }
  9.  
  10. GET /compute/
  11. Access: application/occi-collection+json
  12. Content-Type: application/occi-collection+json
  13. {
  14.   "compute": ["http://myservice.tld/compute/123",
  15.               "http://myservice.tld/compute/345"]
  16. }
  17.  
  18. GET /compute/
  19. Access: application/occi-entities+json
  20. Content-Type: application/occi-entities+json
  21. [
  22.     {
  23.         "core": {
  24.             "id": 123,
  25.             "summary": "This is a summary"
  26.         },
  27.         "kind": "http://schemas.ogf.org/occi/infrastructure#compute",
  28.         "mixins": [
  29.             "http://schemas.opennebula.org/occi/infrastructure#my_mixin",
  30.             "http://schemas.other.org/occi#my_mixin"
  31.         ],
  32.         "links": [
  33.             "http://myservice.tld/storage/123"
  34.         ],
  35.         "compute": {
  36.             "speed": 2,
  37.             "memory": 4,
  38.             "cores": 2
  39.         },
  40.         "my_mixin": {
  41.             "my_attribute": "my_value"
  42.         }
  43.     },
  44.     {
  45.         "core": {
  46.             "id": 456,
  47.             "summary": "This is a summary"
  48.         },
  49.         "kind": "http://schemas.ogf.org/occi/infrastructure#compute",
  50.         "mixins": [
  51.             "http://schemas.opennebula.org/occi/infrastructure#my_mixin",
  52.             "http://schemas.other.org/occi#my_mixin"
  53.         ],
  54.         "links": [
  55.             "http://myservice.tld/storage/456"
  56.         ],
  57.         "compute": {
  58.             "speed": 2,
  59.             "memory": 4,
  60.             "cores": 2
  61.         },
  62.         "my_mixin": {
  63.             "my_attribute": "my_value"
  64.         }
  65.     }
  66. ]
  67.  
  68. var entities = GET /compute/
  69. for each occi in entities
  70.   occi.compute.id
  71. end
  72.  
  73. GET /compute/123/
  74. Content-Type: application/occi-entity+json
  75. {
  76.     "core": {
  77.         "id": 123,
  78.         "summary": "This is a summary"
  79.     },
  80.     "kind": "http://schemas.ogf.org/occi/infrastructure#compute",
  81.     "mixins": [
  82.         "http://schemas.opennebula.org/occi/infrastructure#my_mixin",
  83.         "http://schemas.other.org/occi#my_mixin"
  84.     ],
  85.     "links": [
  86.         "http://myservice.tld/storage/123"
  87.     ],
  88.     "compute": {
  89.         "speed": 2,
  90.         "memory": 4,
  91.         "cores": 2
  92.     },
  93.     "my_mixin": {
  94.         "my_attribute": "my_value",
  95.     "other_attribute": "other_value"
  96.     }
  97. }
  98.  
  99.  
  100. var occi = GET /compute/123
  101. occi.compute.cores
  102. occi.mixins[0]
  103. occi.links[0]
  104. occi.kind
  105. occi.my_mixin.my_attribute
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement