布尔型
布尔是一种原语数据类型,有两个可能的值--"true "和 "false"。
💡 常用布尔用法
例如,布尔属性类型可被用于来存储任何真/假门:
- 环境是否为部署锁定
- 环境是否应每晚关闭
- 服务是否处理 PII
- 环境是否公开
应用程序接口定义
{
"myBooleanProp": {
"title": "My boolean",
"icon": "My icon",
"description": "My boolean property",
"type": "boolean",
"default": true
}
}
Check out Port's API reference to learn more.
Terraform 定义
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
boolean_props = {
"myBooleanProp" = {
title = "My boolean"
required = true
}
}
}
}
Pulumi 的定义
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertiesBooleanPropsArgs
blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
boolean_props={
"myBooleanProp": BlueprintPropertiesBooleanPropsArgs(
title="My boolean",
required=True,
)
}
),
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: {
booleanProps: {
myBooleanProp: {
title: "My boolean",
required: true,
},
},
},
});
"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: {
booleanProps: {
myBooleanProp: {
title: "My boolean",
required: true,
},
},
},
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{
BooleanProps: port.BlueprintPropertiesBooleanPropsMap{
"myBooleanProp": port.BlueprintPropertiesBooleanPropsArgs{
Title: pulumi.String("My boolean"),
Required: pulumi.Bool(false),
},
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}