getProjects

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.

Example Usage

Use the filter block with a key string and values list to filter projects. For example to find all staging environment projects:

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.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 staging = DigitaloceanFunctions.getProjects(GetProjectsArgs.builder()
.filters(GetProjectsFilterArgs.builder()
.key("environment")
.values("Staging")
.build())
.build());
}
}

Return

A collection of values returned by getProjects.

Parameters

argument

A collection of arguments for invoking getProjects.


suspend fun getProjects(filters: List<GetProjectsFilter>? = null, sorts: List<GetProjectsSort>? = null): GetProjectsResult

Return

A collection of values returned by getProjects.

See also

Parameters

filters

Filter the results. The filter block is documented below.

sorts

Sort the results. The sort block is documented below.


suspend fun getProjects(argument: suspend GetProjectsPlainArgsBuilder.() -> Unit): GetProjectsResult

Return

A collection of values returned by getProjects.

See also

Parameters

argument

Builder for com.pulumi.digitalocean.kotlin.inputs.GetProjectsPlainArgs.