import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.servers.actions(server_id="sv_WVQJDMVBORbyE", data={
"type": latitudesh_python_sdk.CreateServerActionServersType.ACTIONS,
"attributes": {
"action": latitudesh_python_sdk.CreateServerActionAction.REBOOT,
},
})
# Handle response
print(res){
"data": {
"id": "act_73qkbw0QmjdaJ",
"type": "actions",
"attributes": {
"status": "Rebooting device"
}
},
"meta": {}
}Performs an action on a given server:
power_onpower_offrebootimport latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.servers.actions(server_id="sv_WVQJDMVBORbyE", data={
"type": latitudesh_python_sdk.CreateServerActionServersType.ACTIONS,
"attributes": {
"action": latitudesh_python_sdk.CreateServerActionAction.REBOOT,
},
})
# Handle response
print(res){
"data": {
"id": "act_73qkbw0QmjdaJ",
"type": "actions",
"attributes": {
"status": "Rebooting device"
}
},
"meta": {}
}Was this page helpful?