UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

213 lines 9.83 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ServicehookWebhookTfs = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a Webhook TFS Service Hook that sends HTTP POST requests to a specified URL when Azure DevOps events occur. * * ## Example Usage * * ### Git Push Event * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.Project("example", {name: "example-project"}); * const exampleServicehookWebhookTfs = new azuredevops.ServicehookWebhookTfs("example", { * projectId: example.id, * url: "https://example.com/webhook", * gitPush: { * branch: "refs/heads/main", * repositoryId: exampleAzuredevopsGitRepository.id, * }, * }); * ``` * * ### Build Completed Event with Authentication * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.ServicehookWebhookTfs("example", { * projectId: exampleAzuredevopsProject.id, * url: "https://example.com/webhook", * basicAuthUsername: "webhook_user", * basicAuthPassword: webhookPassword, * acceptUntrustedCerts: false, * buildCompleted: { * definitionName: "CI Build", * buildStatus: "Succeeded", * }, * }); * ``` * * ### Pull Request Created Event with HTTP Headers * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.ServicehookWebhookTfs("example", { * projectId: exampleAzuredevopsProject.id, * url: "https://example.com/webhook", * httpHeaders: { * "X-Custom-Header": "my-value", * Authorization: `Bearer ${apiToken}`, * }, * gitPullRequestCreated: { * repositoryId: exampleAzuredevopsGitRepository.id, * branch: "refs/heads/develop", * }, * }); * ``` * * ### Work Item Updated Event * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.ServicehookWebhookTfs("example", { * projectId: exampleAzuredevopsProject.id, * url: "https://example.com/webhook", * resourceDetailsToSend: "all", * messagesToSend: "text", * detailedMessagesToSend: "markdown", * workItemUpdated: { * workItemType: "Bug", * areaPath: "MyProject\\Area", * changedFields: "System.State", * }, * }); * ``` * * An empty configuration block will trigger on all events of that type: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.ServicehookWebhookTfs("example", { * projectId: exampleAzuredevopsProject.id, * url: "https://example.com/webhook", * gitPush: {}, * }); * ``` * * ## Import * * Webhook TFS Service Hook can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azuredevops:index/servicehookWebhookTfs:ServicehookWebhookTfs example 00000000-0000-0000-0000-000000000000 * ``` */ class ServicehookWebhookTfs extends pulumi.CustomResource { /** * Get an existing ServicehookWebhookTfs 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 ServicehookWebhookTfs(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ServicehookWebhookTfs. 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'] === ServicehookWebhookTfs.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["acceptUntrustedCerts"] = state?.acceptUntrustedCerts; resourceInputs["basicAuthPassword"] = state?.basicAuthPassword; resourceInputs["basicAuthUsername"] = state?.basicAuthUsername; resourceInputs["buildCompleted"] = state?.buildCompleted; resourceInputs["detailedMessagesToSend"] = state?.detailedMessagesToSend; resourceInputs["gitPullRequestCommented"] = state?.gitPullRequestCommented; resourceInputs["gitPullRequestCreated"] = state?.gitPullRequestCreated; resourceInputs["gitPullRequestMergeAttempted"] = state?.gitPullRequestMergeAttempted; resourceInputs["gitPullRequestUpdated"] = state?.gitPullRequestUpdated; resourceInputs["gitPush"] = state?.gitPush; resourceInputs["httpHeaders"] = state?.httpHeaders; resourceInputs["messagesToSend"] = state?.messagesToSend; resourceInputs["projectId"] = state?.projectId; resourceInputs["repositoryCreated"] = state?.repositoryCreated; resourceInputs["repositoryDeleted"] = state?.repositoryDeleted; resourceInputs["repositoryForked"] = state?.repositoryForked; resourceInputs["repositoryRenamed"] = state?.repositoryRenamed; resourceInputs["repositoryStatusChanged"] = state?.repositoryStatusChanged; resourceInputs["resourceDetailsToSend"] = state?.resourceDetailsToSend; resourceInputs["serviceConnectionCreated"] = state?.serviceConnectionCreated; resourceInputs["serviceConnectionUpdated"] = state?.serviceConnectionUpdated; resourceInputs["tfvcCheckin"] = state?.tfvcCheckin; resourceInputs["url"] = state?.url; resourceInputs["workItemCommented"] = state?.workItemCommented; resourceInputs["workItemCreated"] = state?.workItemCreated; resourceInputs["workItemDeleted"] = state?.workItemDeleted; resourceInputs["workItemRestored"] = state?.workItemRestored; resourceInputs["workItemUpdated"] = state?.workItemUpdated; } else { const args = argsOrState; if (args?.projectId === undefined && !opts.urn) { throw new Error("Missing required property 'projectId'"); } if (args?.url === undefined && !opts.urn) { throw new Error("Missing required property 'url'"); } resourceInputs["acceptUntrustedCerts"] = args?.acceptUntrustedCerts; resourceInputs["basicAuthPassword"] = args?.basicAuthPassword ? pulumi.secret(args.basicAuthPassword) : undefined; resourceInputs["basicAuthUsername"] = args?.basicAuthUsername; resourceInputs["buildCompleted"] = args?.buildCompleted; resourceInputs["detailedMessagesToSend"] = args?.detailedMessagesToSend; resourceInputs["gitPullRequestCommented"] = args?.gitPullRequestCommented; resourceInputs["gitPullRequestCreated"] = args?.gitPullRequestCreated; resourceInputs["gitPullRequestMergeAttempted"] = args?.gitPullRequestMergeAttempted; resourceInputs["gitPullRequestUpdated"] = args?.gitPullRequestUpdated; resourceInputs["gitPush"] = args?.gitPush; resourceInputs["httpHeaders"] = args?.httpHeaders; resourceInputs["messagesToSend"] = args?.messagesToSend; resourceInputs["projectId"] = args?.projectId; resourceInputs["repositoryCreated"] = args?.repositoryCreated; resourceInputs["repositoryDeleted"] = args?.repositoryDeleted; resourceInputs["repositoryForked"] = args?.repositoryForked; resourceInputs["repositoryRenamed"] = args?.repositoryRenamed; resourceInputs["repositoryStatusChanged"] = args?.repositoryStatusChanged; resourceInputs["resourceDetailsToSend"] = args?.resourceDetailsToSend; resourceInputs["serviceConnectionCreated"] = args?.serviceConnectionCreated; resourceInputs["serviceConnectionUpdated"] = args?.serviceConnectionUpdated; resourceInputs["tfvcCheckin"] = args?.tfvcCheckin; resourceInputs["url"] = args?.url; resourceInputs["workItemCommented"] = args?.workItemCommented; resourceInputs["workItemCreated"] = args?.workItemCreated; resourceInputs["workItemDeleted"] = args?.workItemDeleted; resourceInputs["workItemRestored"] = args?.workItemRestored; resourceInputs["workItemUpdated"] = args?.workItemUpdated; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["basicAuthPassword"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(ServicehookWebhookTfs.__pulumiType, name, resourceInputs, opts); } } exports.ServicehookWebhookTfs = ServicehookWebhookTfs; /** @internal */ ServicehookWebhookTfs.__pulumiType = 'azuredevops:index/servicehookWebhookTfs:ServicehookWebhookTfs'; //# sourceMappingURL=servicehookWebhookTfs.js.map