1. Packages
  2. AzureDevOps
  3. API Docs
  4. getProjects
Azure DevOps v3.1.1 published on Monday, May 20, 2024 by Pulumi

azuredevops.getProjects

Explore with Pulumi AI

azuredevops logo
Azure DevOps v3.1.1 published on Monday, May 20, 2024 by Pulumi

    Use this data source to access information about existing Projects within Azure DevOps.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = azuredevops.getProjects({
        name: "Example Project",
        state: "wellFormed",
    });
    export const projectId = example.then(example => example.projects.map(__item => __item.projectId));
    export const name = example.then(example => example.projects.map(__item => __item.name));
    export const projectUrl = example.then(example => example.projects.map(__item => __item.projectUrl));
    export const state = example.then(example => example.projects.map(__item => __item.state));
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.get_projects(name="Example Project",
        state="wellFormed")
    pulumi.export("projectId", [__item.project_id for __item in example.projects])
    pulumi.export("name", [__item.name for __item in example.projects])
    pulumi.export("projectUrl", [__item.project_url for __item in example.projects])
    pulumi.export("state", [__item.state for __item in example.projects])
    
    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 {
    		example, err := azuredevops.GetProjects(ctx, &azuredevops.GetProjectsArgs{
    			Name:  pulumi.StringRef("Example Project"),
    			State: pulumi.StringRef("wellFormed"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		var splat0 []*string
    		for _, val0 := range example.Projects {
    			splat0 = append(splat0, val0.ProjectId)
    		}
    		ctx.Export("projectId", splat0)
    		var splat1 []*string
    		for _, val0 := range example.Projects {
    			splat1 = append(splat1, val0.Name)
    		}
    		ctx.Export("name", splat1)
    		var splat2 []*string
    		for _, val0 := range example.Projects {
    			splat2 = append(splat2, val0.ProjectUrl)
    		}
    		ctx.Export("projectUrl", splat2)
    		var splat3 []*string
    		for _, val0 := range example.Projects {
    			splat3 = append(splat3, val0.State)
    		}
    		ctx.Export("state", splat3)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureDevOps = Pulumi.AzureDevOps;
    
    return await Deployment.RunAsync(() => 
    {
        var example = AzureDevOps.GetProjects.Invoke(new()
        {
            Name = "Example Project",
            State = "wellFormed",
        });
    
        return new Dictionary<string, object?>
        {
            ["projectId"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.ProjectId).ToList(),
            ["name"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.Name).ToList(),
            ["projectUrl"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.ProjectUrl).ToList(),
            ["state"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.State).ToList(),
        };
    });
    
    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.GetProjectsArgs;
    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 example = AzuredevopsFunctions.getProjects(GetProjectsArgs.builder()
                .name("Example Project")
                .state("wellFormed")
                .build());
    
            ctx.export("projectId", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.projectId()).collect(toList()));
            ctx.export("name", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.name()).collect(toList()));
            ctx.export("projectUrl", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.projectUrl()).collect(toList()));
            ctx.export("state", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.state()).collect(toList()));
        }
    }
    
    Coming soon!
    

    Using getProjects

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getProjects(args: GetProjectsArgs, opts?: InvokeOptions): Promise<GetProjectsResult>
    function getProjectsOutput(args: GetProjectsOutputArgs, opts?: InvokeOptions): Output<GetProjectsResult>
    def get_projects(name: Optional[str] = None,
                     state: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetProjectsResult
    def get_projects_output(name: Optional[pulumi.Input[str]] = None,
                     state: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetProjectsResult]
    func GetProjects(ctx *Context, args *GetProjectsArgs, opts ...InvokeOption) (*GetProjectsResult, error)
    func GetProjectsOutput(ctx *Context, args *GetProjectsOutputArgs, opts ...InvokeOption) GetProjectsResultOutput

    > Note: This function is named GetProjects in the Go SDK.

    public static class GetProjects 
    {
        public static Task<GetProjectsResult> InvokeAsync(GetProjectsArgs args, InvokeOptions? opts = null)
        public static Output<GetProjectsResult> Invoke(GetProjectsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetProjectsResult> getProjects(GetProjectsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azuredevops:index/getProjects:getProjects
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the Project, if not specified all projects will be returned.
    State string

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    Name string
    Name of the Project, if not specified all projects will be returned.
    State string

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name String
    Name of the Project, if not specified all projects will be returned.
    state String

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name string
    Name of the Project, if not specified all projects will be returned.
    state string

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name str
    Name of the Project, if not specified all projects will be returned.
    state str

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name String
    Name of the Project, if not specified all projects will be returned.
    state String

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    getProjects Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Projects List<Pulumi.AzureDevOps.Outputs.GetProjectsProject>
    A list of existing projects in your Azure DevOps Organization with details about every project which includes:
    Name string
    The name of the Project.
    State string
    Project state.
    Id string
    The provider-assigned unique ID for this managed resource.
    Projects []GetProjectsProject
    A list of existing projects in your Azure DevOps Organization with details about every project which includes:
    Name string
    The name of the Project.
    State string
    Project state.
    id String
    The provider-assigned unique ID for this managed resource.
    projects List<GetProjectsProject>
    A list of existing projects in your Azure DevOps Organization with details about every project which includes:
    name String
    The name of the Project.
    state String
    Project state.
    id string
    The provider-assigned unique ID for this managed resource.
    projects GetProjectsProject[]
    A list of existing projects in your Azure DevOps Organization with details about every project which includes:
    name string
    The name of the Project.
    state string
    Project state.
    id str
    The provider-assigned unique ID for this managed resource.
    projects Sequence[GetProjectsProject]
    A list of existing projects in your Azure DevOps Organization with details about every project which includes:
    name str
    The name of the Project.
    state str
    Project state.
    id String
    The provider-assigned unique ID for this managed resource.
    projects List<Property Map>
    A list of existing projects in your Azure DevOps Organization with details about every project which includes:
    name String
    The name of the Project.
    state String
    Project state.

    Supporting Types

    GetProjectsProject

    Name string
    Name of the Project, if not specified all projects will be returned.
    ProjectId string
    The ID of the Project.
    ProjectUrl string
    Url to the full version of the object.
    State string

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    Name string
    Name of the Project, if not specified all projects will be returned.
    ProjectId string
    The ID of the Project.
    ProjectUrl string
    Url to the full version of the object.
    State string

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name String
    Name of the Project, if not specified all projects will be returned.
    projectId String
    The ID of the Project.
    projectUrl String
    Url to the full version of the object.
    state String

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name string
    Name of the Project, if not specified all projects will be returned.
    projectId string
    The ID of the Project.
    projectUrl string
    Url to the full version of the object.
    state string

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name str
    Name of the Project, if not specified all projects will be returned.
    project_id str
    The ID of the Project.
    project_url str
    Url to the full version of the object.
    state str

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    name String
    Name of the Project, if not specified all projects will be returned.
    projectId String
    The ID of the Project.
    projectUrl String
    Url to the full version of the object.
    state String

    State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

    DataSource without specifying any arguments will return all projects.

    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.1.1 published on Monday, May 20, 2024 by Pulumi