How to work with variables
During the deployment process on Edge Orchestrator, you can work with variables. A variable can be set on an edge service and an edge node.
You can create edge node and edge services variables using:
Edge Services variables
- Go to Azion Console.
- On the top-left corner, select the Products menu, represented by three horizontal lines, and then Edge Services.
- Select the edge service to which you want to add a variable.
- In the Variables section, add the following variable:
name=azion
- Click the Save button.
Now, you’ve created a variable related to a specific service. You need to access this variable through a resource.
- Navigate to the Resources tab.
- Click on + Resource or select the resource to which you wish to use the variable.
- Enter the Path of the resource.
- Choose the type Text.
- Add the following content to the content block:
I am using {{name}} edge orchestrator
- Click the Save button.
- Go to Real-Time Manager (RTM).
- On the top-left corner, select the Products menu, represented by three horizontal lines, and then Edge Libraries > Edge Services.
- Select the edge service to which you want to add a variable.
- Go to the Environment tab.
- Add the following variable:
name=azion
- Click the Save button.
Now, you’ve created a variable related to a specific service. You need to access this variable through a resource.
- Navigate to the Resources tab.
- Click on Add Resource or select the resource to which you wish to use the variable.
- Enter the Path of the resource.
- Choose the type Text.
- Add the following content to the content block:
I am using {{name}} edge orchestrator
- Click the Save button.
- Run the following
GET
request in your terminal, replacing[TOKEN VALUE]
with your personal token and retrieve the edge service ID to which you wish to add a variable:
- Create a variable related to the service. Run the following
PATCH
request in your terminal, replacing[TOKEN VALUE]
with your personal token and informing the variable’s name and value:
Now, you’ve created a variable related to a specific service. You need to access this variable through a resource.
- Run the following
POST
request in your terminal:
Replace [TOKEN VALUE]
with your personal token, :id
with the ID of the edge service and inform the following parameters in the request body:
Property | Description | Required |
---|---|---|
content_type | Content type of the resource being created | Yes |
name | Name of the resource being created | Yes |
content | Content that defines actions performed when the resource state changes in the edge node | Yes |
Edge Node variables
- Go to Azion Console.
- On the top-left corner, select the Products menu, represented by three horizontal lines, and then Edge Nodes.
- Select the edge node to which you want to add a variable.
- Go to the Services tab.
- Choose the service to which you want to apply the variable.
- Add the following content to the variables block:
name=azion2
- Click the Save button.
Now, you’ve created a variable related to a specific node. You need to access this variable through a resource.
- Go to Azion Console > Edge Services.
- Select the service related to the resource.
- Click on + Resource or select the resource where you wish to use the variable.
- Enter the Path of the resource.
- Choose the type Text.
- Add the following content to the content block:
I am using {{name}} edge orchestrator
- Click the Save button.
- Go to Real-Time Manager (RTM) > Edge Nodes.
- Select the edge node to which you want to add a variable.
- In the Main Settings tab, make sure the option Add-On Services under Orchestration Modules is toggled on.
- Go to the Services tab.
- Choose the service to which you want to apply the variable.
- Add the following content to the variables block:
name=azion2
- Click the Save button.
Now, you’ve created a variable related to a specific node. You need to access this variable through a resource.
- Go to Real-Time Manager (RTM) > Edge Libraries > Edge Services and select the service related to the resource.
- Select the resource where you wish to use the variable.
- Click on Add Resource.
- Enter the Filepath of the resource.
- Choose the type Text.
- Add the following content to the content block:
I am using {{name}} edge orchestrator
- Click the Save button.
- Run the following
GET
request in your terminal, replacing[TOKEN VALUE]
with your personal token and retrieve the edge node ID to which you wish to add a variable:
- Run the following
GET
request in your terminal, replacing[TOKEN VALUE]
with your personal token and:id
with the ID of the edge node, and retrieve the ID of the relation between the edge node and the chosen service:
- Run the following
PATCH
request in your terminal:
Replace [TOKEN VALUE]
with your personal token, :id
with the ID of the edge node and :bind_id
with the ID of the relation retrieved in step 2, informing the following properties in the request body:
Property | Description | Required |
---|---|---|
variables | Variables to be replaced during the processing on the edge node. | No |
Now, your variables are created and ready to be accessed during the execution on your nodes related to the specific service. It’s relevant to stress that when you have a variable with the same name configured on a service and on a node, the value stored on the node will prevail, for example:
Variable configured on the edge service:
Variable configured on the edge node
When the resource is accessed, the value of the variable will be azion2
instead of azion
.
To access the resource on the edge node, you need to access the file. You can access it through the filepath you informed during the creation of the resource.
Resource name:
To access it: