Pipelines
A pipeline is the configuration a node runs to move traffic, connecting components such as UDP sockets, TUN interfaces and error correction encoders into a data flow. Each start of a pipeline creates a new run, with its own logs and telemetry. Use this service to create, change, start and stop pipelines on any node, and to follow their changes, logs and telemetry.
Get pipelines
Lists all pipelines on the node.
- REST
- gRPC
/v1/nodes/{node_id}/pipelinesnode_idstringID of the node to list the pipelines of.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.pipelines.getPipelines({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.pipelines.get_pipelines(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines'
pipelinesPipeline[]The pipelines, in no particular order.
rpc getPipelines(GetPipelinesRequest) returns (GetPipelinesResponse)
Method /nanopinggrpc.pipeline.PipelinesService/getPipelines
node_idstringID of the node to list the pipelines of.
pipelinesPipeline[]The pipelines, in no particular order.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Pipelines.GetPipelines(ctx, &pipelines.GetPipelinesRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
response, err := stub.GetPipelines(ctx, &pipelines.GetPipelinesRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
Get pipeline by id
Get one pipeline. Fails with a not found error if it does not exist.
- REST
- gRPC
/v1/nodes/{node_id}/pipelines/{id}node_idstringID of the node that hosts the pipeline.
idstringID of the pipeline.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.pipelines.getPipelineById({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.pipelines.get_pipeline_by_id(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines/<id>'
pipelinePipelineThe pipeline with the given ID.
rpc getPipelineById(GetPipelineByIdRequest) returns (GetPipelineByIdResponse)
Method /nanopinggrpc.pipeline.PipelinesService/getPipelineById
node_idstringID of the node that hosts the pipeline.
idstringID of the pipeline.
pipelinePipelineThe pipeline with the given ID.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Pipelines.GetPipelineById(ctx, &pipelines.GetPipelineByIdRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
response, err := stub.GetPipelineById(ctx, &pipelines.GetPipelineByIdRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
Get pipeline by name
Get one pipeline by name. Fails with a not found error if no pipeline, or more than one, has that name.
- REST
- gRPC
/v1/nodes/{node_id}/pipelines-by-name/{name}node_idstringID of the node that hosts the pipeline.
namestringExact name of the pipeline. Example:
UDP tunnel
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.pipelines.getPipelineByName({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
name: "UDP tunnel"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.pipelines.get_pipeline_by_name(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
name="UDP tunnel",
)
curl 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines-by-name/<name>'
pipelinePipelineThe pipeline with the given name.
rpc getPipelineByName(GetPipelineByNameRequest) returns (GetPipelineByNameResponse)
Method /nanopinggrpc.pipeline.PipelinesService/getPipelineByName
node_idstringID of the node that hosts the pipeline.
namestringExact name of the pipeline. Example:
UDP tunnel
pipelinePipelineThe pipeline with the given name.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Pipelines.GetPipelineByName(ctx, &pipelines.GetPipelineByNameRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Name: "UDP tunnel",
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
response, err := stub.GetPipelineByName(ctx, &pipelines.GetPipelineByNameRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Name: "UDP tunnel",
})
Get pipeline by run id
Get the pipeline that a run belongs to. An unknown run fails with a timeout error.
- REST
- gRPC
/v1/nodes/{node_id}/pipeline-runs/{id}node_idstringID of the node that hosts the pipeline.
idstringID of the run.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.pipelines.getPipelineByRunId({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.pipelines.get_pipeline_by_run_id(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipeline-runs/<id>'
pipelinePipelineThe pipeline of the given run.
rpc getPipelineByRunId(GetPipelineByRunIdRequest) returns (GetPipelineByRunIdResponse)
Method /nanopinggrpc.pipeline.PipelinesService/getPipelineByRunId
node_idstringID of the node that hosts the pipeline.
idstringID of the run.
pipelinePipelineThe pipeline of the given run.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Pipelines.GetPipelineByRunId(ctx, &pipelines.GetPipelineByRunIdRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
response, err := stub.GetPipelineByRunId(ctx, &pipelines.GetPipelineByRunIdRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
Create pipeline
Create a pipeline from a JSON configuration and return it. The pipeline is not started. Fails with an invalid argument error if the configuration is invalid or the CPU pin is not a thread of the node.
- REST
- gRPC
/v1/nodes/{node_id}/pipelinesnode_idstringID of the node to create the pipeline on.
namestringName of the pipeline. Example:
UDP tunneljsonConfigstringThe pipeline configuration as a JSON string.
restartPolicyRestartPolicyThe restart policy of the pipeline. Leave unset to never restart.
startupPolicyStartupPolicyThe startup policy of the pipeline. Leave unset to start it manually only.
defaultLoggingLevelLevelone of optional_default_logging_levelThe default logging level.
nodeReferenceIdstringone of optional_node_reference_idID of the related node.
instructionsTimeoutint32one of optional_instructions_timeoutThe timeout in seconds. Must be greater than 0. Example:
30cpuPinuint32one of optional_cpu_pinZero indexed CPU thread number. Must be lower than the node's thread count.
performanceModeboolone of optional_performance_modeTrue to run the pinned thread in performance mode.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.pipelines.createPipeline({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
name: "UDP tunnel",
jsonConfig: "<pipeline configuration JSON>",
restartPolicy: {
never: {}
},
startupPolicy: {
manual: {}
},
defaultLoggingLevel: "STATE",
nodeReferenceId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
instructionsTimeout: 30,
cpuPin: 0,
performanceMode: false
});
from nanoping_api import (
Level,
NanopingClient,
RestartPolicy,
RestartPolicyNever,
StartupPolicy,
StartupPolicyManual,
)
client = NanopingClient("http://127.0.0.1:10565")
response = client.pipelines.create_pipeline(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
name="UDP tunnel",
json_config="<pipeline configuration JSON>",
restart_policy=RestartPolicy(never=RestartPolicyNever()),
startup_policy=StartupPolicy(manual=StartupPolicyManual()),
default_logging_level=Level.STATE,
node_reference_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
instructions_timeout=30,
cpu_pin=0,
performance_mode=False,
)
curl -X POST 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines' \
-H 'Content-Type: application/json' \
-d '{
"name": "UDP tunnel",
"jsonConfig": "<pipeline configuration JSON>",
"restartPolicy": {
"never": {}
},
"startupPolicy": {
"manual": {}
},
"defaultLoggingLevel": "STATE",
"nodeReferenceId": "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
"instructionsTimeout": 30,
"cpuPin": 0,
"performanceMode": false
}'
pipelinePipelineThe new pipeline, including its generated
id.
rpc createPipeline(CreatePipelineRequest) returns (CreatePipelineResponse)
Method /nanopinggrpc.pipeline.PipelinesService/createPipeline
node_idstringID of the node to create the pipeline on.
namestringName of the pipeline. Example:
UDP tunneljson_configstringThe pipeline configuration as a JSON string.
restart_policyRestartPolicyThe restart policy of the pipeline. Leave unset to never restart.
startup_policyStartupPolicyThe startup policy of the pipeline. Leave unset to start it manually only.
default_logging_levelLevelone of optional_default_logging_levelThe default logging level.
node_reference_idstringone of optional_node_reference_idID of the related node.
instructions_timeoutint32one of optional_instructions_timeoutThe timeout in seconds. Must be greater than 0. Example:
30cpu_pinuint32one of optional_cpu_pinZero indexed CPU thread number. Must be lower than the node's thread count.
performance_modeboolone of optional_performance_modeTrue to run the pinned thread in performance mode.
pipelinePipelineThe new pipeline, including its generated
id.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/logging"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Pipelines.CreatePipeline(ctx, &pipelines.CreatePipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Name: "UDP tunnel",
JsonConfig: "<pipeline configuration JSON>",
RestartPolicy: &pipelines.RestartPolicy{
RestartPolicy: &pipelines.RestartPolicy_Never{Never: &pipelines.RestartPolicyNever{}},
},
StartupPolicy: &pipelines.StartupPolicy{
StartupPolicy: &pipelines.StartupPolicy_Manual{Manual: &pipelines.StartupPolicyManual{}},
},
OptionalDefaultLoggingLevel: &pipelines.CreatePipelineRequest_DefaultLoggingLevel{DefaultLoggingLevel: logging.Level_STATE},
OptionalNodeReferenceId: &pipelines.CreatePipelineRequest_NodeReferenceId{NodeReferenceId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"},
OptionalInstructionsTimeout: &pipelines.CreatePipelineRequest_InstructionsTimeout{InstructionsTimeout: 30},
OptionalCpuPin: &pipelines.CreatePipelineRequest_CpuPin{CpuPin: 0},
OptionalPerformanceMode: &pipelines.CreatePipelineRequest_PerformanceMode{PerformanceMode: false},
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/logging"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
response, err := stub.CreatePipeline(ctx, &pipelines.CreatePipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Name: "UDP tunnel",
JsonConfig: "<pipeline configuration JSON>",
RestartPolicy: &pipelines.RestartPolicy{
RestartPolicy: &pipelines.RestartPolicy_Never{Never: &pipelines.RestartPolicyNever{}},
},
StartupPolicy: &pipelines.StartupPolicy{
StartupPolicy: &pipelines.StartupPolicy_Manual{Manual: &pipelines.StartupPolicyManual{}},
},
OptionalDefaultLoggingLevel: &pipelines.CreatePipelineRequest_DefaultLoggingLevel{DefaultLoggingLevel: logging.Level_STATE},
OptionalNodeReferenceId: &pipelines.CreatePipelineRequest_NodeReferenceId{NodeReferenceId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"},
OptionalInstructionsTimeout: &pipelines.CreatePipelineRequest_InstructionsTimeout{InstructionsTimeout: 30},
OptionalCpuPin: &pipelines.CreatePipelineRequest_CpuPin{CpuPin: 0},
OptionalPerformanceMode: &pipelines.CreatePipelineRequest_PerformanceMode{PerformanceMode: false},
})
Update pipeline
Replace the settings of a pipeline and return the updated pipeline. If the pipeline is running and its configuration changed, the new configuration is applied to the current run. If that is not possible, the call fails because the pipeline is running, unless a restart is forced.
- REST
- gRPC
/v1/nodes/{node_id}/pipelines/{id}node_idstringID of the node that hosts the pipeline.
idstringID of the pipeline to update.
namestringNew name of the pipeline. Example:
UDP tunneljsonConfigstringNew pipeline configuration as a JSON string.
restartPolicyRestartPolicyNew restart policy of the pipeline. Unset means never restart.
startupPolicyStartupPolicyNew startup policy of the pipeline. Unset means start manually only.
defaultLoggingLevelLevelNew default logging level of the pipeline. Unset means
STATE, not theINFOdefault used on create.instructionsTimeoutint32New time in seconds before a pipeline instruction is considered timed out. Must be greater than 0. Example:
30cpuPinuint32one of optional_cpu_pinZero indexed CPU thread number. Must be lower than the node's thread count.
performanceModeboolone of optional_performance_modeTrue to run the pinned thread in performance mode.
nodeReferenceIdstringone of optional_node_reference_idID of the related node.
forceRestartboolIf true and the pipeline is running, the pipeline is restarted when the new configuration cannot be applied to the current run. The call then returns once the new run is running.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.pipelines.updatePipeline({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
name: "UDP tunnel",
jsonConfig: "<pipeline configuration JSON>",
restartPolicy: {
never: {}
},
startupPolicy: {
manual: {}
},
defaultLoggingLevel: "STATE",
instructionsTimeout: 30,
cpuPin: 0,
performanceMode: false,
nodeReferenceId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
forceRestart: false
});
from nanoping_api import (
Level,
NanopingClient,
RestartPolicy,
RestartPolicyNever,
StartupPolicy,
StartupPolicyManual,
)
client = NanopingClient("http://127.0.0.1:10565")
response = client.pipelines.update_pipeline(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
name="UDP tunnel",
json_config="<pipeline configuration JSON>",
restart_policy=RestartPolicy(never=RestartPolicyNever()),
startup_policy=StartupPolicy(manual=StartupPolicyManual()),
default_logging_level=Level.STATE,
instructions_timeout=30,
cpu_pin=0,
performance_mode=False,
node_reference_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
force_restart=False,
)
curl -X PUT 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines/<id>' \
-H 'Content-Type: application/json' \
-d '{
"name": "UDP tunnel",
"jsonConfig": "<pipeline configuration JSON>",
"restartPolicy": {
"never": {}
},
"startupPolicy": {
"manual": {}
},
"defaultLoggingLevel": "STATE",
"instructionsTimeout": 30,
"cpuPin": 0,
"performanceMode": false,
"nodeReferenceId": "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
"forceRestart": false
}'
pipelinePipelineThe pipeline after the update.
rpc updatePipeline(UpdatePipelineRequest) returns (UpdatePipelineResponse)
Method /nanopinggrpc.pipeline.PipelinesService/updatePipeline
node_idstringID of the node that hosts the pipeline.
idstringID of the pipeline to update.
namestringNew name of the pipeline. Example:
UDP tunneljson_configstringNew pipeline configuration as a JSON string.
restart_policyRestartPolicyNew restart policy of the pipeline. Unset means never restart.
startup_policyStartupPolicyNew startup policy of the pipeline. Unset means start manually only.
default_logging_levelLevelNew default logging level of the pipeline. Unset means
STATE, not theINFOdefault used on create.instructions_timeoutint32New time in seconds before a pipeline instruction is considered timed out. Must be greater than 0. Example:
30cpu_pinuint32one of optional_cpu_pinZero indexed CPU thread number. Must be lower than the node's thread count.
performance_modeboolone of optional_performance_modeTrue to run the pinned thread in performance mode.
node_reference_idstringone of optional_node_reference_idID of the related node.
force_restartboolIf true and the pipeline is running, the pipeline is restarted when the new configuration cannot be applied to the current run. The call then returns once the new run is running.
pipelinePipelineThe pipeline after the update.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/logging"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Pipelines.UpdatePipeline(ctx, &pipelines.UpdatePipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Name: "UDP tunnel",
JsonConfig: "<pipeline configuration JSON>",
RestartPolicy: &pipelines.RestartPolicy{
RestartPolicy: &pipelines.RestartPolicy_Never{Never: &pipelines.RestartPolicyNever{}},
},
StartupPolicy: &pipelines.StartupPolicy{
StartupPolicy: &pipelines.StartupPolicy_Manual{Manual: &pipelines.StartupPolicyManual{}},
},
DefaultLoggingLevel: logging.Level_STATE,
InstructionsTimeout: 30,
OptionalCpuPin: &pipelines.UpdatePipelineRequest_CpuPin{CpuPin: 0},
OptionalPerformanceMode: &pipelines.UpdatePipelineRequest_PerformanceMode{PerformanceMode: false},
OptionalNodeReferenceId: &pipelines.UpdatePipelineRequest_NodeReferenceId{NodeReferenceId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"},
ForceRestart: false,
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/logging"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
response, err := stub.UpdatePipeline(ctx, &pipelines.UpdatePipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Name: "UDP tunnel",
JsonConfig: "<pipeline configuration JSON>",
RestartPolicy: &pipelines.RestartPolicy{
RestartPolicy: &pipelines.RestartPolicy_Never{Never: &pipelines.RestartPolicyNever{}},
},
StartupPolicy: &pipelines.StartupPolicy{
StartupPolicy: &pipelines.StartupPolicy_Manual{Manual: &pipelines.StartupPolicyManual{}},
},
DefaultLoggingLevel: logging.Level_STATE,
InstructionsTimeout: 30,
OptionalCpuPin: &pipelines.UpdatePipelineRequest_CpuPin{CpuPin: 0},
OptionalPerformanceMode: &pipelines.UpdatePipelineRequest_PerformanceMode{PerformanceMode: false},
OptionalNodeReferenceId: &pipelines.UpdatePipelineRequest_NodeReferenceId{NodeReferenceId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"},
ForceRestart: false,
})
Delete pipeline
Delete a pipeline. Fails with a not found error if it does not exist.
- REST
- gRPC
/v1/nodes/{node_id}/pipelines/{id}node_idstringID of the node that hosts the pipeline.
idstringID of the pipeline to delete.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
await client.pipelines.deletePipeline({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
client.pipelines.delete_pipeline(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl -X DELETE 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines/<id>'
No fields.
rpc deletePipeline(DeletePipelineRequest) returns (DeletePipelineResponse)
Method /nanopinggrpc.pipeline.PipelinesService/deletePipeline
node_idstringID of the node that hosts the pipeline.
idstringID of the pipeline to delete.
No fields.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
_, err = c.Pipelines.DeletePipeline(ctx, &pipelines.DeletePipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
_, err = stub.DeletePipeline(ctx, &pipelines.DeletePipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
Start pipeline
Start a pipeline and return its new run once it is running. Fails if the pipeline is unknown, already started, or does not reach the running state within 10 seconds.
Starting a pipeline creates a new run. To see what the run does, follow its log with the run ID the call returns. The client libraries do both in one step.
- REST
- gRPC
/v1/nodes/{node_id}/pipelines/{id}/startnode_idstringID of the node that hosts the pipeline.
idstringone of pipeline_identifierID of the pipeline.
- TypeScript
- Python
- curl
import { NanopingClient, runPipeline } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
// Start the pipeline and print the log of the new run as it is written.
const nodeId = "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f";
const pipelineId = "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f";
for await (const message of runPipeline(client, nodeId, pipelineId)) {
console.log(message.level, message.message);
}
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
# Start the pipeline and print the log of the new run as it is written.
node_id = "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
pipeline_id = "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f"
for message in client.run_pipeline(node_id, pipeline_id):
print(message.level, message.message)
curl -X POST 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines/<id>/start'
/v1/nodes/{node_id}/pipelines-by-name/{name}/startnode_idstringID of the node that hosts the pipeline.
namestringone of pipeline_identifierExact name of the pipeline. Fails if more than one pipeline has this name. Example:
UDP tunnel
- TypeScript
- Python
- curl
import { NanopingClient, runPipeline } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
// Start the pipeline and print the log of the new run as it is written.
const nodeId = "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f";
const pipelineId = "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f";
for await (const message of runPipeline(client, nodeId, pipelineId)) {
console.log(message.level, message.message);
}
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
# Start the pipeline and print the log of the new run as it is written.
node_id = "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
pipeline_id = "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f"
for message in client.run_pipeline(node_id, pipeline_id):
print(message.level, message.message)
curl -X POST 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines-by-name/<name>/start'
runIdstringID of the new run.
rpc startPipeline(StartPipelineRequest) returns (StartPipelineResponse)
Method /nanopinggrpc.pipeline.PipelinesService/startPipeline
node_idstringID of the node that hosts the pipeline.
idstringone of pipeline_identifierID of the pipeline.
namestringone of pipeline_identifierExact name of the pipeline. Fails if more than one pipeline has this name. Example:
UDP tunnel
run_idstringID of the new run.
- Go
- Go (generated gRPC)
import (
"fmt"
client "github.com/nanoping-labs/nanoping-api-go/v11"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
// Start the pipeline and print the log of the new run as it is written.
messages, err := c.RunPipeline(ctx, "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f", "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f")
if err != nil {
return err
}
for message, err := range messages {
if err != nil {
return err
}
fmt.Println(message.Level, message.Message)
}
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
response, err := stub.StartPipeline(ctx, &pipelines.StartPipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
PipelineIdentifier: &pipelines.StartPipelineRequest_Id{Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"},
})
Stop pipeline
Stop a pipeline, found by its ID, its name or its current run. Returns once the stop is requested, without waiting for the run to end. Fails if the pipeline is unknown or already stopped.
- REST
- gRPC
/v1/nodes/{node_id}/pipelines/{id}/stopnode_idstringID of the node that hosts the pipeline.
idstringone of pipeline_identifierID of the pipeline.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
await client.pipelines.stopPipeline({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
client.pipelines.stop_pipeline(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl -X POST 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines/<id>/stop'
/v1/nodes/{node_id}/pipelines-by-name/{name}/stopnode_idstringID of the node that hosts the pipeline.
namestringone of pipeline_identifierExact name of the pipeline. Fails if more than one pipeline has this name. Example:
UDP tunnel
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
await client.pipelines.stopPipeline({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
client.pipelines.stop_pipeline(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl -X POST 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipelines-by-name/<name>/stop'
/v1/nodes/{node_id}/pipeline-runs/{run_id}/stopnode_idstringID of the node that hosts the pipeline.
run_idstringone of pipeline_identifierID of the pipeline's current run.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
await client.pipelines.stopPipeline({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
client.pipelines.stop_pipeline(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl -X POST 'http://127.0.0.1:10565/v1/nodes/<node_id>/pipeline-runs/<run_id>/stop'
No fields.
rpc stopPipeline(StopPipelineRequest) returns (StopPipelineResponse)
Method /nanopinggrpc.pipeline.PipelinesService/stopPipeline
node_idstringID of the node that hosts the pipeline.
idstringone of pipeline_identifierID of the pipeline.
namestringone of pipeline_identifierExact name of the pipeline. Fails if more than one pipeline has this name. Example:
UDP tunnelrun_idstringone of pipeline_identifierID of the pipeline's current run.
No fields.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
_, err = c.Pipelines.StopPipeline(ctx, &pipelines.StopPipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
PipelineIdentifier: &pipelines.StopPipelineRequest_Id{Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"},
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
_, err = stub.StopPipeline(ctx, &pipelines.StopPipelineRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
PipelineIdentifier: &pipelines.StopPipelineRequest_Id{Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"},
})
Stream pipelines
Stream changes to the pipelines of a node. Nothing is sent when the stream opens, so get the pipelines first for the current list. An event is sent each time a pipeline is created, updated or deleted, and when a pipeline starts or stops.
- REST
- gRPC
/v1/streams/nodes/{node_id}/pipelinesServer-sent events. A : ready comment is sent when the stream is ready, then each message is a data: line holding the response below. A failure after that is an error event.
node_idstringID of the node to stream pipeline changes from.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
for await (const response of client.pipelines.streamPipelines({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
})) {
}
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
for response in client.pipelines.stream_pipelines(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
):
print(response)
curl -N 'http://127.0.0.1:10565/v1/streams/nodes/<node_id>/pipelines'
createStreamPipelinesCreateEventone of eventSent when a pipeline is created.
updateStreamPipelinesUpdateEventone of eventSent when a pipeline is changed, started or stopped.
deleteStreamPipelinesDeleteEventone of eventSent when a pipeline is deleted.
rpc streamPipelines(StreamPipelinesRequest) returns (stream StreamPipelinesEvent)
Method /nanopinggrpc.pipeline.PipelinesService/streamPipelines
node_idstringID of the node to stream pipeline changes from.
createStreamPipelinesCreateEventone of eventSent when a pipeline is created.
updateStreamPipelinesUpdateEventone of eventSent when a pipeline is changed, started or stopped.
deleteStreamPipelinesDeleteEventone of eventSent when a pipeline is deleted.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
stream, err := c.Pipelines.StreamPipelines(ctx, &pipelines.StreamPipelinesRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
for response, err := range client.Receive(stream) {
if err != nil {
return err
}
}
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
stream, err := stub.StreamPipelines(ctx, &pipelines.StreamPipelinesRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
for {
response, err := stream.Recv()
if err != nil {
return err
}
}
Open log stream
Stream the log messages of a pipeline run. The requested number of past lines is sent first, then new messages as they are logged.
- REST
- gRPC
/v1/streams/nodes/{node_id}/pipeline-runs/{run_id}/logsServer-sent events. A : ready comment is sent when the stream is ready, then each message is a data: line holding the response below. A failure after that is an error event.
node_idstringID of the node that hosts the run.
run_idstringID of the run to stream logs from.
optionsOptionsStream options, such as how many past lines to send first. Leave unset to receive only new messages.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
for await (const response of client.pipelines.openLogStream({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
runId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
options: {
lines: "0"
}
})) {
}
from nanoping_api import NanopingClient, Options
client = NanopingClient("http://127.0.0.1:10565")
for response in client.pipelines.open_log_stream(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
run_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
options=Options(lines=0),
):
print(response)
curl -N 'http://127.0.0.1:10565/v1/streams/nodes/<node_id>/pipeline-runs/<run_id>/logs'
messagesMessage[]The log messages.
rpc openLogStream(OpenLogStreamRequest) returns (stream LogStreamMessages)
Method /nanopinggrpc.pipeline.PipelinesService/openLogStream
node_idstringID of the node that hosts the run.
run_idstringID of the run to stream logs from.
optionsOptionsStream options, such as how many past lines to send first. Leave unset to receive only new messages.
messagesMessage[]The log messages.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/logging"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
stream, err := c.Pipelines.OpenLogStream(ctx, &pipelines.OpenLogStreamRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
RunId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Options: &logging.Options{
OptionalLines: &logging.Options_Lines{Lines: 0},
},
})
for response, err := range client.Receive(stream) {
if err != nil {
return err
}
}
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/logging"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
stream, err := stub.OpenLogStream(ctx, &pipelines.OpenLogStreamRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
RunId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Options: &logging.Options{
OptionalLines: &logging.Options_Lines{Lines: 0},
},
})
for {
response, err := stream.Recv()
if err != nil {
return err
}
}
Open telemetry stream
Streams telemetry samples (metrics and KPI values) of a pipeline run at regular intervals while the run is active. The stream ends with an error when the run stops, when the run is unknown, or when the node disconnects.
- REST
- gRPC
/v1/streams/nodes/{node_id}/pipeline-runs/{run_id}/telemetryServer-sent events. A : ready comment is sent when the stream is ready, then each message is a data: line holding the response below. A failure after that is an error event.
node_idstringID of the node that hosts the run.
run_idstringID of the run to stream telemetry from.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
for await (const response of client.pipelines.openTelemetryStream({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
runId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
})) {
}
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
for response in client.pipelines.open_telemetry_stream(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
run_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
):
print(response)
curl -N 'http://127.0.0.1:10565/v1/streams/nodes/<node_id>/pipeline-runs/<run_id>/telemetry'
metricCollectionsCollection[]The metrics of the run.
kpisKpi[]The KPI values of the run.
timestamptimestampWhen the sample was taken.
rpc openTelemetryStream(OpenTelemetryStreamRequest) returns (stream TelemetrySample)
Method /nanopinggrpc.pipeline.PipelinesService/openTelemetryStream
node_idstringID of the node that hosts the run.
run_idstringID of the run to stream telemetry from.
metric_collectionsCollection[]The metrics of the run.
kpisKpi[]The KPI values of the run.
timestamptimestampWhen the sample was taken.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
stream, err := c.Pipelines.OpenTelemetryStream(ctx, &pipelines.OpenTelemetryStreamRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
RunId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
for response, err := range client.Receive(stream) {
if err != nil {
return err
}
}
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/pipelines"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := pipelines.NewPipelinesServiceClient(conn)
stream, err := stub.OpenTelemetryStream(ctx, &pipelines.OpenTelemetryStreamRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
RunId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
for {
response, err := stream.Recv()
if err != nil {
return err
}
}