1.1. Getting Started

Storage API allows you to purchase and control your Storage volumes. Here you can see how to use the APIs for some basic usecases.

Prerequisites

Before following these steps, you need to create Account. In following steps, create network/subnet resources which your Virtual Storage will be connected to and note its Network ID and Subnet ID. For network resources information, please refer to Network API.

Notice: If you need NFS storage provided by File Storage service, you need to create your network on 'storage' plane.

1. Authentication

At first, please call the authentication API. you can get authentication token, endpoint uris, tenant ID for Storage API from GUI page.

In following steps, you need to put the authentication token in X-Auth-Token header of API request.

2. List API Versions

You can confirm which versions of APIs available on Storage service. For more details of this API, please refer to API Versions.

Sample Request

curl -s -i -X GET https://storage-jp1.ecl.api.ntt.com -H 'Content-type: application/json' -H 'Accept: application/json' -H 'X-Auth-Token: bd0343af86a74e5cb9867a69729675ba'

Sample Response

HTTP/1.1 200 OK
Date: Thu, 21 Apr 2016 04:59:13 GMT
Content-Type: application/json
Content-Length: 104
Connection: keep-alive
Set-Cookie: TS0183560f=01cce65ce128601861395335dd182427413def44343cffdb05cf2bc235112eece0b3dbb0a0; Path=/

{
 "versions" : [
{
  "status": "CURRENT",
  "updated": "2016-01-16T10:42:23+0000",
  "id": "v1.0"
}
]
}

Currently the latest API version is 'v1.0'.

3. List Availability Zones

You can confirm which availability zones are available for Storage service using this API. For more details of this API, please refer to Availability Zones. For more details of availability zones, please refer to Service Descriptions

Sample Request

curl -s -i -X GET https://storage-jp1.ecl.api.ntt.com/v1.0/7dea34ac34a14d04b0accbfe793c74af/availability_zone/detail -H 'Content-type: application/json' -H 'Accept: application/json' -H 'X-Auth-Token: bd0343af86a74e5cb9867a69729675ba'

Sample Response

HTTP/1.1 300 Multiple Choices
Date: Thu, 21 Apr 2016 05:26:05 GMT
Content-Type: application/json
Content-Length: 239
Connection: keep-alive
Set-Cookie: TS0183560f=01cce65ce1f4efb39c7a6a5f67ccf6529ebb7618621090a8719e76769ba05d355c04ef7674; Path=/

{
  "availabilityZoneInfo": [
    {
      "zoneState": {
        "available": true
      },
      "zoneName": "zone1-groupa"
    },
    {
      "zoneState": {
        "available": true
      },
      "zoneName": "zone1-groupb"
    }
  ]
}

4. List Volume Types

Volume type is a type of storage. Each volume type has different service offerings e.g., Storage protocol (iSCSI,NFS), Volume sizes, Provisioned IOPS(iSCSI only), Provisioned throughput (NFS only), etc.

There are 4 volume types. One for Block Storage Service and the other for File Storage Service. The names of the volume_types are: Block Storage Service: "piops_iscsi_na" File Storage Services: "pre_nfs_na", "standards_nfs_na" and "standard_smb_na"

You can get volume type list with following API call. For more details of volume types API, please refer to Volume Types.

For more details of block storage service, please refer to Block Storage Service. For more details of file storage services, please refer to File Storage Service

Sample Request

curl -s -i -X GET https://storage-jp1.ecl.api.ntt.com/v1.0/7dea34ac34a14d04b0accbfe793c74af/volume_types/detail -H 'Content-type: application/json' -H 'Accept: application/json' -H 'X-Auth-Token: 5990f1de419e46649728bd3f505e9a17'

Sample Response

HTTP/1.1 200 OK
Date: Thu, 21 Apr 2016 05:43:59 GMT
Content-Type: application/json
Content-Length: 551
Connection: keep-alive
Set-Cookie: TS0183560f=01cce65ce1dacbc3220de23c617070fa6e432e5ab3c8d7aa8cae41c9ec52e43e50f50515b6; Path=/

