[occi-wg] JSON Rendering Proposal to add CRUD Verb

Feldhaus, Florian florian.feldhaus at gwdg.de
Thu May 3 08:10:24 EDT 2012


Hi Gary,

that's an interesting idea, but from my point of view it may be a bit over the top. CRUD really is such a basic thing, that I don't think we need a dedicated action for it. I usually see the actions as being some kind of methods for the OCCI entities. Then create would be the initialize method and delete the destroy method. Both don't have to be implemented, because they are already implemented in some base class. Read and update are just getters and setters for the attributes and usually don't need to be implemented separately.

Cheers,
Florian

Am 03.05.2012 um 09:43 schrieb Gary Mazz:

> Hi,
> 
> I have a proposal for an addition to the OCCI JSON specification. This proposal is not limited to the JSON specification and may also impact the OCCI Core specification. 
> 
> The JSON specification has nearly fully decoupled OCCI information from the HTTP protocol.  OCCI information represented in JSON is a complete object (frame) serialization.  
> 
> To use the JSON as a declarative document (script)  or take advantage of agnostic transports (i.e. a messaging bus or workflow system) , we need a way to define CRUD operations in the JSON. 
> 
> The OCCI scheme has actions associated with category.  The CRUD actions are inherited by Kind and Mixin, which means inherited by Entity.
> 
> 
> I propose we associate CRUD with category actions. 
> 
> The ABNF is represented below:
> 
>   DeclarativeJSON = CRUD ; OCCI
>   CRUD = CREATE / RETRIEVE / UPDATE / DELETE 
> The definitions:
> 
> scheme  : http://schemas.ogf.org/occi/core/category/action
> term    : CREATE
> mutable : true
> required: false
> type    : string
> 
> scheme  : http://schemas.ogf.org/occi/core/category/action
> term    : RETRIEVE
> mutable : true
> required: false
> type    : string
> 
> scheme  : http://schemas.ogf.org/occi/core/category/action
> term    : UPDATE
> mutable : true
> required: false
> type    : string
> 
> scheme  : http://schemas.ogf.org/occi/core/category/action
> term    : DELETE
> mutable : true
> required: false
> type    : string
> 
> We would have three (3) presentations:  
> 1) The JSON "actions" encapsulating Resources, 
> 2) Resources showing inherited CRUD in JSON "actions" 
> 3) In classes' JSON "actions"
> Examples Below:
> 1) The JSON "actions" encapsulating Resources:
> {
>   "actions": [
>         "title": "CRUD Create Operation",
>         "rel": "http://schemas.ogf.org/occi/core/category/action#CREATE"
>         "resources":[.......]
>         ],
>         [
>         "title": "CRUD Delete Operation",
>         "rel": "http://schemas.ogf.org/occi/core/category/action#DELETE"
>         "resources":[.......]
>         ]
> }
> 
> 2) Resources showing inherited CRUD in JSON "actions":
> {
> "links": [
>      {
>          "title": "My disk",
>          "target": "http://myservice.tld/storage/456",
>          "rel": [ "http://schemas.ogf.org/occi/infrastructure#storage" ],
>          "kind": "http://schemas.ogf.org/occi/infrastructure#storagelink"
>           "attributes": { "occi.storagelink.deviceid": "ide:0:1" },
>           "actions": [
>                 "title": "CRUD Create Operation",
>                 "rel": "http://schemas.ogf.org/occi/core/category/action#CREATE"
>             ]
>      }
>  ]
> }
> 
> 3) In Classes' JSON "actions":
> {
>     "kinds": [
>     {
>         "term": "compute",155 "scheme": "http://schemas.ogf.org/occi/infrastructure#",
>         "title": "Compute Resource",
>         "related": [
>             "http://schemas.ogf.org/occi/core#resource"
>         ],
>         "attributes": {
>             "occi": {
>                 "compute": {
>                     "hostname": {
>                         "mutable": true,
>                         "required": false,
>                         "type": "string",
>                         "pattern": "(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*"
>                     },
>                     "state": {
>                         "mutable": false,
>                         "required": false,
>                         "type": "string",
>                         "pattern": "inactive|active|suspended|failed",
>                         "default": "inactive"
>                     },
>                     ...
>                 }
>             }
>         },
>         "actions": [
>             "http://schemas.ogf.org/occi/core/category/action#CREATE",
>             "http://schemas.ogf.org/occi/core/category/action#RETRIEVE",
>             "http://schemas.ogf.org/occi/core/category/action#UPDATE",
>             "http://schemas.ogf.org/occi/core/category/action#DELETE",
>             "http://schemas.ogf.org/occi/infrastructure/compute/action#start",
>             "http://schemas.ogf.org/occi/infrastructure/compute/action#stop",
>             "http://schemas.ogf.org/occi/infrastructure/compute/action#restart",
>             "http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"
>         ],
>         "location": "/compute/"
>     },
>     ...
> ],
> "mixins": [
>     {
>         "term": "medium",
>         "scheme": "http://example.com/templates/resource#",
>         "title": "Medium VM",
>         "related": [
>             "http://schemas.ogf.org/occi/infrastructure#resource_tpl",
>             "http://schemas.ogf.org/occi/infrastructure#compute"
>         ],
>         "attributes": {
>             "occi": {
>                 "compute": {
>                     "speed": {
>                         "type": "number",
>                         "default": 2.8
>                     }
>                 }
>             }
>         },
>         "actions": [
>             "http://schemas.ogf.org/occi/core/category/action#CREATE",
>             "http://schemas.ogf.org/occi/core/category/action#RETRIEVE",
>             "http://schemas.ogf.org/occi/core/category/action#UPDATE",
>             "http://schemas.ogf.org/occi/core/category/action#DELETE",
>         ],
>     },
>     ...
> ],
> "actions": [
>     {
>         "term": "stop",
>         "scheme": "http://schemas.ogf.org/occi/infrastructure/compute/action#",
>         "title": "Stop Compute instance",
>         "attributes": {
>             "method": {
>                 "mutable": true,
>                 "required": false,
>                 "type": "string",
>                 "pattern": "graceful|acpioff|poweroff",
>                 "default": "poweroff"
>             }
>         }
>    },
>    {
>        "term": "CREATE",
>        "scheme": "http://schemas.ogf.org/occi/core/category/action#",
>        "title": "CREATE Compute instance",
>        "attributes": {
>            "method": {
>               "mutable": false,
>                "required": false,
>                "type": "string",
>            }
>        }
>    },
>    {
>        "term": "RETRIEVE",
>        "scheme": "http://schemas.ogf.org/occi/core/category/action#",
>        "title": "RETRIEVE Compute instance",
>        "attributes": {
>            "method": {
>               "mutable": false,
>                "required": false,
>                "type": "string",
>            }
>        }
>    },
>    {
>        "term": "UPDATE",
>        "scheme": "http://schemas.ogf.org/occi/core/category/action#",
>        "title": "RETRIEVE Compute instance",
>        "attributes": {
>            "method": {
>               "mutable": false,
>                "required": false,
>                "type": "string",
>            }
>        }
>    },
>    {
>        "term": "DELETE",
>        "scheme": "http://schemas.ogf.org/occi/core/category/action#",
>        "title": "DELETE Compute instance",
>        "attributes": {
>            "method": {
>               "mutable": false,
>                "required": false,
>                "type": "string",
>            }
>        }
>    },
>    ...
>    ]
> }
> 
> 
> -gary
> 
> _______________________________________________
> occi-wg mailing list
> occi-wg at ogf.org
> https://www.ogf.org/mailman/listinfo/occi-wg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4964 bytes
Desc: not available
URL: <http://www.ogf.org/pipermail/occi-wg/attachments/20120503/ea82b92e/attachment.bin>


More information about the occi-wg mailing list