1. Packages
  2. AzureDevOps
  3. API Docs
  4. Queue
Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi

azuredevops.Queue

Explore with Pulumi AI

azuredevops logo
Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi

    Manages an agent queue within Azure DevOps. In the UI, this is equivalent to adding an Organization defined pool to a project.

    The created queue is not authorized for use by all pipelines in the project. However, the azuredevops.ResourceAuthorization resource can be used to grant authorization.

    Example Usage

    Creating a Queue from an organization-level pool

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const exampleProject = new azuredevops.Project("exampleProject", {});
    const examplePool = azuredevops.getPool({
        name: "example-pool",
    });
    const exampleQueue = new azuredevops.Queue("exampleQueue", {
        projectId: exampleProject.id,
        agentPoolId: examplePool.then(examplePool => examplePool.id),
    });
    // Grant access to queue to all pipelines in the project
    const exampleResourceAuthorization = new azuredevops.ResourceAuthorization("exampleResourceAuthorization", {
        projectId: exampleProject.id,
        resourceId: exampleQueue.id,
        type: "queue",
        authorized: true,
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example_project = azuredevops.Project("exampleProject")
    example_pool = azuredevops.get_pool(name="example-pool")
    example_queue = azuredevops.Queue("exampleQueue",
        project_id=example_project.id,
        agent_pool_id=example_pool.id)
    # Grant access to queue to all pipelines in the project
    example_resource_authorization = azuredevops.ResourceAuthorization("exampleResourceAuthorization",
        project_id=example_project.id,
        resource_id=example_queue.id,
        type="queue",
        authorized=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
    		if err != nil {
    			return err
    		}
    		examplePool, err := azuredevops.LookupPool(ctx, &azuredevops.LookupPoolArgs{
    			Name: "example-pool",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleQueue, err := azuredevops.NewQueue(ctx, "exampleQueue", &azuredevops.QueueArgs{
    			ProjectId:   exampleProject.ID(),
    			AgentPoolId: *pulumi.String(examplePool.Id),
    		})
    		if err != nil {
    			return err
    		}
    		// Grant access to queue to all pipelines in the project
    		_, err = azuredevops.NewResourceAuthorization(ctx, "exampleResourceAuthorization", &azuredevops.ResourceAuthorizationArgs{
    			ProjectId:  exampleProject.ID(),
    			ResourceId: exampleQueue.ID(),
    			Type:       pulumi.String("queue"),
    			Authorized: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureDevOps = Pulumi.AzureDevOps;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleProject = new AzureDevOps.Project("exampleProject");
    
        var examplePool = AzureDevOps.GetPool.Invoke(new()
        {
            Name = "example-pool",
        });
    
        var exampleQueue = new AzureDevOps.Queue("exampleQueue", new()
        {
            ProjectId = exampleProject.Id,
            AgentPoolId = examplePool.Apply(getPoolResult => getPoolResult.Id),
        });
    
        // Grant access to queue to all pipelines in the project
        var exampleResourceAuthorization = new AzureDevOps.ResourceAuthorization("exampleResourceAuthorization", new()
        {
            ProjectId = exampleProject.Id,
            ResourceId = exampleQueue.Id,
            Type = "queue",
            Authorized = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.AzuredevopsFunctions;
    import com.pulumi.azuredevops.inputs.GetPoolArgs;
    import com.pulumi.azuredevops.Queue;
    import com.pulumi.azuredevops.QueueArgs;
    import com.pulumi.azuredevops.ResourceAuthorization;
    import com.pulumi.azuredevops.ResourceAuthorizationArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var exampleProject = new Project("exampleProject");
    
            final var examplePool = AzuredevopsFunctions.getPool(GetPoolArgs.builder()
                .name("example-pool")
                .build());
    
            var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()        
                .projectId(exampleProject.id())
                .agentPoolId(examplePool.applyValue(getPoolResult -> getPoolResult.id()))
                .build());
    
            var exampleResourceAuthorization = new ResourceAuthorization("exampleResourceAuthorization", ResourceAuthorizationArgs.builder()        
                .projectId(exampleProject.id())
                .resourceId(exampleQueue.id())
                .type("queue")
                .authorized(true)
                .build());
    
        }
    }
    
    resources:
      exampleProject:
        type: azuredevops:Project
      exampleQueue:
        type: azuredevops:Queue
        properties:
          projectId: ${exampleProject.id}
          agentPoolId: ${examplePool.id}
      # Grant access to queue to all pipelines in the project
      exampleResourceAuthorization:
        type: azuredevops:ResourceAuthorization
        properties:
          projectId: ${exampleProject.id}
          resourceId: ${exampleQueue.id}
          type: queue
          authorized: true
    variables:
      examplePool:
        fn::invoke:
          Function: azuredevops:getPool
          Arguments:
            name: example-pool
    

    Creating a Queue at the project level (Organization-level permissions not required)

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const exampleProject = azuredevops.getProject({
        name: "Example Project",
    });
    const exampleQueue = new azuredevops.Queue("exampleQueue", {projectId: exampleProject.then(exampleProject => exampleProject.id)});
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example_project = azuredevops.get_project(name="Example Project")
    example_queue = azuredevops.Queue("exampleQueue", project_id=example_project.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleProject, err := azuredevops.LookupProject(ctx, &azuredevops.LookupProjectArgs{
    			Name: pulumi.StringRef("Example Project"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewQueue(ctx, "exampleQueue", &azuredevops.QueueArgs{
    			ProjectId: *pulumi.String(exampleProject.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureDevOps = Pulumi.AzureDevOps;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleProject = AzureDevOps.GetProject.Invoke(new()
        {
            Name = "Example Project",
        });
    
        var exampleQueue = new AzureDevOps.Queue("exampleQueue", new()
        {
            ProjectId = exampleProject.Apply(getProjectResult => getProjectResult.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.AzuredevopsFunctions;
    import com.pulumi.azuredevops.inputs.GetProjectArgs;
    import com.pulumi.azuredevops.Queue;
    import com.pulumi.azuredevops.QueueArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var exampleProject = AzuredevopsFunctions.getProject(GetProjectArgs.builder()
                .name("Example Project")
                .build());
    
            var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()        
                .projectId(exampleProject.applyValue(getProjectResult -> getProjectResult.id()))
                .build());
    
        }
    }
    
    resources:
      exampleQueue:
        type: azuredevops:Queue
        properties:
          projectId: ${exampleProject.id}
    variables:
      exampleProject:
        fn::invoke:
          Function: azuredevops:getProject
          Arguments:
            name: Example Project
    

    Create Queue Resource

    new Queue(name: string, args: QueueArgs, opts?: CustomResourceOptions);
    @overload
    def Queue(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              agent_pool_id: Optional[int] = None,
              name: Optional[str] = None,
              project_id: Optional[str] = None)
    @overload
    def Queue(resource_name: str,
              args: QueueArgs,
              opts: Optional[ResourceOptions] = None)
    func NewQueue(ctx *Context, name string, args QueueArgs, opts ...ResourceOption) (*Queue, error)
    public Queue(string name, QueueArgs args, CustomResourceOptions? opts = null)
    public Queue(String name, QueueArgs args)
    public Queue(String name, QueueArgs args, CustomResourceOptions options)
    
    type: azuredevops:Queue
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args QueueArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args QueueArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args QueueArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args QueueArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args QueueArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Queue Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Queue resource accepts the following input properties:

    ProjectId string
    The ID of the project in which to create the resource.
    AgentPoolId int

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    Name string
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    ProjectId string
    The ID of the project in which to create the resource.
    AgentPoolId int

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    Name string
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    projectId String
    The ID of the project in which to create the resource.
    agentPoolId Integer

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name String
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    projectId string
    The ID of the project in which to create the resource.
    agentPoolId number

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name string
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    project_id str
    The ID of the project in which to create the resource.
    agent_pool_id int

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name str
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    projectId String
    The ID of the project in which to create the resource.
    agentPoolId Number

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name String
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Queue resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Queue Resource

    Get an existing Queue resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: QueueState, opts?: CustomResourceOptions): Queue
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            agent_pool_id: Optional[int] = None,
            name: Optional[str] = None,
            project_id: Optional[str] = None) -> Queue
    func GetQueue(ctx *Context, name string, id IDInput, state *QueueState, opts ...ResourceOption) (*Queue, error)
    public static Queue Get(string name, Input<string> id, QueueState? state, CustomResourceOptions? opts = null)
    public static Queue get(String name, Output<String> id, QueueState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AgentPoolId int

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    Name string
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    ProjectId string
    The ID of the project in which to create the resource.
    AgentPoolId int

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    Name string
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    ProjectId string
    The ID of the project in which to create the resource.
    agentPoolId Integer

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name String
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    projectId String
    The ID of the project in which to create the resource.
    agentPoolId number

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name string
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    projectId string
    The ID of the project in which to create the resource.
    agent_pool_id int

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name str
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    project_id str
    The ID of the project in which to create the resource.
    agentPoolId Number

    The ID of the organization agent pool. Conflicts with name.

    NOTE: One of name or agent_pool_id must be specified, but not both. When agent_pool_id is specified, the agent queue name will be derived from the agent pool name.

    name String
    The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
    projectId String
    The ID of the project in which to create the resource.

    Import

    Azure DevOps Agent Pools can be imported using the project ID and agent queue ID, e.g.

    $ pulumi import azuredevops:index/queue:Queue example 00000000-0000-0000-0000-000000000000/0
    

    Package Details

    Repository
    Azure DevOps pulumi/pulumi-azuredevops
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuredevops Terraform Provider.
    azuredevops logo
    Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi