Yaml
Yaml 是一种数据类型,被用于来保存 YAML 中的对象定义。
💡 常见的 yaml Usage
yaml 属性类型可被用来存储任何基于 key/value 的数据,例如:
- 配置;
- Helm 图表;
- 字典/哈希图
- 配置清单;
values.yml
;- 等。
在这个live demo 示例中,我们可以看到 Helm Chart
yaml 属性。 🎬
应用程序接口定义
- Basic
- Array
{
"myYAMLProp": {
"title": "My yaml",
"icon": "My icon",
"description": "My yaml property",
"type": "string",
"format": "yaml"
}
}
{
"myYamlArray": {
"title": "My yaml array",
"icon": "My icon",
"description": "My yaml array",
"type": "array",
"items": {
"type": "string",
"format": "yaml"
}
}
}
Check out Port's API reference to learn more.
Terraform 定义
- Basic
- Array
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myYamlProp" = {
title = "My yaml"
required = false
format = "yaml"
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
array_props = {
"myYamlArray" = {
identifier = "myYamlArray"
title = "My yaml array"
required = false
string_items = {
format = "yaml"
}
}
}
}
}
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={
"myYamlProp": BlueprintPropertyArgs(
title="My yaml",
required=False,
format="yaml",
)
}
),
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: {
myYamlProp: {
title: "My yaml",
required: false,
format: "yaml",
},
},
},
});
"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: {
myYamlProp: {
title: "My yaml",
required: false,
format: "yaml",
},
},
},
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{
"myYAMLProp": port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My yaml"),
Required: pulumi.Bool(false),
Format: pulumi.String("yaml"),
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}