{
 "volume_types" : [

{
  "extra_specs": {
    "available_volume_size": [
      100,
      250,
      500,
      1000,
      2000,
      4000,
      8000,
      12000
    ],
    "available_iops_per_gb": [
      "2"
    ]
  },
  "id": "6328d234-7939-4d61-9216-736de66d15f9",
  "name": "piops_iscsi_na"
},
{
  "extra_specs": {
    "available_volume_size": [
      256,
      512
    ],
    "available_volume_throughput": [
      50,
      100,
      250,
      400
    ]
  },
  "id": "bf33db2a-d13e-11e5-8949-005056ab5d30",
  "name": "pre_nfs_na"
}
]
}

1. Create Virtual Storage

You can create a new Virtual Storage with this API call. For more detailed API information, please refer to Virtual Storage.

Sample Request

$ cat vs.json
{
    "virtual_storage": {
        "name": "vs01", 
        "description": "vs01",
        "volume_type_id": "6328d234-7939-4d61-9216-736de66d15f9", 
        "network_id": "c64e9be1-ba3b-4c2e-bfe9-265c5cf18c2f", 
        "subnet_id": "dd925847-4212-44a4-9deb-bc1436efb3b8", 
        "ip_addr_pool": {
            "start": "192.168.0.3", 
            "end": "192.168.0.7"
        }
    }
}



$ curl -s -i -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Auth-Token: 549b9d20836e4dc98fc7bede571fb09f' -X POST -d @./vs.json https://storage-jp1.ecl.api.ntt.com/v1.0/3f576e1e48034ef3ac8c1bafc07a9c43/virtual_storages

Sample Response

HTTP/1.1 202 Accepted
Date: Thu, 3 Oct 2016 05:26:05 GMT
Content-Type: application/json
Content-Length: 239
Connection: keep-alive
Set-Cookie: TS0183560f=01cce65ce1f4efb39c7a6a5f67ccf6529ebb7618621090a8719e76769ba05d355c04ef7674; Path=/

{
    "virtual_storage": {
        "created_at": "",
        "description": "vs01",
        "error_message": "",
        "host_routes": [],
        "id": "985d5c89-cdde-404f-b8e8-92ce5a63e55e",
        "ip_addr_pool": {
            "end": "192.168.0.7",
            "start": "192.168.0.3"
        },
        "name": "vs01",
        "status": "creating",
        "updated_at": "",
        "volume_type_id": "6328d234-7939-4d61-9216-736de66d15f9"
    }
}

6. Create Volume

You can create a new Volume with this API call. For more detailed API information, please refer to Volume.

Sample Request

curl -s -i -H 'Accept:application/json' -H 'Content-Type:application/json' -H 'X-Auth-Token:86dbf35fa591400da1640048ed093129' -X POST https://storage-jp1.ecl.api.ntt.com/v1.0/ec9316a82873441799af53d9dd538132/volumes -d '{"volume": {"virtual_storage_id": "985d5c89-cdde-404f-b8e8-92ce5a63e55e", "name": "volume01", "size": 100}}'

Sample Response

HTTP/1.1 202 Accepted
Date: Thu, 3 Oct 2016 04:59:13 GMT
Content-Type: application/json
Content-Length: 104
Connection: keep-alive
Set-Cookie:
TS0183560f=01cce65ce128601861395335dd182427413def44343cffdb05cf2bc235112eece0b3dbb0a0;
Path=/

{
    "volume": {
        "availability_zone": zone1-groupa",
        "created_at": null",
        "description": ",
        "error_message": ",
        "id": 1978b14d-632a-441f-a718-3e29669a91c5",
        "initiator_iqns": [],
        "initiator_secret": null",
        "iops_per_gb": 2",
        "metadata": {lun_id": null"},
        "name": nttc-uat-test-volume20161003-073439-685502",
        "size": 100,
        "snapshot_ids": [],
        "status": creating",
        "target_ips": [],
        "target_secret": null",
        "virtual_storage_id": 985d5c89-cdde-404f-b8e8-92ce5a63e55e"
    }
}