Class GetProjects
Inheritance
System.Object
GetProjects
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.DigitalOcean
Assembly: Pulumi.DigitalOcean.dll
Syntax
public static class GetProjects
Methods
View SourceInvokeAsync(GetProjectsArgs, InvokeOptions)
Retrieve information about all DigitalOcean projects associated with an account, with the ability to filter and sort the results. If no filters are specified, all projects will be returned.
Note: You can use the digitalocean..Project data source to
obtain metadata about a single project if you already know the id to retrieve or the unique
name of the project.
{{% examples %}}
Example Usage
{{% example %}}
Use the filter block with a key string and values list to filter projects.
For example to find all staging environment projects:
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
class MyStack : Stack
{
public MyStack()
{
var staging = Output.Create(DigitalOcean.GetProjects.InvokeAsync(new DigitalOcean.GetProjectsArgs
{
Filters =
{
new DigitalOcean.Inputs.GetProjectsFilterArgs
{
Key = "environment",
Values =
{
"Staging",
},
},
},
}));
}
}
You can filter on multiple fields and sort the results as well:
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
class MyStack : Stack
{
public MyStack()
{
var non_default_production = Output.Create(DigitalOcean.GetProjects.InvokeAsync(new DigitalOcean.GetProjectsArgs
{
Filters =
{
new DigitalOcean.Inputs.GetProjectsFilterArgs
{
Key = "environment",
Values =
{
"Production",
},
},
new DigitalOcean.Inputs.GetProjectsFilterArgs
{
Key = "is_default",
Values =
{
"false",
},
},
},
Sorts =
{
new DigitalOcean.Inputs.GetProjectsSortArgs
{
Direction = "asc",
Key = "name",
},
},
}));
}
}
{{% /example %}} {{% /examples %}}
Declaration
public static Task<GetProjectsResult> InvokeAsync(GetProjectsArgs args = null, InvokeOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetProjectsArgs | args | |
| InvokeOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<GetProjectsResult> |