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