We have to add a create a record option into our CLI. This method will work with the command create. It will check the parameters it needs through the response it gets on our option request to our API ( an example of the response body can be found under).
We get the needed parameters from the following json in "methods"-> "POST"->"fields"->0 . Request the details from the user like this.
Plusclouds > create iaas virtual-machines
name (required) : <user-input>
hostname ( required ) : <user-input>
total_cpu ( required ) : <user-input>
total_ram ( required ) : <user-input>
description : <user-input>
datacenter_node_ref ( required ) : <user-input>
compute_member_ref : <user-input>
extra to do's
{
"uri": "v2/iaas/virtual-machines",
"description": "",
"directories": [
".",
"..",
"meta-data",
"{vm}",
"templates",
"snapshots",
"wizards",
"overview"
],
"methods": {
"GET": {
"list": {
"uri": "v2/iaas/virtual-machines",
"description": null,
"search": {
"uri": "v2/iaas/virtual-machines",
"parameters": [
{
"name": "datacenterNode",
"type": "string",
"description": ""
},
{
"name": "name",
"type": "string",
"description": ""
},
{
"name": "tags",
"type": "$tags",
"description": ""
},
{
"name": "status",
"type": "string",
"description": ""
},
{
"name": "uuid",
"type": "string",
"description": ""
},
{
"name": "haPriority",
"type": "int",
"description": ""
},
{
"name": "snapshots",
"type": null,
"description": ""
},
{
"name": "templates",
"type": null,
"description": ""
},
{
"name": "defaultTemplates",
"type": null,
"description": ""
},
{
"name": "losts",
"type": null,
"description": ""
},
{
"name": "locked",
"type": null,
"description": ""
},
{
"name": "passive",
"type": null,
"description": ""
},
{
"name": "ipAddr",
"type": "string",
"description": ""
}
]
},
"returns": "json|array",
"authentication": "required"
}
},
"POST": {
"fields": [
{
"name": "required|max:150",
"hostname": "max:150",
"total_cpu": "required|integer|min:1|max:32",
"total_ram": "required|integer|min:512|max:524288",
"description": "max:500",
"datacenter_node_ref": "required|exists:datacenter_nodes,id_ref",
"compute_member_ref": "nullable|exists:compute_members,id_ref"
}
]
}
}
}
We have to add a create a record option into our CLI. This method will work with the command create. It will check the parameters it needs through the response it gets on our option request to our API ( an example of the response body can be found under).
We get the needed parameters from the following json in "methods"-> "POST"->"fields"->0 . Request the details from the user like this.
extra to do's
{ "uri": "v2/iaas/virtual-machines", "description": "", "directories": [ ".", "..", "meta-data", "{vm}", "templates", "snapshots", "wizards", "overview" ], "methods": { "GET": { "list": { "uri": "v2/iaas/virtual-machines", "description": null, "search": { "uri": "v2/iaas/virtual-machines", "parameters": [ { "name": "datacenterNode", "type": "string", "description": "" }, { "name": "name", "type": "string", "description": "" }, { "name": "tags", "type": "$tags", "description": "" }, { "name": "status", "type": "string", "description": "" }, { "name": "uuid", "type": "string", "description": "" }, { "name": "haPriority", "type": "int", "description": "" }, { "name": "snapshots", "type": null, "description": "" }, { "name": "templates", "type": null, "description": "" }, { "name": "defaultTemplates", "type": null, "description": "" }, { "name": "losts", "type": null, "description": "" }, { "name": "locked", "type": null, "description": "" }, { "name": "passive", "type": null, "description": "" }, { "name": "ipAddr", "type": "string", "description": "" } ] }, "returns": "json|array", "authentication": "required" } }, "POST": { "fields": [ { "name": "required|max:150", "hostname": "max:150", "total_cpu": "required|integer|min:1|max:32", "total_ram": "required|integer|min:512|max:524288", "description": "max:500", "datacenter_node_ref": "required|exists:datacenter_nodes,id_ref", "compute_member_ref": "nullable|exists:compute_members,id_ref" } ] } } }