Skip to main content

Create Volume

https://infrahub-api.nexgencloud.com/v1/core/volumes

Creates a volume that can be attached to a virtual machine, expanding its storage capacity. If you install an operating system on the volume using the image_id field, it becomes a bootable volume. Specify the volume type and custom configuration in the request body. For additional details on volumes, click here.


Request body parameters


name string   Required

The name of the volume being created.
A string with a maximum length of 50 characters.


environment_name string   Required

The name of the environment within which the volume will be created.


volume_type string   Required

Specifies the type of volume being created, which determines the storage technology it will use.

note

To choose a volume_type use the GET /core/volume-types endpoint to retrieve a list of all available volume types. Currently, we offer the "Cloud-SSD" storage type.


size integer   Required

The size of the volume in GB.
Maximum size of "1048576 GB".


description string  optional

A brief description or comment about the volume.


image_id integer  optional

The ID of an operating system image to be installed on the volume. By providing an image_id in the create volume request, you will create a bootable volume.

note

To choose image an image for the volume you are creating call the GET /core/images endpoint to retrieve a list of the available image types and their IDs.

See more information about choosing an operating system image.


callback_url string  optional

A URL that can be attached to the volume you are creating. This callback_url will post any action events that occur to your volume to the provided URL.
A string with a maximum length of 250 characters.


Attributes of the volume object


status boolean

Indicates the success or failure of the creation of a volume. In this case, it is set to true, indicating that the volume has been created successfully.


message string

A message confirming the successful creation of the volume.


volume object

An object containing details about the created volume. To learn more about about the attributes of the volume object, click here.

Example request
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/volumes" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"name": "string",
"environment_name": "string",
"description": "string",
"volume_type": "string",
"size": 0,
"image_id": 0,
"callback_url": "string"
}'
Response
{
"status": true,
"message": "string",
"volume": {
"id": 0,
"name": "string",
"environment": {
"name": "string"
},
"description": "string",
"volume_type": "string",
"size": "string",
"status": "string",
"bootable": false,
"image_id": 0,
"callback_url": "string",
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
}

Returns


The response will return the status of the request and the volume object containing details on the created volume.


Back to top