UNPKG

@port-labs/port

Version:

A Pulumi package for creating and managing Port resources.

175 lines 7 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Webhook = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * 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). */ 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, id, state, opts) { return new Webhook(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Webhook.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["createdBy"] = state ? state.createdBy : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["enabled"] = state ? state.enabled : undefined; resourceInputs["icon"] = state ? state.icon : undefined; resourceInputs["identifier"] = state ? state.identifier : undefined; resourceInputs["mappings"] = state ? state.mappings : undefined; resourceInputs["security"] = state ? state.security : undefined; resourceInputs["title"] = state ? state.title : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; resourceInputs["updatedBy"] = state ? state.updatedBy : undefined; resourceInputs["url"] = state ? state.url : undefined; resourceInputs["webhookKey"] = state ? state.webhookKey : undefined; } else { const args = argsOrState; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["enabled"] = args ? args.enabled : undefined; resourceInputs["icon"] = args ? args.icon : undefined; resourceInputs["identifier"] = args ? args.identifier : undefined; resourceInputs["mappings"] = args ? args.mappings : undefined; resourceInputs["security"] = args ? args.security : undefined; resourceInputs["title"] = args ? args.title : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["createdBy"] = undefined /*out*/; resourceInputs["updatedAt"] = undefined /*out*/; resourceInputs["updatedBy"] = undefined /*out*/; resourceInputs["url"] = undefined /*out*/; resourceInputs["webhookKey"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Webhook.__pulumiType, name, resourceInputs, opts); } } exports.Webhook = Webhook; /** @internal */ Webhook.__pulumiType = 'port:index/webhook:Webhook'; //# sourceMappingURL=webhook.js.map