1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. resourcemanager
  5. getFolders
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.resourcemanager.getFolders

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    This data source provides the resource manager folders of the current Alibaba Cloud user.

    NOTE: Available in 1.84.0+.

    NOTE: You can view only the information of the first-level child folders of the specified folder.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const example = alicloud.resourcemanager.getFolders({
        nameRegex: "tftest",
    });
    export const firstFolderId = example.then(example => example.folders?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    example = alicloud.resourcemanager.get_folders(name_regex="tftest")
    pulumi.export("firstFolderId", example.folders[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := resourcemanager.GetFolders(ctx, &resourcemanager.GetFoldersArgs{
    			NameRegex: pulumi.StringRef("tftest"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstFolderId", example.Folders[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = AliCloud.ResourceManager.GetFolders.Invoke(new()
        {
            NameRegex = "tftest",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstFolderId"] = example.Apply(getFoldersResult => getFoldersResult.Folders[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
    import com.pulumi.alicloud.resourcemanager.inputs.GetFoldersArgs;
    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 example = ResourcemanagerFunctions.getFolders(GetFoldersArgs.builder()
                .nameRegex("tftest")
                .build());
    
            ctx.export("firstFolderId", example.applyValue(getFoldersResult -> getFoldersResult.folders()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: alicloud:resourcemanager:getFolders
          Arguments:
            nameRegex: tftest
    outputs:
      firstFolderId: ${example.folders[0].id}
    

    Using getFolders

    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 getFolders(args: GetFoldersArgs, opts?: InvokeOptions): Promise<GetFoldersResult>
    function getFoldersOutput(args: GetFoldersOutputArgs, opts?: InvokeOptions): Output<GetFoldersResult>
    def get_folders(enable_details: Optional[bool] = None,
                    ids: Optional[Sequence[str]] = None,
                    name_regex: Optional[str] = None,
                    output_file: Optional[str] = None,
                    parent_folder_id: Optional[str] = None,
                    query_keyword: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetFoldersResult
    def get_folders_output(enable_details: Optional[pulumi.Input[bool]] = None,
                    ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    name_regex: Optional[pulumi.Input[str]] = None,
                    output_file: Optional[pulumi.Input[str]] = None,
                    parent_folder_id: Optional[pulumi.Input[str]] = None,
                    query_keyword: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetFoldersResult]
    func GetFolders(ctx *Context, args *GetFoldersArgs, opts ...InvokeOption) (*GetFoldersResult, error)
    func GetFoldersOutput(ctx *Context, args *GetFoldersOutputArgs, opts ...InvokeOption) GetFoldersResultOutput

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

    public static class GetFolders 
    {
        public static Task<GetFoldersResult> InvokeAsync(GetFoldersArgs args, InvokeOptions? opts = null)
        public static Output<GetFoldersResult> Invoke(GetFoldersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetFoldersResult> getFolders(GetFoldersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:resourcemanager/getFolders:getFolders
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnableDetails bool
    Default to false. Set it to true can output more details.
    Ids List<string>
    A list of resource manager folders IDs.
    NameRegex string
    A regex string to filter results by folder name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ParentFolderId string
    The ID of the parent folder.
    QueryKeyword string
    The query keyword.
    EnableDetails bool
    Default to false. Set it to true can output more details.
    Ids []string
    A list of resource manager folders IDs.
    NameRegex string
    A regex string to filter results by folder name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ParentFolderId string
    The ID of the parent folder.
    QueryKeyword string
    The query keyword.
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of resource manager folders IDs.
    nameRegex String
    A regex string to filter results by folder name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    parentFolderId String
    The ID of the parent folder.
    queryKeyword String
    The query keyword.
    enableDetails boolean
    Default to false. Set it to true can output more details.
    ids string[]
    A list of resource manager folders IDs.
    nameRegex string
    A regex string to filter results by folder name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    parentFolderId string
    The ID of the parent folder.
    queryKeyword string
    The query keyword.
    enable_details bool
    Default to false. Set it to true can output more details.
    ids Sequence[str]
    A list of resource manager folders IDs.
    name_regex str
    A regex string to filter results by folder name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    parent_folder_id str
    The ID of the parent folder.
    query_keyword str
    The query keyword.
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of resource manager folders IDs.
    nameRegex String
    A regex string to filter results by folder name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    parentFolderId String
    The ID of the parent folder.
    queryKeyword String
    The query keyword.

    getFolders Result

    The following output properties are available:

    Folders List<Pulumi.AliCloud.ResourceManager.Outputs.GetFoldersFolder>
    A list of folders. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of folder IDs.
    Names List<string>
    A list of folder names.
    EnableDetails bool
    NameRegex string
    OutputFile string
    ParentFolderId string
    (Available in v1.114.0+)The ID of the parent folder.
    QueryKeyword string
    Folders []GetFoldersFolder
    A list of folders. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of folder IDs.
    Names []string
    A list of folder names.
    EnableDetails bool
    NameRegex string
    OutputFile string
    ParentFolderId string
    (Available in v1.114.0+)The ID of the parent folder.
    QueryKeyword string
    folders List<GetFoldersFolder>
    A list of folders. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of folder IDs.
    names List<String>
    A list of folder names.
    enableDetails Boolean
    nameRegex String
    outputFile String
    parentFolderId String
    (Available in v1.114.0+)The ID of the parent folder.
    queryKeyword String
    folders GetFoldersFolder[]
    A list of folders. Each element contains the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of folder IDs.
    names string[]
    A list of folder names.
    enableDetails boolean
    nameRegex string
    outputFile string
    parentFolderId string
    (Available in v1.114.0+)The ID of the parent folder.
    queryKeyword string
    folders Sequence[GetFoldersFolder]
    A list of folders. Each element contains the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of folder IDs.
    names Sequence[str]
    A list of folder names.
    enable_details bool
    name_regex str
    output_file str
    parent_folder_id str
    (Available in v1.114.0+)The ID of the parent folder.
    query_keyword str
    folders List<Property Map>
    A list of folders. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of folder IDs.
    names List<String>
    A list of folder names.
    enableDetails Boolean
    nameRegex String
    outputFile String
    parentFolderId String
    (Available in v1.114.0+)The ID of the parent folder.
    queryKeyword String

    Supporting Types

    GetFoldersFolder

    FolderId string
    The ID of the folder.
    FolderName string
    The name of the folder.
    Id string
    The ID of the folder.
    ParentFolderId string
    The ID of the parent folder.
    FolderId string
    The ID of the folder.
    FolderName string
    The name of the folder.
    Id string
    The ID of the folder.
    ParentFolderId string
    The ID of the parent folder.
    folderId String
    The ID of the folder.
    folderName String
    The name of the folder.
    id String
    The ID of the folder.
    parentFolderId String
    The ID of the parent folder.
    folderId string
    The ID of the folder.
    folderName string
    The name of the folder.
    id string
    The ID of the folder.
    parentFolderId string
    The ID of the parent folder.
    folder_id str
    The ID of the folder.
    folder_name str
    The name of the folder.
    id str
    The ID of the folder.
    parent_folder_id str
    The ID of the parent folder.
    folderId String
    The ID of the folder.
    folderName String
    The name of the folder.
    id String
    The ID of the folder.
    parentFolderId String
    The ID of the parent folder.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi