// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.AliCloud.Oss
{
    public static class GetBuckets
    {
        /// <summary>
        /// This data source provides the OSS buckets of the current Alibaba Cloud user.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var ossBucketsDs = AliCloud.Oss.GetBuckets.Invoke(new()
        ///     {
        ///         NameRegex = "sample_oss_bucket",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstOssBucketName"] = ossBucketsDs.Apply(getBucketsResult =&gt; getBucketsResult.Buckets[0]?.Name),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetBucketsResult> InvokeAsync(GetBucketsArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetBucketsResult>("alicloud:oss/getBuckets:getBuckets", args ?? new GetBucketsArgs(), options.WithDefaults());

        /// <summary>
        /// This data source provides the OSS buckets of the current Alibaba Cloud user.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var ossBucketsDs = AliCloud.Oss.GetBuckets.Invoke(new()
        ///     {
        ///         NameRegex = "sample_oss_bucket",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstOssBucketName"] = ossBucketsDs.Apply(getBucketsResult =&gt; getBucketsResult.Buckets[0]?.Name),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetBucketsResult> Invoke(GetBucketsInvokeArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetBucketsResult>("alicloud:oss/getBuckets:getBuckets", args ?? new GetBucketsInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetBucketsArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// A regex string to filter results by bucket name.
        /// </summary>
        [Input("nameRegex")]
        public string? NameRegex { get; set; }

        [Input("outputFile")]
        public string? OutputFile { get; set; }

        public GetBucketsArgs()
        {
        }
        public static new GetBucketsArgs Empty => new GetBucketsArgs();
    }

    public sealed class GetBucketsInvokeArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// A regex string to filter results by bucket name.
        /// </summary>
        [Input("nameRegex")]
        public Input<string>? NameRegex { get; set; }

        [Input("outputFile")]
        public Input<string>? OutputFile { get; set; }

        public GetBucketsInvokeArgs()
        {
        }
        public static new GetBucketsInvokeArgs Empty => new GetBucketsInvokeArgs();
    }


    [OutputType]
    public sealed class GetBucketsResult
    {
        /// <summary>
        /// A list of buckets. Each element contains the following attributes:
        /// </summary>
        public readonly ImmutableArray<Outputs.GetBucketsBucketResult> Buckets;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        public readonly string? NameRegex;
        /// <summary>
        /// A list of bucket names.
        /// </summary>
        public readonly ImmutableArray<string> Names;
        public readonly string? OutputFile;

        [OutputConstructor]
        private GetBucketsResult(
            ImmutableArray<Outputs.GetBucketsBucketResult> buckets,

            string id,

            string? nameRegex,

            ImmutableArray<string> names,

            string? outputFile)
        {
            Buckets = buckets;
            Id = id;
            NameRegex = nameRegex;
            Names = names;
            OutputFile = outputFile;
        }
    }
}
