Blueprints
A blueprint is a template that generates the pipeline configuration a node runs in a network. It uses Go template syntax, and placeholders such as the node's IP address and carriers are filled in for each node. Every network uses three blueprints: one for the relay node, one the relay runs for every client, and one for every client node. The built-in blueprints are read-only; create your own to change how networks carry traffic. Blueprints are stored on the connected node that has networks enabled, and calls wait until that node is connected.
Get blueprint
Get a single blueprint.
- REST
- gRPC
/v1/blueprints/{id}idstringThe ID of the blueprint to fetch.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.blueprints.getBlueprint({
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.blueprints.get_blueprint(id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f")
curl 'http://127.0.0.1:10565/v1/blueprints/<id>'
idstringThe ID of the blueprint.
blueprintBlueprintThe blueprint.
rpc getBlueprint(GetBlueprintRequest) returns (GetBlueprintResponse)
Method /nanopinggrpc.networks.Blueprints/getBlueprint
idstringThe ID of the blueprint to fetch.
idstringThe ID of the blueprint.
blueprintBlueprintThe blueprint.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/networks"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Blueprints.GetBlueprint(ctx, &networks.GetBlueprintRequest{
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/networks"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := networks.NewBlueprintsClient(conn)
response, err := stub.GetBlueprint(ctx, &networks.GetBlueprintRequest{
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
Get blueprints
Get all blueprints, including the built-in read-only ones.
- REST
- gRPC
/v1/blueprints- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.blueprints.getBlueprints();
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.blueprints.get_blueprints()
curl 'http://127.0.0.1:10565/v1/blueprints'
blueprintsGetBlueprintResponse[]The blueprints with their IDs.
rpc getBlueprints(GetBlueprintsRequest) returns (GetBlueprintsResponse)
Method /nanopinggrpc.networks.Blueprints/getBlueprints
No fields.
blueprintsGetBlueprintResponse[]The blueprints with their IDs.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/networks"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Blueprints.GetBlueprints(ctx, &networks.GetBlueprintsRequest{})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/networks"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := networks.NewBlueprintsClient(conn)
response, err := stub.GetBlueprints(ctx, &networks.GetBlueprintsRequest{})
Create blueprint
Create a blueprint and return it.
- REST
- gRPC
/v1/blueprintsnamestringThe name of the blueprint. Example:
UDP relaytemplatestringThe template that renders a pipeline configuration. Placeholders such as
{{ .node.ip }}are filled in with network and node parameters.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.blueprints.createBlueprint({
blueprint: {
name: "UDP relay",
template: "<blueprint template>"
}
});
from nanoping_api import BlueprintWrite, NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.blueprints.create_blueprint(
blueprint=BlueprintWrite(name="UDP relay", template="<blueprint template>"),
)
curl -X POST 'http://127.0.0.1:10565/v1/blueprints' \
-H 'Content-Type: application/json' \
-d '{
"name": "UDP relay",
"template": "<blueprint template>"
}'
idstringThe generated ID of the blueprint.
blueprintBlueprintThe created blueprint.
rpc createBlueprint(CreateBlueprintRequest) returns (CreateBlueprintResponse)
Method /nanopinggrpc.networks.Blueprints/createBlueprint
blueprintBlueprintWriteThe blueprint to create. Required.
idstringThe generated ID of the blueprint.
blueprintBlueprintThe created blueprint.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/networks"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Blueprints.CreateBlueprint(ctx, &networks.CreateBlueprintRequest{
Blueprint: &networks.BlueprintWrite{
Name: "UDP relay",
Template: "<blueprint template>",
},
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/networks"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := networks.NewBlueprintsClient(conn)
response, err := stub.CreateBlueprint(ctx, &networks.CreateBlueprintRequest{
Blueprint: &networks.BlueprintWrite{
Name: "UDP relay",
Template: "<blueprint template>",
},
})
Update blueprint
Replace a blueprint and return the updated blueprint. Networks using the blueprint have their pipelines regenerated. Fails with a permission error for read-only blueprints.
- REST
- gRPC
/v1/blueprints/{id}idstringThe ID of the blueprint to update.
namestringThe name of the blueprint. Example:
UDP relaytemplatestringThe template that renders a pipeline configuration. Placeholders such as
{{ .node.ip }}are filled in with network and node parameters.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.blueprints.updateBlueprint({
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
blueprint: {
name: "UDP relay",
template: "<blueprint template>"
}
});
from nanoping_api import BlueprintWrite, NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.blueprints.update_blueprint(
id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
blueprint=BlueprintWrite(name="UDP relay", template="<blueprint template>"),
)
curl -X PUT 'http://127.0.0.1:10565/v1/blueprints/<id>' \
-H 'Content-Type: application/json' \
-d '{
"name": "UDP relay",
"template": "<blueprint template>"
}'
idstringThe ID of the blueprint.
blueprintBlueprintThe blueprint after the update.
rpc updateBlueprint(UpdateBlueprintRequest) returns (UpdateBlueprintResponse)
Method /nanopinggrpc.networks.Blueprints/updateBlueprint
idstringThe ID of the blueprint to update.
blueprintBlueprintWriteThe new name and template. Required.
idstringThe ID of the blueprint.
blueprintBlueprintThe blueprint 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/networks"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Blueprints.UpdateBlueprint(ctx, &networks.UpdateBlueprintRequest{
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Blueprint: &networks.BlueprintWrite{
Name: "UDP relay",
Template: "<blueprint template>",
},
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/networks"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := networks.NewBlueprintsClient(conn)
response, err := stub.UpdateBlueprint(ctx, &networks.UpdateBlueprintRequest{
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
Blueprint: &networks.BlueprintWrite{
Name: "UDP relay",
Template: "<blueprint template>",
},
})
Delete blueprint
Delete a blueprint. Fails with a permission error for read-only blueprints.
- REST
- gRPC
/v1/blueprints/{id}idstringThe ID of the blueprint to delete.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
await client.blueprints.deleteBlueprint({
id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
client.blueprints.delete_blueprint(id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f")
curl -X DELETE 'http://127.0.0.1:10565/v1/blueprints/<id>'
No fields.
rpc deleteBlueprint(DeleteBlueprintRequest) returns (DeleteBlueprintResponse)
Method /nanopinggrpc.networks.Blueprints/deleteBlueprint
idstringThe ID of the blueprint 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/networks"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
_, err = c.Blueprints.DeleteBlueprint(ctx, &networks.DeleteBlueprintRequest{
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/networks"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := networks.NewBlueprintsClient(conn)
_, err = stub.DeleteBlueprint(ctx, &networks.DeleteBlueprintRequest{
Id: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})