1. Packages
  2. DigitalOcean
  3. API Docs
  4. getSpacesBuckets
DigitalOcean v4.27.0 published on Wednesday, Mar 13, 2024 by Pulumi

digitalocean.getSpacesBuckets

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.27.0 published on Wednesday, Mar 13, 2024 by Pulumi

    Get information on Spaces buckets for use in other resources, with the ability to filter and sort the results. If no filters are specified, all Spaces buckets will be returned.

    Note: You can use the digitalocean.SpacesBucket data source to obtain metadata about a single bucket if you already know its name and region.

    Example Usage

    Use the filter block with a key string and values list to filter buckets.

    Get all buckets in a region:

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const nyc3 = digitalocean.getSpacesBuckets({
        filters: [{
            key: "region",
            values: ["nyc3"],
        }],
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    nyc3 = digitalocean.get_spaces_buckets(filters=[digitalocean.GetSpacesBucketsFilterArgs(
        key="region",
        values=["nyc3"],
    )])
    
    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 {
    		_, err := digitalocean.GetSpacesBuckets(ctx, &digitalocean.GetSpacesBucketsArgs{
    			Filters: []digitalocean.GetSpacesBucketsFilter{
    				{
    					Key: "region",
    					Values: []string{
    						"nyc3",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var nyc3 = DigitalOcean.GetSpacesBuckets.Invoke(new()
        {
            Filters = new[]
            {
                new DigitalOcean.Inputs.GetSpacesBucketsFilterInputArgs
                {
                    Key = "region",
                    Values = new[]
                    {
                        "nyc3",
                    },
                },
            },
        });
    
    });
    
    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.GetSpacesBucketsArgs;
    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 nyc3 = DigitaloceanFunctions.getSpacesBuckets(GetSpacesBucketsArgs.builder()
                .filters(GetSpacesBucketsFilterArgs.builder()
                    .key("region")
                    .values("nyc3")
                    .build())
                .build());
    
        }
    }
    
    variables:
      nyc3:
        fn::invoke:
          Function: digitalocean:getSpacesBuckets
          Arguments:
            filters:
              - key: region
                values:
                  - nyc3
    

    You can sort the results as well:

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const nyc3 = digitalocean.getSpacesBuckets({
        filters: [{
            key: "region",
            values: ["nyc3"],
        }],
        sorts: [{
            direction: "desc",
            key: "name",
        }],
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    nyc3 = digitalocean.get_spaces_buckets(filters=[digitalocean.GetSpacesBucketsFilterArgs(
            key="region",
            values=["nyc3"],
        )],
        sorts=[digitalocean.GetSpacesBucketsSortArgs(
            direction="desc",
            key="name",
        )])
    
    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 {
    		_, err := digitalocean.GetSpacesBuckets(ctx, &digitalocean.GetSpacesBucketsArgs{
    			Filters: []digitalocean.GetSpacesBucketsFilter{
    				{
    					Key: "region",
    					Values: []string{
    						"nyc3",
    					},
    				},
    			},
    			Sorts: []digitalocean.GetSpacesBucketsSort{
    				{
    					Direction: pulumi.StringRef("desc"),
    					Key:       "name",
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var nyc3 = DigitalOcean.GetSpacesBuckets.Invoke(new()
        {
            Filters = new[]
            {
                new DigitalOcean.Inputs.GetSpacesBucketsFilterInputArgs
                {
                    Key = "region",
                    Values = new[]
                    {
                        "nyc3",
                    },
                },
            },
            Sorts = new[]
            {
                new DigitalOcean.Inputs.GetSpacesBucketsSortInputArgs
                {
                    Direction = "desc",
                    Key = "name",
                },
            },
        });
    
    });
    
    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.GetSpacesBucketsArgs;
    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 nyc3 = DigitaloceanFunctions.getSpacesBuckets(GetSpacesBucketsArgs.builder()
                .filters(GetSpacesBucketsFilterArgs.builder()
                    .key("region")
                    .values("nyc3")
                    .build())
                .sorts(GetSpacesBucketsSortArgs.builder()
                    .direction("desc")
                    .key("name")
                    .build())
                .build());
    
        }
    }
    
    variables:
      nyc3:
        fn::invoke:
          Function: digitalocean:getSpacesBuckets
          Arguments:
            filters:
              - key: region
                values:
                  - nyc3
            sorts:
              - direction: desc
                key: name
    

    Using getSpacesBuckets

    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 getSpacesBuckets(args: GetSpacesBucketsArgs, opts?: InvokeOptions): Promise<GetSpacesBucketsResult>
    function getSpacesBucketsOutput(args: GetSpacesBucketsOutputArgs, opts?: InvokeOptions): Output<GetSpacesBucketsResult>
    def get_spaces_buckets(filters: Optional[Sequence[GetSpacesBucketsFilter]] = None,
                           sorts: Optional[Sequence[GetSpacesBucketsSort]] = None,
                           opts: Optional[InvokeOptions] = None) -> GetSpacesBucketsResult
    def get_spaces_buckets_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSpacesBucketsFilterArgs]]]] = None,
                           sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetSpacesBucketsSortArgs]]]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetSpacesBucketsResult]
    func GetSpacesBuckets(ctx *Context, args *GetSpacesBucketsArgs, opts ...InvokeOption) (*GetSpacesBucketsResult, error)
    func GetSpacesBucketsOutput(ctx *Context, args *GetSpacesBucketsOutputArgs, opts ...InvokeOption) GetSpacesBucketsResultOutput

    > Note: This function is named GetSpacesBuckets in the Go SDK.

    public static class GetSpacesBuckets 
    {
        public static Task<GetSpacesBucketsResult> InvokeAsync(GetSpacesBucketsArgs args, InvokeOptions? opts = null)
        public static Output<GetSpacesBucketsResult> Invoke(GetSpacesBucketsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSpacesBucketsResult> getSpacesBuckets(GetSpacesBucketsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: digitalocean:index/getSpacesBuckets:getSpacesBuckets
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<Pulumi.DigitalOcean.Inputs.GetSpacesBucketsFilter>
    Filter the results. The filter block is documented below.
    Sorts List<Pulumi.DigitalOcean.Inputs.GetSpacesBucketsSort>
    Sort the results. The sort block is documented below.
    Filters []GetSpacesBucketsFilter
    Filter the results. The filter block is documented below.
    Sorts []GetSpacesBucketsSort
    Sort the results. The sort block is documented below.
    filters List<GetSpacesBucketsFilter>
    Filter the results. The filter block is documented below.
    sorts List<GetSpacesBucketsSort>
    Sort the results. The sort block is documented below.
    filters GetSpacesBucketsFilter[]
    Filter the results. The filter block is documented below.
    sorts GetSpacesBucketsSort[]
    Sort the results. The sort block is documented below.
    filters Sequence[GetSpacesBucketsFilter]
    Filter the results. The filter block is documented below.
    sorts Sequence[GetSpacesBucketsSort]
    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.

    getSpacesBuckets Result

    The following output properties are available:

    Buckets List<Pulumi.DigitalOcean.Outputs.GetSpacesBucketsBucket>
    A list of Spaces buckets satisfying any filter and sort criteria. Each bucket has the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Filters List<Pulumi.DigitalOcean.Outputs.GetSpacesBucketsFilter>
    Sorts List<Pulumi.DigitalOcean.Outputs.GetSpacesBucketsSort>
    Buckets []GetSpacesBucketsBucket
    A list of Spaces buckets satisfying any filter and sort criteria. Each bucket has the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Filters []GetSpacesBucketsFilter
    Sorts []GetSpacesBucketsSort
    buckets List<GetSpacesBucketsBucket>
    A list of Spaces buckets satisfying any filter and sort criteria. Each bucket has the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    filters List<GetSpacesBucketsFilter>
    sorts List<GetSpacesBucketsSort>
    buckets GetSpacesBucketsBucket[]
    A list of Spaces buckets satisfying any filter and sort criteria. Each bucket has the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    filters GetSpacesBucketsFilter[]
    sorts GetSpacesBucketsSort[]
    buckets Sequence[GetSpacesBucketsBucket]
    A list of Spaces buckets satisfying any filter and sort criteria. Each bucket has the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    filters Sequence[GetSpacesBucketsFilter]
    sorts Sequence[GetSpacesBucketsSort]
    buckets List<Property Map>
    A list of Spaces buckets satisfying any filter and sort criteria. Each bucket has the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    filters List<Property Map>
    sorts List<Property Map>

    Supporting Types

    GetSpacesBucketsBucket

    BucketDomainName string
    The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
    Endpoint string
    The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)
    Name string
    The name of the Spaces bucket
    Region string
    The slug of the region where the bucket is stored.
    Urn string
    The uniform resource name of the bucket
    BucketDomainName string
    The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
    Endpoint string
    The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)
    Name string
    The name of the Spaces bucket
    Region string
    The slug of the region where the bucket is stored.
    Urn string
    The uniform resource name of the bucket
    bucketDomainName String
    The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
    endpoint String
    The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)
    name String
    The name of the Spaces bucket
    region String
    The slug of the region where the bucket is stored.
    urn String
    The uniform resource name of the bucket
    bucketDomainName string
    The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
    endpoint string
    The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)
    name string
    The name of the Spaces bucket
    region string
    The slug of the region where the bucket is stored.
    urn string
    The uniform resource name of the bucket
    bucket_domain_name str
    The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
    endpoint str
    The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)
    name str
    The name of the Spaces bucket
    region str
    The slug of the region where the bucket is stored.
    urn str
    The uniform resource name of the bucket
    bucketDomainName String
    The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
    endpoint String
    The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)
    name String
    The name of the Spaces bucket
    region String
    The slug of the region where the bucket is stored.
    urn String
    The uniform resource name of the bucket

    GetSpacesBucketsFilter

    Key string
    Filter the images by this key. This may be one of bucket_domain_name, name, region, or urn.
    Values List<string>
    A list of values to match against the key field. Only retrieves Spaces buckets where the key field takes on one or more 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 images by this key. This may be one of bucket_domain_name, name, region, or urn.
    Values []string
    A list of values to match against the key field. Only retrieves Spaces buckets where the key field takes on one or more 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 images by this key. This may be one of bucket_domain_name, name, region, or urn.
    values List<String>
    A list of values to match against the key field. Only retrieves Spaces buckets where the key field takes on one or more 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 images by this key. This may be one of bucket_domain_name, name, region, or urn.
    values string[]
    A list of values to match against the key field. Only retrieves Spaces buckets where the key field takes on one or more 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 images by this key. This may be one of bucket_domain_name, name, region, or urn.
    values Sequence[str]
    A list of values to match against the key field. Only retrieves Spaces buckets where the key field takes on one or more 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 images by this key. This may be one of bucket_domain_name, name, region, or urn.
    values List<String>
    A list of values to match against the key field. Only retrieves Spaces buckets where the key field takes on one or more 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.

    GetSpacesBucketsSort

    Key string
    Sort the images by this key. This may be one of bucket_domain_name, name, region, or urn.
    Direction string
    The sort direction. This may be either asc or desc.
    Key string
    Sort the images by this key. This may be one of bucket_domain_name, name, region, or urn.
    Direction string
    The sort direction. This may be either asc or desc.
    key String
    Sort the images by this key. This may be one of bucket_domain_name, name, region, or urn.
    direction String
    The sort direction. This may be either asc or desc.
    key string
    Sort the images by this key. This may be one of bucket_domain_name, name, region, or urn.
    direction string
    The sort direction. This may be either asc or desc.
    key str
    Sort the images by this key. This may be one of bucket_domain_name, name, region, or urn.
    direction str
    The sort direction. This may be either asc or desc.
    key String
    Sort the images by this key. This may be one of bucket_domain_name, name, region, or urn.
    direction String
    The sort direction. This may be either asc or desc.

    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.27.0 published on Wednesday, Mar 13, 2024 by Pulumi