@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
170 lines (169 loc) • 5.19 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Get information on Droplets for use in other resources, with the ability to filter and sort the results.
* If no filters are specified, all Droplets will be returned.
*
* This data source is useful if the Droplets in question are not managed by the provider or you need to
* utilize any of the Droplets' data.
*
* By default, only non-GPU Droplets are returned. To list only GPU Droplets, set
* the `gpus` attribute to `true`.
*
* Note: You can use the `digitalocean.Droplet` data source to obtain metadata
* about a single Droplet if you already know the `id`, unique `name`, or unique `tag` to retrieve.
*
* ## Example Usage
*
* Use the `filter` block with a `key` string and `values` list to filter images.
*
* For example to find all Droplets with size `s-1vcpu-1gb`:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const small = digitalocean.getDroplets({
* filters: [{
* key: "size",
* values: ["s-1vcpu-1gb"],
* }],
* });
* ```
*
* You can filter on multiple fields and sort the results as well:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const small_with_backups = digitalocean.getDroplets({
* filters: [
* {
* key: "size",
* values: ["s-1vcpu-1gb"],
* },
* {
* key: "backups",
* values: ["true"],
* },
* ],
* sorts: [{
* key: "created_at",
* direction: "desc",
* }],
* });
* ```
*/
export declare function getDroplets(args?: GetDropletsArgs, opts?: pulumi.InvokeOptions): Promise<GetDropletsResult>;
/**
* A collection of arguments for invoking getDroplets.
*/
export interface GetDropletsArgs {
/**
* Filter the results.
* The `filter` block is documented below.
*/
filters?: inputs.GetDropletsFilter[];
/**
* A boolean value specifying whether or not to list GPU Droplets
*/
gpus?: boolean;
/**
* Sort the results.
* The `sort` block is documented below.
*/
sorts?: inputs.GetDropletsSort[];
}
/**
* A collection of values returned by getDroplets.
*/
export interface GetDropletsResult {
/**
* A list of Droplets satisfying any `filter` and `sort` criteria. Each Droplet has the following attributes:
*/
readonly droplets: outputs.GetDropletsDroplet[];
readonly filters?: outputs.GetDropletsFilter[];
readonly gpus?: boolean;
/**
* The provider-assigned unique ID for this managed resource.
*/
readonly id: string;
readonly sorts?: outputs.GetDropletsSort[];
}
/**
* Get information on Droplets for use in other resources, with the ability to filter and sort the results.
* If no filters are specified, all Droplets will be returned.
*
* This data source is useful if the Droplets in question are not managed by the provider or you need to
* utilize any of the Droplets' data.
*
* By default, only non-GPU Droplets are returned. To list only GPU Droplets, set
* the `gpus` attribute to `true`.
*
* Note: You can use the `digitalocean.Droplet` data source to obtain metadata
* about a single Droplet if you already know the `id`, unique `name`, or unique `tag` to retrieve.
*
* ## Example Usage
*
* Use the `filter` block with a `key` string and `values` list to filter images.
*
* For example to find all Droplets with size `s-1vcpu-1gb`:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const small = digitalocean.getDroplets({
* filters: [{
* key: "size",
* values: ["s-1vcpu-1gb"],
* }],
* });
* ```
*
* You can filter on multiple fields and sort the results as well:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const small_with_backups = digitalocean.getDroplets({
* filters: [
* {
* key: "size",
* values: ["s-1vcpu-1gb"],
* },
* {
* key: "backups",
* values: ["true"],
* },
* ],
* sorts: [{
* key: "created_at",
* direction: "desc",
* }],
* });
* ```
*/
export declare function getDropletsOutput(args?: GetDropletsOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetDropletsResult>;
/**
* A collection of arguments for invoking getDroplets.
*/
export interface GetDropletsOutputArgs {
/**
* Filter the results.
* The `filter` block is documented below.
*/
filters?: pulumi.Input<pulumi.Input<inputs.GetDropletsFilterArgs>[]>;
/**
* A boolean value specifying whether or not to list GPU Droplets
*/
gpus?: pulumi.Input<boolean>;
/**
* Sort the results.
* The `sort` block is documented below.
*/
sorts?: pulumi.Input<pulumi.Input<inputs.GetDropletsSortArgs>[]>;
}