6    Common Operations

6.1   Overview

All examples included in this international standard are informative.

This clause includes examples for the following CDMI content-type operations:

   discovering the capabilities of a cloud storage provider (see 6.2),

   creating a new container (see 6.3),

   creating a new data object (see 6.4),

   listing the contents of a container (see 6.5),

   reading the contents of a data object (see 6.6),

   reading only the value of a data object (see 6.7), and

   deleting a data object (see 6.8).

6.2   Discover the Capabilities of a Cloud Storage Provider

EXAMPLE   Perform a GET to the capabilities URI:

GET /cdmi_capabilities/ HTTP/1.1

Host: cloud.example.com

Accept: application/cdmi-capability

X-CDMI-Specification-Version: 1.0.2

The following shows the response.

HTTP/1.1 200 OK

Content-Type: application/cdmi-capability

X-CDMI-Specification-Version: 1.0.2

 

{

   "objectType" : "application/cdmi-capability",

   "objectID" : "00007E7F0010CEC234AD9E3EBFE9531D",

   "objectName" : "cdmi_capabilities/",

   "parentURI" : "/",

   "parentID" : "00007E7F0010DCECC805FB6D195DDBCB",

   "capabilities" : {

       "cdmi_domains" : "true",

       "cdmi_export_nfs" : "true",

       "cdmi_export_webdav" : "true",

       "cdmi_export_iscsi" : "true",

       "cdmi_queues" : "true",

       "cdmi_notification" : "true",

       "cdmi_query" : "true",

       "cdmi_metadata_maxsize" : "4096",

       "cdmi_metadata_maxitems" : "1024",

       "cdmi_size" : "true",

       "cdmi_list_children" : "true",

       "cdmi_read_metadata" : "true",

       "cdmi_modify_metadata" : "true",

       "cdmi_create_container" : "true",

        "cdmi_delete_container" : "true"

   },

   "childrenrange" : "0-3",

   "children" : [

       "domain/",

       "container/",

       "dataobject/",

        "queue/"

   ]

}

6.3   Create a New Container

EXAMPLE   Perform a PUT to the new container URI:

PUT /MyContainer/HTTP/1.1

Host: cloud.example.com

Accept: application/cdmi-container

Content-Type: application/cdmi-container

X-CDMI-Specification-Version: 1.0.2

 

{

   "metadata" : {

        

   }

}

The following shows the response.

HTTP/1.1 201 Created

Content-Type: application/cdmi-container

X-CDMI-Specification-Version: 1.0.2

 

{

   "objectType" : "application/cdmi-container",

   "objectID" : "00007E7F00102E230ED82694DAA975D2",

   "objectName" : "MyContainer/",

   "parentURI" : "/",

   "parentID" : "00007E7F0010128E42D87EE34F5A6560",

   "domainURI" : "/cdmi_domains/MyDomain/",

   "capabilitiesURI" : "/cdmi_capabilities/container/",

   "completionStatus" : "Complete",

   "metadata" : {

        "cdmi_size" : "0"

   },

   "childrenrange" : "",

   "children" : [

        

   ]

}

6.4   Create a Data Object in a Container

EXAMPLE   Perform a PUT to the new data object URI:

PUT /MyContainer/MyDataObject.txt HTTP/1.1

Host: cloud.example.com

Accept: application/cdmi-object

Content-Type: application/cdmi-object

X-CDMI-Specification-Version: 1.0.2

 

{

   "mimetype" : "text/plain",

   "metadata" : {

        

   },

   "value" : "Hello CDMI World!"

}

The following shows the response.

HTTP/1.1 201 Created

Content-Type: application/cdmi-object

X-CDMI-Specification-Version: 1.0.2

 

{

   "objectType" : "application/cdmi-object",

   "objectID" : "00007E7F0010BD1CB8FF1823CF05BEE4",

   "objectName" : "MyDataObject.txt",

   "parentURI" : "/MyContainer/",

   "parentID" : "00007E7F00102E230ED82694DAA975D2",

   "domainURI" : "/cdmi_domains/MyDomain/",

   "capabilitiesURI" : "/cdmi_capabilities/dataobject/",

   "completionStatus" : "Complete",

   "mimetype" : "text/plain",

    "metadata" : {

        "cdmi_size" : "17"        

    }

}

6.5   List the Contents of a Container

EXAMPLE   Perform a GET to the container URI:

GET /MyContainer/ HTTP/1.1

Host: cloud.example.com

Accept: */*

X-CDMI-Specification-Version: 1.0.2

The following shows the response.

HTTP/1.1 200 OK

Content-Type: application/cdmi-container

X-CDMI-Specification-Version: 1.0.2

 

{

   "objectType" : "application/cdmi-container",

   "objectID" : "00007E7F00102E230ED82694DAA975D2",

   "objectName" : "MyContainer/",

   "parentURI" : "/",

   "parentID" : "00007E7F0010128E42D87EE34F5A6560",

   "domainURI" : "/cdmi_domains/MyDomain/",

   "capabilitiesURI" : "/cdmi_capabilities/container/",

   "completionStatus" : "Complete",

   "metadata" : {

        "cdmi_size" : "83"

   },

   "childrenrange" : "0-0",

   "children" : [

        "MyDataObject.txt"

   ]

}

6.6   Read the Contents of a Data Object

EXAMPLE   GET from the data object URI:

GET /MyContainer/MyDataObject.txt HTTP/1.1

Host: cloud.example.com

Accept: application/cdmi-object

X-CDMI-Specification-Version: 1.0.2

The following shows the response.

HTTP/1.1 200 OK

Content-Type: application/cdmi-object

X-CDMI-Specification-Version: 1.0.2

 

{

   "objectType": "application/cdmi-object",

   "objectID": "00007E7F0010BD1CB8FF1823CF05BEE4",

   "objectName": "MyDataObject.txt",

   "parentURI": "/MyContainer/",

   "parentID" : "00007E7F00102E230ED82694DAA975D2",

   "domainURI": "/cdmi_domains/MyDomain/",

   "capabilitiesURI": "/cdmi_capabilities/dataobject/",

   "completionStatus": "Complete",

   "mimetype": "text/plain",

   "metadata": {

       "cdmi_size": "17"

   },

   "valuetransferencoding": "utf-8",

   "valuerange": "0-16",

   "value": "Hello CDMI World!"

}

6.7   Read Only the Value of a Data Object

EXAMPLE   Perform a GET to the data object URI:

GET /MyContainer/MyDataObject.txt HTTP/1.1

Host: cloud.example.com

The following shows the response.

HTTP/1.1 200 OK

Content-Type: text/plain

 

Hello CDMI World!

6.8   Delete a Data Object

EXAMPLE   Perform a DELETE to the data object URI:

DELETE /MyContainer/MyDataObject.txt HTTP/1.1

Host: cloud.example.com

X-CDMI-Specification-Version: 1.0.2

The following shows the response.

HTTP/1.1 204 No Content