UNPKG

@port-labs/port

Version:

A Pulumi package for creating and managing Port resources.

201 lines 9.05 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.Action = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Docs for the Action resource can be found [here](https://docs.getport.io/create-self-service-experiences/). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as port from "@pulumi/port"; * * const createMicroservice = new port.index.Port_action("createMicroservice", { * title: "Create Microservice", * identifier: "create-microservice", * icon: "Terraform", * selfServiceTrigger: { * operation: "CREATE", * blueprintIdentifier: port_blueprint.microservice.identifier, * userProperties: { * stringProps: { * myStringIdentifier: { * title: "My String Identifier", * required: true, * format: "entity", * blueprint: port_blueprint.parent.identifier, * dataset: { * combinator: "and", * rules: [{ * property: "$title", * operator: "contains", * value: { * jqQuery: "\"specificValue\"", * }, * }], * }, * sort: { * property: "$updatedAt", * order: "DESC", * }, * }, * }, * numberProps: { * myNumberIdentifier: { * title: "My Number Identifier", * required: true, * maximum: 100, * minimum: 0, * }, * }, * booleanProps: { * myBooleanIdentifier: { * title: "My Boolean Identifier", * required: true, * }, * }, * objectProps: { * myObjectIdentifier: { * title: "My Object Identifier", * required: true, * }, * }, * arrayProps: { * myArrayIdentifier: { * title: "My Array Identifier", * required: true, * stringItems: { * format: "entity", * blueprint: port_blueprint.parent.identifier, * dataset: JSON.stringify({ * combinator: "and", * rules: [{ * property: "$title", * operator: "contains", * value: "specificValue", * }], * }), * }, * sort: { * property: "$updatedAt", * order: "DESC", * }, * }, * }, * }, * }, * kafkaMethod: { * payload: JSON.stringify({ * runId: "{{.run.id}}", * }), * }, * }); * ``` * * ### With Automation Trigger * * Port allows setting an automation trigger to an action, for executing an action based on event occurred to an entity in Port. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as port from "@pulumi/port"; * * const deleteTemporaryMicroservice = new port.index.Port_action("deleteTemporaryMicroservice", { * title: "Delete Temporary Microservice", * identifier: "delete-temp-microservice", * icon: "Terraform", * automationTrigger: { * timerPropertyExpiredEvent: { * blueprintIdentifier: port_blueprint.microservice.identifier, * propertyIdentifier: "ttl", * }, * }, * kafkaMethod: { * payload: JSON.stringify({ * runId: "{{.run.id}}", * }), * }, * }); * ``` */ class Action extends pulumi.CustomResource { /** * Get an existing Action 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 Action(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Action. 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'] === Action.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["approvalEmailNotification"] = state ? state.approvalEmailNotification : undefined; resourceInputs["approvalWebhookNotification"] = state ? state.approvalWebhookNotification : undefined; resourceInputs["automationTrigger"] = state ? state.automationTrigger : undefined; resourceInputs["azureMethod"] = state ? state.azureMethod : undefined; resourceInputs["blueprint"] = state ? state.blueprint : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["githubMethod"] = state ? state.githubMethod : undefined; resourceInputs["gitlabMethod"] = state ? state.gitlabMethod : undefined; resourceInputs["icon"] = state ? state.icon : undefined; resourceInputs["identifier"] = state ? state.identifier : undefined; resourceInputs["kafkaMethod"] = state ? state.kafkaMethod : undefined; resourceInputs["publish"] = state ? state.publish : undefined; resourceInputs["requiredApproval"] = state ? state.requiredApproval : undefined; resourceInputs["selfServiceTrigger"] = state ? state.selfServiceTrigger : undefined; resourceInputs["title"] = state ? state.title : undefined; resourceInputs["upsertEntityMethod"] = state ? state.upsertEntityMethod : undefined; resourceInputs["webhookMethod"] = state ? state.webhookMethod : undefined; } else { const args = argsOrState; if ((!args || args.identifier === undefined) && !opts.urn) { throw new Error("Missing required property 'identifier'"); } resourceInputs["approvalEmailNotification"] = args ? args.approvalEmailNotification : undefined; resourceInputs["approvalWebhookNotification"] = args ? args.approvalWebhookNotification : undefined; resourceInputs["automationTrigger"] = args ? args.automationTrigger : undefined; resourceInputs["azureMethod"] = args ? args.azureMethod : undefined; resourceInputs["blueprint"] = args ? args.blueprint : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["githubMethod"] = args ? args.githubMethod : undefined; resourceInputs["gitlabMethod"] = args ? args.gitlabMethod : undefined; resourceInputs["icon"] = args ? args.icon : undefined; resourceInputs["identifier"] = args ? args.identifier : undefined; resourceInputs["kafkaMethod"] = args ? args.kafkaMethod : undefined; resourceInputs["publish"] = args ? args.publish : undefined; resourceInputs["requiredApproval"] = args ? args.requiredApproval : undefined; resourceInputs["selfServiceTrigger"] = args ? args.selfServiceTrigger : undefined; resourceInputs["title"] = args ? args.title : undefined; resourceInputs["upsertEntityMethod"] = args ? args.upsertEntityMethod : undefined; resourceInputs["webhookMethod"] = args ? args.webhookMethod : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Action.__pulumiType, name, resourceInputs, opts); } } exports.Action = Action; /** @internal */ Action.__pulumiType = 'port:index/action:Action'; //# sourceMappingURL=action.js.map