原型
Proto 是一种数据类型,被用于用于在 Port 中保存 .proto 定义。
💡 常见原语 Usage
例如,proto 属性类型可用于存储在 .proto 文件中定义的类型:
- 微服务之间的信息;
- 微服务应用程序接口;
应用程序接口定义
- Basic
- Array
{
"myProtoProp": {
"title": "My Proto",
"icon": "My icon",
"description": "My proto property",
"type": "string",
"format": "proto"
}
}
{
"myProtoArray": {
"title": "My proto array",
"icon": "My icon",
"description": "My proto array",
"type": "array",
"items": {
"type": "string",
"format": "proto"
}
}
}
Check out Port's API reference to learn more.
Terraform 定义
- Basic
- Array
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myProtoProp" = {
title = "My proto"
required = false
format = "proto"
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
array_props = {
"myProtoArray" = {
identifier = "myProtoArray"
title = "My proto array"
required = false
string_items = {
format = "proto"
}
}
}
}
}
Pulumi 的定义
- Basic
- Enum - coming soon
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertyArgs
blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
string_props={
"myProtoProp": BlueprintPropertyArgs(
title="My proto",
required=False,
format="proto",
)
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import * as port from "@port-labs/port";
export const blueprint = new port.Blueprint("myBlueprint", {
identifier: "myBlueprint",
title: "My Blueprint",
properties: {
stringProps: {
myProtoProp: {
title: "My proto",
required: false,
format: "proto",
},
},
},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new port.Blueprint("myBlueprint", {
title: "My Blueprint",
identifier: "myBlueprint",
properties: {
stringProps: {
myProtoProp: {
title: "My proto",
required: false,
format: "proto",
},
},
},
relations: [],
});
exports.title = entity.title;
package main
import (
"github.com/port-labs/pulumi-port/sdk/go/port"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
blueprint, err := port.NewBlueprint(ctx, "myBlueprint", &port.BlueprintArgs{
Identifier: pulumi.String("myBlueprint"),
Title: pulumi.String("My Blueprint"),
Properties: port.BlueprintPropertiesArgs{
"myProtoProp": port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My proto"),
Required: pulumi.Bool(false),
Format: pulumi.String("proto"),
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}