Examples of performing operations using XPRTLC and cURL
Following are some examples on performing operations using XPRTLC and cURL:
To get metadata for a host:
-
lang=txt
xprtlc -m POST -b "session id" -l
https://veritasdomain.example.com:14161/vom/api/meta/server/host
- lang=txt
curl -g -k -X POST -b "session id"
https://veritasdomain.example.com:14161/vom/api/meta/server/host
To define an extended attribute named
department on object type cluster:
-
lang=txt
xprtlc -m POST -b "session id" -l
https://veritasdomain.example.com:14161/vom/api/meta/hadr/cluster
/add?name=department
- lang=txt
curl -g -k -X POST -b "session id"
https://veritasdomain.example.com:14161/vom/api/meta/hadr/cluster
/add?name=department
Adds and displays the extended attribute
department for object type cluster in the Management Server console.
To modify an extended attribute named
departmenttoDept_new on object type cluster:
-
lang=txt
xprtlc -m POST -b "session id" -l
https://veritasdomain.example.com:14161/vom/api/meta/hadr/cluster
/modify?name=department&new_name=Dept_new
- lang=txt
curl -g -k -X POST -b "session id"
https://veritasdomain.example.com:14161/vom/api/meta/hadr/cluster
/modify?name=department&new_name=Dept_new
To delete an extended attribute named
Dept_new on object type cluster:
-
lang=txt
xprtlc -m POST -b "session id" -l
https://veritasdomain.example.com:14161/vom/api/meta/hadr/cluster
/delete?name=dept_new
- lang=txt
curl -g -k -X POST -b "session id"
https://veritasdomain.example.com:14161/vom/api/meta/hadr/cluster
/delete?name=dept_new
When you delete an extended attribute, it is not displayed in the Management Server console.
To update the extended attribute value for a host where the extended attribute is location:
-
lang=txt
xprtlc -m POST -b "session id" -l
https://veritasdomain.example.com:14161/vom/api/update/server/host
/myhost_id?location=1st floor
- lang=txt
curl -g -k -X POST -b "session id"
https://veritasdomain.example.com:14161/vom/api/update/server/host
/myhost_id?location=1st floor
To filter object disk group whose display type is private:
-
lang=txt
xprtlc -b "session id" -l
https://veritasdomain.example.com:14161/vom/api/query/server/host
/myhost_id/diskgroup?display_type=private
- lang=txt
curl -g -k -b "session id"
https://veritasdomain.example.com:14161/vom/api/query/server/host
/myhost_id/diskgroup?display_type=private
To run a recovery plan:
-
lang=txt
xprtlc -m POST -b "session id" -l
'https://veritasdomain.example.com:14161/vom/api/op/hadr/recoveryplan/
myrplan_id/execute' -d
'payload={"Tasks": [{"task_order":"1", "IS_SKIP":false},
{"task_order":"1", "TIMEOUT":"5"},
{"task_order":"2", "IS_SKIP":false,
"TIMEOUT":2}], "OfflineSharedSg":true}' -d
'reason=recovery plan execution for ticket no. 123'
- lang=txt
curl -g -k -X POST -b "session id" -l
'https://veritasdomain.example.com:14161/vom/api/op/hadr/recoveryplan/
myrplan_id/execute' -d
'payload={"Tasks": [{"task_order":"1", "IS_SKIP":false},
{"task_order":"1","TIMEOUT":5},
{"task_order":"2", "IS_SKIP":false,
"TIMEOUT":2}], "OfflineSharedSg":true}' -d
'reason=recovery plan execution for ticket no. 123'
To provision storage using a storage template
-
lang=txt
xprtlc -b "session id" -m POST -d
'payload={"HostId":"my_host_id",
"DiskGroupId":"myDG_id", "VolSize":"vol_size"}' -l
'https://veritasdomain.example.com:14161/vom/api/op/server/
template/storage/storage_template_ID/provision'
- lang=txt
curl -g -k -X POST -b "session id" -l
'https://veritasdomain.example.com:14161/vom/api/op/server/
template/storage/storage_template_ID/provision' -d
'payload={"HostId": {"my_host_id",
"DiskGroupId":"myDG_id", "VolSize":"vol_size"}'
Where,
veritasdomain.example.comis the name of your Management Server, server is the Server perspective, hadr is the Availability perspective,myhost_idis the encoded ID of the host,myDG_idis the encoded ID of the disk group, andmyrplan_id is the recovery plan ID.
If "Ask reason for all operations" is enabled under Advanced Authorization in the Management Server perspective, then you need to provide a reason for performing the operation.
Note: The output of thequeryURL for an object displays theencoded_idvalue. You need to use this encoded ID value to update the extended attribute for that object. Similarly the GET request on an operation URL shows a sample URL for executing the operation.
More Information
Related information