1. Packages
  2. DigitalOcean
  3. API Docs
  4. getTags
DigitalOcean v4.22.0 published on Friday, Sep 22, 2023 by Pulumi

digitalocean.getTags

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.22.0 published on Friday, Sep 22, 2023 by Pulumi

    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

    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 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
    	})
    }
    
    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()));
        }
    }
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    list = digitalocean.get_tags(sorts=[digitalocean.GetTagsSortArgs(
        key="total_resource_count",
        direction="asc",
    )])
    pulumi.export("sortedTags", list.tags)
    
    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);
    
    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.DigitalOcean.Inputs.GetTagsFilter>

    Filter the results. The filter block is documented below.

    Sorts List<Pulumi.DigitalOcean.Inputs.GetTagsSort>

    Sort the results. The sort block is documented below.

    Filters []GetTagsFilter

    Filter the results. The filter block is documented below.

    Sorts []GetTagsSort

    Sort the results. The sort block is documented below.

    filters List<GetTagsFilter>

    Filter the results. The filter block is documented below.

    sorts List<GetTagsSort>

    Sort the results. The sort block is documented below.

    filters GetTagsFilter[]

    Filter the results. The filter block is documented below.

    sorts GetTagsSort[]

    Sort the results. The sort block is documented below.

    filters Sequence[GetTagsFilter]

    Filter the results. The filter block is documented below.

    sorts Sequence[GetTagsSort]

    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.

    Tags []GetTagsTag
    Filters []GetTagsFilter
    Sorts []GetTagsSort
    id String

    The provider-assigned unique ID for this managed resource.

    tags List<GetTagsTag>
    filters List<GetTagsFilter>
    sorts List<GetTagsSort>
    id string

    The provider-assigned unique ID for this managed resource.

    tags GetTagsTag[]
    filters GetTagsFilter[]
    sorts GetTagsSort[]
    id str

    The provider-assigned unique ID for this managed resource.

    tags Sequence[GetTagsTag]
    filters Sequence[GetTagsFilter]
    sorts Sequence[GetTagsSort]
    id String

    The provider-assigned unique ID for this managed resource.

    tags 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, or databases_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 the values 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 the values are present in the list or set.

    MatchBy string

    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values 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, or databases_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 the values 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 the values are present in the list or set.

    MatchBy string

    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values 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, or databases_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 the values 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 the values are present in the list or set.

    matchBy String

    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values 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, or databases_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 the values 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 the values are present in the list or set.

    matchBy string

    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values 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, or databases_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 the values 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 the values are present in the list or set.

    match_by str

    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values 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, or databases_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 the values 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 the values are present in the list or set.

    matchBy String

    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

    GetTagsSort

    Key string

    Sort the tags by this key. This may be one of name, total_resource_count, droplets_count, images_count, volumes_count, volume_snapshots_count, or databases_count.

    Direction string

    The sort direction. This may be either asc or desc.

    Key string

    Sort the tags by this key. This may be one of name, total_resource_count, droplets_count, images_count, volumes_count, volume_snapshots_count, or databases_count.

    Direction string

    The sort direction. This may be either asc or desc.

    key String

    Sort the tags by this key. This may be one of name, total_resource_count, droplets_count, images_count, volumes_count, volume_snapshots_count, or databases_count.

    direction String

    The sort direction. This may be either asc or desc.

    key string

    Sort the tags by this key. This may be one of name, total_resource_count, droplets_count, images_count, volumes_count, volume_snapshots_count, or databases_count.

    direction string

    The sort direction. This may be either asc or desc.

    key str

    Sort the tags by this key. This may be one of name, total_resource_count, droplets_count, images_count, volumes_count, volume_snapshots_count, or databases_count.

    direction str

    The sort direction. This may be either asc or desc.

    key String

    Sort the tags by this key. This may be one of name, total_resource_count, droplets_count, images_count, volumes_count, volume_snapshots_count, or databases_count.

    direction String

    The sort direction. This may be either asc or desc.

    GetTagsTag

    DatabasesCount int

    A count of the database clusters that the tag is applied to.

    DropletsCount int

    A count of the Droplets the tag is applied to.

    ImagesCount int

    A count of the images that the tag is applied to.

    Name string

    The name of the tag.

    TotalResourceCount int

    A count of the total number of resources that the tag is applied to.

    VolumeSnapshotsCount int

    A count of the volume snapshots that the tag is applied to.

    VolumesCount int

    A count of the volumes that the tag is applied to.

    DatabasesCount int

    A count of the database clusters that the tag is applied to.

    DropletsCount int

    A count of the Droplets the tag is applied to.

    ImagesCount int

    A count of the images that the tag is applied to.

    Name string

    The name of the tag.

    TotalResourceCount int

    A count of the total number of resources that the tag is applied to.

    VolumeSnapshotsCount int

    A count of the volume snapshots that the tag is applied to.

    VolumesCount int

    A count of the volumes that the tag is applied to.

    databasesCount Integer

    A count of the database clusters that the tag is applied to.

    dropletsCount Integer

    A count of the Droplets the tag is applied to.

    imagesCount Integer

    A count of the images that the tag is applied to.

    name String

    The name of the tag.

    totalResourceCount Integer

    A count of the total number of resources that the tag is applied to.

    volumeSnapshotsCount Integer

    A count of the volume snapshots that the tag is applied to.

    volumesCount Integer

    A count of the volumes that the tag is applied to.

    databasesCount number

    A count of the database clusters that the tag is applied to.

    dropletsCount number

    A count of the Droplets the tag is applied to.

    imagesCount number

    A count of the images that the tag is applied to.

    name string

    The name of the tag.

    totalResourceCount number

    A count of the total number of resources that the tag is applied to.

    volumeSnapshotsCount number

    A count of the volume snapshots that the tag is applied to.

    volumesCount 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_count int

    A count of the total number of resources that the tag is applied to.

    volume_snapshots_count int

    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.

    databasesCount Number

    A count of the database clusters that the tag is applied to.

    dropletsCount Number

    A count of the Droplets the tag is applied to.

    imagesCount Number

    A count of the images that the tag is applied to.

    name String

    The name of the tag.

    totalResourceCount Number

    A count of the total number of resources that the tag is applied to.

    volumeSnapshotsCount Number

    A count of the volume snapshots that the tag is applied to.

    volumesCount 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.

    digitalocean logo
    DigitalOcean v4.22.0 published on Friday, Sep 22, 2023 by Pulumi