UNPKG

@port-labs/port

Version:

A Pulumi package for creating and managing Port resources.

360 lines (359 loc) 11 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * This resource allows you to manage a scorecard. * * See the [Port documentation](https://docs.getport.io/promote-scorecards/) for more information about scorecards. * * ## Example Usage * * This will create a blueprint with a Scorecard measuring the readiness of a microservice. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as port from "@pulumi/port"; * * const microservice = new port.index.Port_blueprint("microservice", { * title: "microservice", * icon: "Terraform", * identifier: "microservice", * properties: { * stringProps: { * author: { * title: "Author", * }, * url: { * title: "URL", * }, * }, * booleanProps: { * required: { * type: "boolean", * }, * }, * numberProps: { * sum: { * type: "number", * }, * }, * }, * }); * const readiness = new port.index.Port_scorecard("readiness", { * identifier: "Readiness", * title: "Readiness", * blueprint: microservice.identifier, * rules: [ * { * identifier: "hasOwner", * title: "Has Owner", * level: "Gold", * query: { * combinator: "and", * conditions: [ * JSON.stringify({ * property: "$team", * operator: "isNotEmpty", * }), * JSON.stringify({ * property: "author", * operator: "=", * value: "myValue", * }), * ], * }, * }, * { * identifier: "hasUrl", * title: "Has URL", * level: "Silver", * query: { * combinator: "and", * conditions: [JSON.stringify({ * property: "url", * operator: "isNotEmpty", * })], * }, * }, * { * identifier: "checkSumIfRequired", * title: "Check Sum If Required", * level: "Bronze", * query: { * combinator: "or", * conditions: [ * JSON.stringify({ * property: "required", * operator: "=", * value: false, * }), * JSON.stringify({ * property: "sum", * operator: ">", * value: 2, * }), * ], * }, * }, * ], * }, { * dependsOn: [microservice], * }); * ``` * * ### With Levels And Filter * * This will override the default levels (Basic, Bronze, Silver, Gold) with the provided levels: Not Ready, Partially Ready, Ready. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as port from "@pulumi/port"; * * const microservice = new port.index.Port_blueprint("microservice", { * title: "microservice", * icon: "Terraform", * identifier: "microservice", * properties: { * stringProps: { * author: { * title: "Author", * }, * url: { * title: "URL", * }, * }, * booleanProps: { * required: { * type: "boolean", * }, * }, * numberProps: { * sum: { * type: "number", * }, * }, * }, * }); * const readiness = new port.index.Port_scorecard("readiness", { * identifier: "Readiness", * title: "Readiness", * blueprint: microservice.identifier, * filter: { * combinator: "and", * conditions: [JSON.stringify({ * property: "sum", * operator: ">", * value: 0, * })], * }, * levels: [ * { * color: "red", * title: "No Ready", * }, * { * color: "yellow", * title: "Partially Ready", * }, * { * color: "green", * title: "Ready", * }, * ], * rules: [ * { * identifier: "hasOwner", * title: "Has Owner", * level: "Ready", * query: { * combinator: "and", * conditions: [ * JSON.stringify({ * property: "$team", * operator: "isNotEmpty", * }), * JSON.stringify({ * property: "author", * operator: "=", * value: "myValue", * }), * ], * }, * }, * { * identifier: "hasUrl", * title: "Has URL", * level: "Partially Ready", * query: { * combinator: "and", * conditions: [JSON.stringify({ * property: "url", * operator: "isNotEmpty", * })], * }, * }, * { * identifier: "checkSumIfRequired", * title: "Check Sum If Required", * level: "Partially Ready", * query: { * combinator: "or", * conditions: [ * JSON.stringify({ * property: "required", * operator: "=", * value: false, * }), * JSON.stringify({ * property: "sum", * operator: ">", * value: 2, * }), * ], * }, * }, * ], * }, { * dependsOn: [microservice], * }); * ``` */ export declare class Scorecard extends pulumi.CustomResource { /** * Get an existing Scorecard resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ScorecardState, opts?: pulumi.CustomResourceOptions): Scorecard; /** * Returns true if the given object is an instance of Scorecard. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Scorecard; /** * The blueprint of the scorecard */ readonly blueprint: pulumi.Output<string>; /** * The creation date of the scorecard */ readonly createdAt: pulumi.Output<string>; /** * The creator of the scorecard */ readonly createdBy: pulumi.Output<string>; /** * The filter to apply on the entities before calculating the scorecard */ readonly filter: pulumi.Output<outputs.ScorecardFilter | undefined>; /** * The identifier of the scorecard */ readonly identifier: pulumi.Output<string>; /** * The levels of the scorecard. This overrides the default levels (Basic, Bronze, Silver, Gold) if provided */ readonly levels: pulumi.Output<outputs.ScorecardLevel[] | undefined>; /** * The rules of the scorecard */ readonly rules: pulumi.Output<outputs.ScorecardRule[]>; /** * The title of the scorecard */ readonly title: pulumi.Output<string>; /** * The last update date of the scorecard */ readonly updatedAt: pulumi.Output<string>; /** * The last updater of the scorecard */ readonly updatedBy: pulumi.Output<string>; /** * Create a Scorecard resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ScorecardArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Scorecard resources. */ export interface ScorecardState { /** * The blueprint of the scorecard */ blueprint?: pulumi.Input<string>; /** * The creation date of the scorecard */ createdAt?: pulumi.Input<string>; /** * The creator of the scorecard */ createdBy?: pulumi.Input<string>; /** * The filter to apply on the entities before calculating the scorecard */ filter?: pulumi.Input<inputs.ScorecardFilter>; /** * The identifier of the scorecard */ identifier?: pulumi.Input<string>; /** * The levels of the scorecard. This overrides the default levels (Basic, Bronze, Silver, Gold) if provided */ levels?: pulumi.Input<pulumi.Input<inputs.ScorecardLevel>[]>; /** * The rules of the scorecard */ rules?: pulumi.Input<pulumi.Input<inputs.ScorecardRule>[]>; /** * The title of the scorecard */ title?: pulumi.Input<string>; /** * The last update date of the scorecard */ updatedAt?: pulumi.Input<string>; /** * The last updater of the scorecard */ updatedBy?: pulumi.Input<string>; } /** * The set of arguments for constructing a Scorecard resource. */ export interface ScorecardArgs { /** * The blueprint of the scorecard */ blueprint: pulumi.Input<string>; /** * The filter to apply on the entities before calculating the scorecard */ filter?: pulumi.Input<inputs.ScorecardFilter>; /** * The identifier of the scorecard */ identifier: pulumi.Input<string>; /** * The levels of the scorecard. This overrides the default levels (Basic, Bronze, Silver, Gold) if provided */ levels?: pulumi.Input<pulumi.Input<inputs.ScorecardLevel>[]>; /** * The rules of the scorecard */ rules: pulumi.Input<pulumi.Input<inputs.ScorecardRule>[]>; /** * The title of the scorecard */ title: pulumi.Input<string>; }