Nodes are the compute units where algorithms and connectors run. They represent the infrastructure that executes your components, whether it's processing data or sending it elsewhere.
You can create, update, or delete nodes depending on your deployment needs. Managing nodes allows you to control where and how your components are executed, helping you scale and adapt your system to different environments.
Creating a Node
To create a function, you need to specify the following parameters:
The name of the function.
Defines where the function will run.
Copy curl --request POST \
--url https://api.splight.com/v3/engine/compute/nodes/all/ \
--header 'authorization: Splight <access_id> <secret_key>' \
--header 'content-type: application/json' \
--data '{
"name": "<node_name>",
"type": "<node_type>"
}'
Copy import requests
ACCESS_ID = "<user_access_id>" # Replace with your access ID
SECRET_KEY = "<user_secret_key>" # Replace with your secret key
url = "https://api.splight.com/v3/engine/compute/nodes/all/"
payload = {
"name": "<node_name>",
"type": "<node_type>"
}
headers = {
'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
print(response.status_code) # Should return 201 for successful creation
Reading a Node
Listing all Nodes
To list all nodes, you can use the following endpoint. This will return a list of all nodes in your account.
Copy curl --request GET \
--url https://api.splight.com/v3/engine/compute/nodes/all/ \
--header 'authorization: Splight <access_id> <secret_key>' \
Copy import requests
ACCESS_ID = "<user_access_id>" # Replace with your access ID
SECRET_KEY = "<user_secret_key>" # Replace with your secret key
url = "https://api.splight.com/v3/engine/compute/nodes/all/"
headers = {
'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}
response = requests.get(url, headers=headers)
print(response.json())
print(response.status_code) # Should return 200 for successful retrieval
Retrive a single Node
To retrieve a single node, you can use the node ID in the URL. This will return detailed information about that specific node.
Copy curl --request GET \
--url https://api.splight.com/v3/engine/compute/nodes/all/<node_id>/ \
--header 'authorization: Splight <access_id> <secret_key>' \
Copy import requests
ACCESS_ID = "<user_access_id>" # Replace with your access ID
SECRET_KEY = "<user_secret_key>" # Replace with your secret key
NODE_ID = "<node_id>" # Replace with your node ID
url = f"https://api.splight.com/v3/engine/compute/nodes/all/{NODE_ID}/"
headers = {
'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}
response = requests.get(url, headers=headers)
print(response.json())
print(response.status_code) # Should return 200 for successful retrieval
Updating a Node
To update a node, you can use the following endpoint. This will allow you to modify the properties of an existing node.
Copy curl --request PATCH \
--url https://api.splight.com/v3/engine/compute/nodes/all/<node_id>/ \
--header 'authorization: Splight <access_id> <secret_key>' \
--header 'content-type: application/json' \
--data '{
"name": "<new_node_name>",
"type": "<new_node_type>"
}'
Copy import requests
ACCESS_ID = "<user_access_id>" # Replace with your access ID
SECRET_KEY = "<user_secret_key>" # Replace with your secret key
NODE_ID = "<node_id>" # Replace with your node ID
url = f"https://api.splight.com/v3/engine/compute/nodes/all/{NODE_ID}/"
payload = {
"name": "<new_node_name>",
"type": "<new_node_type>"
}
headers = {
'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
'content-type': 'application/json'
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
print(response.status_code) # Should return 200 for successful update
Deleting a Node
To delete a node, you can use the following endpoint. This will remove the specified node from your account.
Copy curl --request DELETE \
--url https://api.splight.com/v3/engine/compute/nodes/all/<node_id>/ \
--header 'authorization: Splight <access_id> <secret_key>' \
Copy import requests
ACCESS_ID = "<user_access_id>" # Replace with your access ID
SECRET_KEY = "<user_secret_key>" # Replace with your secret key
NODE_ID = "<node_id>" # Replace with your node ID
url = f"https://api.splight.com/v3/engine/compute/nodes/all/{NODE_ID}/"
headers = {
'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}
response = requests.delete(url, headers=headers)
print(response.json())
print(response.status_code) # Should return 204 for successful deletion