UNPKG

@port-labs/port

Version:

A Pulumi package for creating and managing Port resources.

273 lines (272 loc) 8.11 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Webhook resource can be used to create webhooks integrations in Port. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as port from "@pulumi/port"; * * const author = new port.index.Port_blueprint("author", { * title: "Author", * icon: "User", * identifier: "author", * properties: { * stringProps: { * name: { * type: "string", * title: "Name", * }, * }, * }, * }); * const team = new port.index.Port_blueprint("team", { * title: "Team", * icon: "Team", * identifier: "team", * properties: { * stringProps: { * name: { * type: "string", * title: "Team Name", * }, * }, * }, * }); * const microservice = new port.index.Port_blueprint("microservice", { * title: "TF test microservice", * icon: "Terraform", * identifier: "microservice", * properties: { * stringProps: { * url: { * type: "string", * title: "URL", * }, * }, * }, * relations: { * author: { * title: "Author", * target: author.identifier, * }, * team: { * title: "Team", * target: team.identifier, * }, * }, * }); * const createPr = new port.index.Port_webhook("createPr", { * identifier: "pr_webhook", * title: "Webhook with mixed relations", * icon: "Terraform", * enabled: true, * mappings: [{ * blueprint: microservice.identifier, * operation: { * type: "create", * }, * filter: ".headers.\"x-github-event\" == \"pull_request\"", * entity: { * identifier: ".body.pull_request.id | tostring", * title: ".body.pull_request.title", * properties: { * url: ".body.pull_request.html_url", * }, * relations: { * author: JSON.stringify({ * combinator: "'and'", * rules: [{ * property: "'$identifier'", * operator: "'='", * value: ".body.pull_request.user.login | tostring", * }], * }), * team: ".body.repository.owner.login | tostring", * }, * }, * }], * }, { * dependsOn: [ * microservice, * author, * team, * ], * }); * ``` * * ## Notes * * - When using object format for relations, `combinator`, `property` and `operator` fields should be enclosed in single quotes, while `value` should not have quotes as it's a JQ expression. The single quotes are required because these fields contain literal string values that must be passed as-is to the Port API, whereas `value` contains a JQ expression that should be evaluated dynamically. * - For all available operators, see the [Port comparison operators documentation](https://docs.port.io/search-and-query/comparison-operators). */ export declare class Webhook extends pulumi.CustomResource { /** * Get an existing Webhook 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?: WebhookState, opts?: pulumi.CustomResourceOptions): Webhook; /** * Returns true if the given object is an instance of Webhook. 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 Webhook; /** * The creation date of the webhook */ readonly createdAt: pulumi.Output<string>; /** * The creator of the webhook */ readonly createdBy: pulumi.Output<string>; /** * The description of the webhook */ readonly description: pulumi.Output<string | undefined>; /** * Whether the webhook is enabled */ readonly enabled: pulumi.Output<boolean>; /** * The icon of the webhook */ readonly icon: pulumi.Output<string | undefined>; /** * The identifier of the webhook */ readonly identifier: pulumi.Output<string>; /** * The mappings of the webhook */ readonly mappings: pulumi.Output<outputs.WebhookMapping[] | undefined>; /** * The security of the webhook */ readonly security: pulumi.Output<outputs.WebhookSecurity | undefined>; /** * The title of the webhook */ readonly title: pulumi.Output<string | undefined>; /** * The last update date of the webhook */ readonly updatedAt: pulumi.Output<string>; /** * The last updater of the webhook */ readonly updatedBy: pulumi.Output<string>; /** * The url of the webhook */ readonly url: pulumi.Output<string>; /** * The webhook key of the webhook */ readonly webhookKey: pulumi.Output<string>; /** * Create a Webhook 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?: WebhookArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Webhook resources. */ export interface WebhookState { /** * The creation date of the webhook */ createdAt?: pulumi.Input<string>; /** * The creator of the webhook */ createdBy?: pulumi.Input<string>; /** * The description of the webhook */ description?: pulumi.Input<string>; /** * Whether the webhook is enabled */ enabled?: pulumi.Input<boolean>; /** * The icon of the webhook */ icon?: pulumi.Input<string>; /** * The identifier of the webhook */ identifier?: pulumi.Input<string>; /** * The mappings of the webhook */ mappings?: pulumi.Input<pulumi.Input<inputs.WebhookMapping>[]>; /** * The security of the webhook */ security?: pulumi.Input<inputs.WebhookSecurity>; /** * The title of the webhook */ title?: pulumi.Input<string>; /** * The last update date of the webhook */ updatedAt?: pulumi.Input<string>; /** * The last updater of the webhook */ updatedBy?: pulumi.Input<string>; /** * The url of the webhook */ url?: pulumi.Input<string>; /** * The webhook key of the webhook */ webhookKey?: pulumi.Input<string>; } /** * The set of arguments for constructing a Webhook resource. */ export interface WebhookArgs { /** * The description of the webhook */ description?: pulumi.Input<string>; /** * Whether the webhook is enabled */ enabled?: pulumi.Input<boolean>; /** * The icon of the webhook */ icon?: pulumi.Input<string>; /** * The identifier of the webhook */ identifier?: pulumi.Input<string>; /** * The mappings of the webhook */ mappings?: pulumi.Input<pulumi.Input<inputs.WebhookMapping>[]>; /** * The security of the webhook */ security?: pulumi.Input<inputs.WebhookSecurity>; /** * The title of the webhook */ title?: pulumi.Input<string>; }