Google Cloud (GCP) Classic
getFolders
Retrieve information about a set of folders based on a parent ID. See the REST API for more details.
Example Usage
Searching For Folders At The Root Of An Org
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var my_org_folders = Output.Create(Gcp.Organizations.GetFolders.InvokeAsync(new Gcp.Organizations.GetFoldersArgs
{
ParentId = $"organizations/{@var.Organization_id}",
}));
var first_folder = my_org_folders.Apply(my_org_folders => Output.Create(Gcp.Organizations.GetFolder.InvokeAsync(new Gcp.Organizations.GetFolderArgs
{
Folder = my_org_folders.Folders?[0]?.Name,
})));
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
my_org_folders, err := organizations.GetFolders(ctx, &organizations.GetFoldersArgs{
ParentId: fmt.Sprintf("%v%v", "organizations/", _var.Organization_id),
}, nil)
if err != nil {
return err
}
_, err = organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
Folder: my_org_folders.Folders[0].Name,
}, nil)
if err != nil {
return err
}
return nil
})
}
package generated_program;
import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var my-org-folders = Output.of(OrganizationsFunctions.getFolders(GetFoldersArgs.builder()
.parentId(String.format("organizations/%s", var_.getOrganization_id()))
.build()));
final var first-folder = Output.of(OrganizationsFunctions.getFolder(GetFolderArgs.builder()
.folder(my_org_folders.getFolders()[0].getName())
.build()));
}
}
import pulumi
import pulumi_gcp as gcp
my_org_folders = gcp.organizations.get_folders(parent_id=f"organizations/{var['organization_id']}")
first_folder = gcp.organizations.get_folder(folder=my_org_folders.folders[0].name)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const my-org-folders = gcp.organizations.getFolders({
parentId: `organizations/${_var.organization_id}`,
});
const first-folder = my_org_folders.then(my_org_folders => gcp.organizations.getFolder({
folder: my_org_folders.folders?[0]?.name,
}));
variables:
my-org-folders:
Fn::Invoke:
Function: gcp:organizations:getFolders
Arguments:
parentId: organizations/${var.organization_id}
first-folder:
Fn::Invoke:
Function: gcp:organizations:getFolder
Arguments:
folder: ${["my-org-folders"].folders[0].name}
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(parent_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetFoldersResult
def get_folders_output(parent_id: 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: gcp:organizations/getFolders:getFolders
Arguments:
# Arguments dictionary
The following arguments are supported:
getFolders Result
The following output properties are available:
- Folders
List<Get
Folders Folder> A list of projects matching the provided filter. Structure is defined below.
- Id string
The provider-assigned unique ID for this managed resource.
- Parent
Id string
- Folders
[]Get
Folders Folder A list of projects matching the provided filter. Structure is defined below.
- Id string
The provider-assigned unique ID for this managed resource.
- Parent
Id string
- folders
List
Folders Folder> A list of projects matching the provided filter. Structure is defined below.
- id String
The provider-assigned unique ID for this managed resource.
- parent
Id String
- folders
Get
Folders Folder[] A list of projects matching the provided filter. Structure is defined below.
- id string
The provider-assigned unique ID for this managed resource.
- parent
Id string
- folders
Sequence[Get
Folders Folder] A list of projects matching the provided filter. Structure is defined below.
- id str
The provider-assigned unique ID for this managed resource.
- parent_
id str
Supporting Types
GetFoldersFolder
- Create
Time string The timestamp of when the folder was created
- Delete
Time string The timestamp of when the folder was requested to be deleted (if applicable)
- Display
Name string The display name of the folder
- Etag string
Entity tag identifier of the folder
- Name string
The id of the folder
- Parent string
The parent id of the folder
- State string
The lifecycle state of the folder
- Update
Time string The timestamp of when the folder was last modified
- Create
Time string The timestamp of when the folder was created
- Delete
Time string The timestamp of when the folder was requested to be deleted (if applicable)
- Display
Name string The display name of the folder
- Etag string
Entity tag identifier of the folder
- Name string
The id of the folder
- Parent string
The parent id of the folder
- State string
The lifecycle state of the folder
- Update
Time string The timestamp of when the folder was last modified
- create
Time String The timestamp of when the folder was created
- delete
Time String The timestamp of when the folder was requested to be deleted (if applicable)
- display
Name String The display name of the folder
- etag String
Entity tag identifier of the folder
- name String
The id of the folder
- parent String
The parent id of the folder
- state String
The lifecycle state of the folder
- update
Time String The timestamp of when the folder was last modified
- create
Time string The timestamp of when the folder was created
- delete
Time string The timestamp of when the folder was requested to be deleted (if applicable)
- display
Name string The display name of the folder
- etag string
Entity tag identifier of the folder
- name string
The id of the folder
- parent string
The parent id of the folder
- state string
The lifecycle state of the folder
- update
Time string The timestamp of when the folder was last modified
- create_
time str The timestamp of when the folder was created
- delete_
time str The timestamp of when the folder was requested to be deleted (if applicable)
- display_
name str The display name of the folder
- etag str
Entity tag identifier of the folder
- name str
The id of the folder
- parent str
The parent id of the folder
- state str
The lifecycle state of the folder
- update_
time str The timestamp of when the folder was last modified
- create
Time String The timestamp of when the folder was created
- delete
Time String The timestamp of when the folder was requested to be deleted (if applicable)
- display
Name String The display name of the folder
- etag String
Entity tag identifier of the folder
- name String
The id of the folder
- parent String
The parent id of the folder
- state String
The lifecycle state of the folder
- update
Time String The timestamp of when the folder was last modified
Package Details
- Repository
- https://github.com/pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
google-beta
Terraform Provider.