团队
团队是一种数据类型,用于引用存在于 Port 中的团队。
💡 团队常用 Usage
例如,团队属性类型可被用来引用任何存在于 Port 中的团队:
- 服务拥有团队;
- 当前待命人员
- 主要维护者;
- 等等。
在live demo 这个例子中,我们可以看到 Team
团队属性。
应用程序接口定义
- Basic
- Array
{
"myTeamProp": {
"title": "My team",
"icon": "My icon",
"description": "My team property",
"type": "string",
"format": "team",
"default": "my-team"
}
}
{
"myTeamArray": {
"title": "My team array",
"icon": "My icon",
"description": "My team array",
"type": "array",
"items": {
"type": "string",
"format": "team"
}
}
}
Check out Port's API reference to learn more.
Terraform 定义
- Basic
- Array
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
myTeamProp = {
title = "My team"
required = false
format = "team"
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
array_props = {
myTeamArray = {
title = "My team array"
required = false
type = "array"
string_items = {
format = "user"
}
}
}
}
}
Pulumi 的定义
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertiesStringPropsArgs
blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
string_props={
"myTeamProp": BlueprintPropertiesStringPropsArgs(
title="My team",
required=False,
format="team",
)
}
),
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: {
myTeamProp: {
title: "My team",
required: false,
format: "team",
},
},
},
});
"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: {
myTeamProp: {
title: "My team",
required: false,
format: "team",
},
},
},
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{
StringProps: port.BlueprintPropertiesStringPropsMap{
"myTeamProp": &port.BlueprintPropertyArgs{
Title: pulumi.String("My team"),
Required: pulumi.Bool(false),
Format: pulumi.String("team"),
},
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}