UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

226 lines (225 loc) 7.74 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manages a Work Item Query (WIQL based list / tree query) in Azure DevOps. * * A query can live either directly under one of the root areas `Shared Queries` or `My Queries`, or inside another query folder. You must provide exactly one of `area` (either `Shared Queries` or `My Queries`) or `parentId` (an existing folder's ID) when creating a query. * * The WIQL (Work Item Query Language) statement is used to define the query logic. See the [WIQL Syntax Reference](https://learn.microsoft.com/en-us/azure/devops/boards/queries/wiql-syntax?view=azure-devops) for more information. * * ## Example Usage * * ### Basic query under Shared Queries * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.Project("example", { * name: "Example Project", * workItemTemplate: "Agile", * versionControl: "Git", * visibility: "private", * }); * const allIssues = new azuredevops.Workitemquery("all_issues", { * projectId: example.id, * name: "All Active Issues", * area: "Shared Queries", * wiql: `SELECT [System.Id], [System.Title], [System.State] * FROM WorkItems * WHERE [System.WorkItemType] = 'Issue' * AND [System.State] <> 'Closed' * ORDER BY [System.ChangedDate] DESC * `, * }); * ``` * * ### Query inside a custom folder * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.Project("example", { * name: "Example Project", * workItemTemplate: "Agile", * versionControl: "Git", * visibility: "private", * }); * const teamFolder = new azuredevops.WorkitemqueryFolder("team_folder", { * projectId: example.id, * name: "Team", * area: "Shared Queries", * }); * const myTeamBugs = new azuredevops.Workitemquery("my_team_bugs", { * projectId: example.id, * name: "Team Bugs", * parentId: teamFolder.id, * wiql: `SELECT [System.Id], [System.Title], [System.State], [System.AssignedTo] * FROM WorkItems * WHERE [System.WorkItemType] = 'Bug' * AND [System.State] <> 'Closed' * ORDER BY [System.CreatedDate] DESC * `, * }); * ``` * * ### Applying permissions to a query * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * import * as std from "@pulumi/std"; * * const example = new azuredevops.Project("example", { * name: "Example Project", * workItemTemplate: "Agile", * versionControl: "Git", * visibility: "private", * }); * const teamFolder = new azuredevops.WorkitemqueryFolder("team_folder", { * projectId: example.id, * name: "Team", * area: "Shared Queries", * }); * const myTeamBugs = new azuredevops.Workitemquery("my_team_bugs", { * projectId: example.id, * name: "Team Bugs", * parentId: teamFolder.id, * wiql: `SELECT [System.Id], [System.Title], [System.State], [System.AssignedTo] * FROM WorkItems * WHERE [System.WorkItemType] = 'Bug' * AND [System.State] <> 'Closed' * ORDER BY [System.CreatedDate] DESC * `, * }); * const example_readers = azuredevops.getGroupOutput({ * projectId: example.id, * name: "Readers", * }); * const queryPermissions = new azuredevops.WorkItemQueryPermissions("query_permissions", { * projectId: example.id, * path: std.index.format({ * input: "%s/%s", * args: [ * teamFolder.name, * myTeamBugs.name, * ], * }).result, * principal: example_readers.apply(example_readers => example_readers.id), * permissions: { * Read: "Allow", * Contribute: "Deny", * ManagePermissions: "Deny", * Delete: "Deny", * }, * }); * ``` * * ## Relevant Links * * * [Azure DevOps REST API - Work Item Query (Queries)](https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/queries?view=azure-devops-rest-7.1) * * [WIQL Syntax Reference](https://learn.microsoft.com/en-us/azure/devops/boards/queries/wiql-syntax?view=azure-devops) * * ## PAT Permissions Required * * * **Work Items**: Read & Write * * ## Import * * The resource does not support import. */ export declare class Workitemquery extends pulumi.CustomResource { /** * Get an existing Workitemquery 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?: WorkitemqueryState, opts?: pulumi.CustomResourceOptions): Workitemquery; /** * Returns true if the given object is an instance of Workitemquery. 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 Workitemquery; /** * Root folder for the query. Must be one of `Shared Queries` or `My Queries`. */ readonly area: pulumi.Output<string | undefined>; /** * The display name of the query. */ readonly name: pulumi.Output<string>; /** * The ID of the parent query folder under which to create the query. */ readonly parentId: pulumi.Output<string | undefined>; /** * The ID of the Project containing the query. */ readonly projectId: pulumi.Output<string>; /** * The WIQL (Work Item Query Language) statement. Length 1–32000 characters. */ readonly wiql: pulumi.Output<string>; /** * Create a Workitemquery 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: WorkitemqueryArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Workitemquery resources. */ export interface WorkitemqueryState { /** * Root folder for the query. Must be one of `Shared Queries` or `My Queries`. */ area?: pulumi.Input<string>; /** * The display name of the query. */ name?: pulumi.Input<string>; /** * The ID of the parent query folder under which to create the query. */ parentId?: pulumi.Input<string>; /** * The ID of the Project containing the query. */ projectId?: pulumi.Input<string>; /** * The WIQL (Work Item Query Language) statement. Length 1–32000 characters. */ wiql?: pulumi.Input<string>; } /** * The set of arguments for constructing a Workitemquery resource. */ export interface WorkitemqueryArgs { /** * Root folder for the query. Must be one of `Shared Queries` or `My Queries`. */ area?: pulumi.Input<string>; /** * The display name of the query. */ name?: pulumi.Input<string>; /** * The ID of the parent query folder under which to create the query. */ parentId?: pulumi.Input<string>; /** * The ID of the Project containing the query. */ projectId: pulumi.Input<string>; /** * The WIQL (Work Item Query Language) statement. Length 1–32000 characters. */ wiql: pulumi.Input<string>; }