DigitalOcean v4.36.0 published on Wednesday, Dec 4, 2024 by Pulumi
digitalocean.getTags
Explore with Pulumi AI
Returns a list of tags in your DigitalOcean account, with the ability to filter and sort the results. If no filters are specified, all tags will be returned.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const list = digitalocean.getTags({
sorts: [{
key: "total_resource_count",
direction: "asc",
}],
});
export const sortedTags = list.then(list => list.tags);
import pulumi
import pulumi_digitalocean as digitalocean
list = digitalocean.get_tags(sorts=[{
"key": "total_resource_count",
"direction": "asc",
}])
pulumi.export("sortedTags", list.tags)
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
list, err := digitalocean.GetTags(ctx, &digitalocean.GetTagsArgs{
Sorts: []digitalocean.GetTagsSort{
{
Key: "total_resource_count",
Direction: pulumi.StringRef("asc"),
},
},
}, nil)
if err != nil {
return err
}
ctx.Export("sortedTags", list.Tags)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var list = DigitalOcean.GetTags.Invoke(new()
{
Sorts = new[]
{
new DigitalOcean.Inputs.GetTagsSortInputArgs
{
Key = "total_resource_count",
Direction = "asc",
},
},
});
return new Dictionary<string, object?>
{
["sortedTags"] = list.Apply(getTagsResult => getTagsResult.Tags),
};
});
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.GetTagsArgs;
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 list = DigitaloceanFunctions.getTags(GetTagsArgs.builder()
.sorts(GetTagsSortArgs.builder()
.key("total_resource_count")
.direction("asc")
.build())
.build());
ctx.export("sortedTags", list.applyValue(getTagsResult -> getTagsResult.tags()));
}
}
variables:
list:
fn::invoke:
Function: digitalocean:getTags
Arguments:
sorts:
- key: total_resource_count
direction: asc
outputs:
sortedTags: ${list.tags}
Using getTags
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 getTags(args: GetTagsArgs, opts?: InvokeOptions): Promise<GetTagsResult>
function getTagsOutput(args: GetTagsOutputArgs, opts?: InvokeOptions): Output<GetTagsResult>
def get_tags(filters: Optional[Sequence[GetTagsFilter]] = None,
sorts: Optional[Sequence[GetTagsSort]] = None,
opts: Optional[InvokeOptions] = None) -> GetTagsResult
def get_tags_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetTagsFilterArgs]]]] = None,
sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetTagsSortArgs]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetTagsResult]
func GetTags(ctx *Context, args *GetTagsArgs, opts ...InvokeOption) (*GetTagsResult, error)
func GetTagsOutput(ctx *Context, args *GetTagsOutputArgs, opts ...InvokeOption) GetTagsResultOutput
> Note: This function is named GetTags
in the Go SDK.
public static class GetTags
{
public static Task<GetTagsResult> InvokeAsync(GetTagsArgs args, InvokeOptions? opts = null)
public static Output<GetTagsResult> Invoke(GetTagsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetTagsResult> getTags(GetTagsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: digitalocean:index/getTags:getTags
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Pulumi.
Digital Ocean. Inputs. Get Tags Filter> - Filter the results.
The
filter
block is documented below. - Sorts
List<Pulumi.
Digital Ocean. Inputs. Get Tags Sort> - Sort the results.
The
sort
block is documented below.
- Filters
[]Get
Tags Filter - Filter the results.
The
filter
block is documented below. - Sorts
[]Get
Tags Sort - Sort the results.
The
sort
block is documented below.
- filters
List<Get
Tags Filter> - Filter the results.
The
filter
block is documented below. - sorts
List<Get
Tags Sort> - Sort the results.
The
sort
block is documented below.
- filters
Get
Tags Filter[] - Filter the results.
The
filter
block is documented below. - sorts
Get
Tags Sort[] - Sort the results.
The
sort
block is documented below.
- filters
Sequence[Get
Tags Filter] - Filter the results.
The
filter
block is documented below. - sorts
Sequence[Get
Tags Sort] - Sort the results.
The
sort
block is documented below.
- filters List<Property Map>
- Filter the results.
The
filter
block is documented below. - sorts List<Property Map>
- Sort the results.
The
sort
block is documented below.
getTags Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- List<Pulumi.
Digital Ocean. Outputs. Get Tags Tag> - Filters
List<Pulumi.
Digital Ocean. Outputs. Get Tags Filter> - Sorts
List<Pulumi.
Digital Ocean. Outputs. Get Tags Sort>
- Id string
- The provider-assigned unique ID for this managed resource.
- []Get
Tags Tag - Filters
[]Get
Tags Filter - Sorts
[]Get
Tags Sort
- id String
- The provider-assigned unique ID for this managed resource.
- List<Get
Tags Tag> - filters
List<Get
Tags Filter> - sorts
List<Get
Tags Sort>
- id string
- The provider-assigned unique ID for this managed resource.
- Get
Tags Tag[] - filters
Get
Tags Filter[] - sorts
Get
Tags Sort[]
- id str
- The provider-assigned unique ID for this managed resource.
- Sequence[Get
Tags Tag] - filters
Sequence[Get
Tags Filter] - sorts
Sequence[Get
Tags Sort]
- id String
- The provider-assigned unique ID for this managed resource.
- List<Property Map>
- filters List<Property Map>
- sorts List<Property Map>
Supporting Types
GetTagsFilter
- Key string
- Filter the tags by this key. This may be one of
name
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
. - Values List<string>
- Only retrieves tags which keys has value that matches one of the values provided here.
- All bool
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- Key string
- Filter the tags by this key. This may be one of
name
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
. - Values []string
- Only retrieves tags which keys has value that matches one of the values provided here.
- All bool
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key String
- Filter the tags by this key. This may be one of
name
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
. - values List<String>
- Only retrieves tags which keys has value that matches one of the values provided here.
- all Boolean
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key string
- Filter the tags by this key. This may be one of
name
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
. - values string[]
- Only retrieves tags which keys has value that matches one of the values provided here.
- all boolean
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key str
- Filter the tags by this key. This may be one of
name
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
. - values Sequence[str]
- Only retrieves tags which keys has value that matches one of the values provided here.
- all bool
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match_
by str - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key String
- Filter the tags by this key. This may be one of
name
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
. - values List<String>
- Only retrieves tags which keys has value that matches one of the values provided here.
- all Boolean
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
GetTagsSort
GetTagsTag
- Databases
Count int - A count of the database clusters that the tag is applied to.
- Droplets
Count int - A count of the Droplets the tag is applied to.
- Images
Count int - A count of the images that the tag is applied to.
- Name string
- The name of the tag.
- Total
Resource intCount - A count of the total number of resources that the tag is applied to.
- Volume
Snapshots intCount - A count of the volume snapshots that the tag is applied to.
- Volumes
Count int - A count of the volumes that the tag is applied to.
- Databases
Count int - A count of the database clusters that the tag is applied to.
- Droplets
Count int - A count of the Droplets the tag is applied to.
- Images
Count int - A count of the images that the tag is applied to.
- Name string
- The name of the tag.
- Total
Resource intCount - A count of the total number of resources that the tag is applied to.
- Volume
Snapshots intCount - A count of the volume snapshots that the tag is applied to.
- Volumes
Count int - A count of the volumes that the tag is applied to.
- databases
Count Integer - A count of the database clusters that the tag is applied to.
- droplets
Count Integer - A count of the Droplets the tag is applied to.
- images
Count Integer - A count of the images that the tag is applied to.
- name String
- The name of the tag.
- total
Resource IntegerCount - A count of the total number of resources that the tag is applied to.
- volume
Snapshots IntegerCount - A count of the volume snapshots that the tag is applied to.
- volumes
Count Integer - A count of the volumes that the tag is applied to.
- databases
Count number - A count of the database clusters that the tag is applied to.
- droplets
Count number - A count of the Droplets the tag is applied to.
- images
Count number - A count of the images that the tag is applied to.
- name string
- The name of the tag.
- total
Resource numberCount - A count of the total number of resources that the tag is applied to.
- volume
Snapshots numberCount - A count of the volume snapshots that the tag is applied to.
- volumes
Count number - A count of the volumes that the tag is applied to.
- databases_
count int - A count of the database clusters that the tag is applied to.
- droplets_
count int - A count of the Droplets the tag is applied to.
- images_
count int - A count of the images that the tag is applied to.
- name str
- The name of the tag.
- total_
resource_ intcount - A count of the total number of resources that the tag is applied to.
- volume_
snapshots_ intcount - A count of the volume snapshots that the tag is applied to.
- volumes_
count int - A count of the volumes that the tag is applied to.
- databases
Count Number - A count of the database clusters that the tag is applied to.
- droplets
Count Number - A count of the Droplets the tag is applied to.
- images
Count Number - A count of the images that the tag is applied to.
- name String
- The name of the tag.
- total
Resource NumberCount - A count of the total number of resources that the tag is applied to.
- volume
Snapshots NumberCount - A count of the volume snapshots that the tag is applied to.
- volumes
Count Number - A count of the volumes that the tag is applied to.
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.