Need disk sizes and GPU type on a Bare Metal device using curl

76 views Asked by At

Iam using the curl command and I am trying to determine the number of disks and their sizes on a bare metal device. I thought I could use these in an objectMask, but nothing is returned.

blockDeviceTemplateGroup.name,blockDeviceTemplateGroup.id,blockDeviceTemplateGroup.blockDevices,blockDevices.diskImage

I am also trying the g=find if a Bare Metal device has a GPU and the type of GPU. Can I get that using objectMask?

Thanks

1

There are 1 answers

0
Brian SantivaƱez On

If you want to get the disks of a specific bare metal device, you can use https://sldn.softlayer.com/reference/services/SoftLayer_Hardware/getComponents/ to get all components and a filter to get only the disks. The url should be

https://api.softlayer.com/rest/v3.1/SoftLayer_Hardware/123456/getComponents?objectFilter={"components":{"hardwareComponentModel":{"hardwareGenericComponentModel":{"hardwareComponentType":{"keyName":{"operation":"HARD_DRIVE"}}}}}}

Where 123456 is the id of the bare metal device, but in curl, it's necessary to escape the special characters, so you must send the object filter encoded and finally the structure you can send is

curl -u USER:API_KEY https://api.softlayer.com/rest/v3.1/SoftLayer_Hardware/123456/getComponents.json?objectFilter=%7B%22components%22%3A%7B%22hardwareComponentModel%22%3A%7B%22hardwareGenericComponentModel%22%3A%7B%22hardwareComponentType%22%3A%7B%22keyName%22%3A%7B%22operation%22%3A%22HARD_DRIVE%22%7D%7D%7D%7D%7D%7D 

Where USER and API_KEY are your username and the apikey you generated

To get the bare metal devices with GPU you can use https://sldn.softlayer.com/reference/services/SoftLayer_Account/getHardware/ to get all bare metal devices and a filter get only the devices with GPU components. The url should be

https://api.softlayer.com/rest/v3.1/SoftLayer_Account/getHardware?objectFilter={"hardware":{"components":{"hardwareComponentModel":{"hardwareGenericComponentModel":{"hardwareComponentType":{"keyName":{"operation":"GPU"}}}}}}}

But like in curl, it's necessary to escape the special characters, so you must send the object filter encoded and finally the structure you can send is

curl -u USER:API_KEY https://api.softlayer.com/rest/v3.1/SoftLayer_Account/getHardware?objectFilter=%7B%22hardware%22%3A%7B%22components%22%3A%7B%22hardwareComponentModel%22%3A%7B%22hardwareGenericComponentModel%22%3A%7B%22hardwareComponentType%22%3A%7B%22keyName%22%3A%7B%22operation%22%3A%22GPU%22%7D%7D%7D%7D%7D%7D%7D

Where USER and API_KEY are your username and the apikey you generated