Skip to main content

Pulumi 管理的蓝图示例

该示例包括一个完整的blueprint 资源定义,其中包括 Pulumi:

以下是所有支持语言的定义示例:

from pulumi import ResourceOptions
import port_pulumi as port

other = port.Blueprint(
"other",
identifier="test-docs-relation",
icon="Microservice",
title="Test Docs Relation",
properties=port.BlueprintPropertiesArgs(
string_props={
"myStringProp": port.BlueprintPropertiesStringPropsArgs(
title="My string", required=False
)
}
),
)

blueprint = port.Blueprint(
"myBlueprint",
identifier="test-docs",
icon="Microservice",
title="Test Docs",
properties=port.BlueprintPropertiesArgs(
string_props={
"myStringProp": port.BlueprintPropertiesStringPropsArgs(
title="My string", required=False
),
"myUrlProp": port.BlueprintPropertiesStringPropsArgs(
title="My url", required=False, format="url"
),
"myEmailProp": port.BlueprintPropertiesStringPropsArgs(
title="My email", required=False, format="email"
),
"myUserProp": port.BlueprintPropertiesStringPropsArgs(
title="My user", required=False, format="user"
),
"myTeamProp": port.BlueprintPropertiesStringPropsArgs(
title="My team", required=False, format="team"
),
"myDatetimeProp": port.BlueprintPropertiesStringPropsArgs(
title="My datetime", required=False, format="date-time"
),
"myTimerProp": port.BlueprintPropertiesStringPropsArgs(
title="My timer", required=False, format="timer"
),
"myYAMLProp": port.BlueprintPropertiesStringPropsArgs(
title="My yaml", required=False, format="yaml"
),
},
number_props={
"myNumberProp": port.BlueprintPropertiesNumberPropsArgs(
title="My number", required=False,
)
},
boolean_props={
"myBooleanProp": port.BlueprintPropertiesBooleanPropsArgs(
title="My boolean", required=False
)
},
object_props={
"myObjectProp": port.BlueprintPropertiesObjectPropsArgs(
title="My object", required=False
)
},
array_props={
"myArrayProp": port.BlueprintPropertiesArrayPropsArgs(
title="My array", required=False
)
}
),
mirror_properties={
"myMirrorProp": port.BlueprintMirrorPropertiesArgs(
title="My mirror property", path="myRelation.myStringProp"
),
"myMirrorPropWithMeta": port.BlueprintMirrorPropertiesArgs(
title="My mirror property of meta property", path="myRelation.$identifier"
),
},
calculation_properties={
"myCalculation": port.BlueprintCalculationPropertiesArgs(
title="My calculation property", calculation=".properties.myStringProp + .properties.myStringProp", type="string",
),
"myCalculationWithMeta": port.BlueprintCalculationPropertiesArgs(
title="My calculation property with meta properties", calculation='.identifier + "-" + .title + "-" + .properties.myStringProp', type="string",
),
},
relations={
"myRelation": port.BlueprintRelationsArgs(
title="My relation", target="test-docs-relation", many=False, required=False,
),
},
opts=ResourceOptions(depends_on=[other]),
)