com.pulumi.gcp.organizations.kotlin.OrganizationsFunctions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.organizations.kotlin
import com.pulumi.gcp.organizations.OrganizationsFunctions.getActiveFolderPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getBillingAccountPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getClientConfigPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getClientOpenIdUserInfoPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getFolderPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getFoldersPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getIAMPolicyPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getOrganizationPlain
import com.pulumi.gcp.organizations.OrganizationsFunctions.getProjectPlain
import com.pulumi.gcp.organizations.kotlin.inputs.GetActiveFolderPlainArgs
import com.pulumi.gcp.organizations.kotlin.inputs.GetActiveFolderPlainArgsBuilder
import com.pulumi.gcp.organizations.kotlin.inputs.GetBillingAccountPlainArgs
import com.pulumi.gcp.organizations.kotlin.inputs.GetBillingAccountPlainArgsBuilder
import com.pulumi.gcp.organizations.kotlin.inputs.GetFolderPlainArgs
import com.pulumi.gcp.organizations.kotlin.inputs.GetFolderPlainArgsBuilder
import com.pulumi.gcp.organizations.kotlin.inputs.GetFoldersPlainArgs
import com.pulumi.gcp.organizations.kotlin.inputs.GetFoldersPlainArgsBuilder
import com.pulumi.gcp.organizations.kotlin.inputs.GetIAMPolicyAuditConfig
import com.pulumi.gcp.organizations.kotlin.inputs.GetIAMPolicyBinding
import com.pulumi.gcp.organizations.kotlin.inputs.GetIAMPolicyPlainArgs
import com.pulumi.gcp.organizations.kotlin.inputs.GetIAMPolicyPlainArgsBuilder
import com.pulumi.gcp.organizations.kotlin.inputs.GetOrganizationPlainArgs
import com.pulumi.gcp.organizations.kotlin.inputs.GetOrganizationPlainArgsBuilder
import com.pulumi.gcp.organizations.kotlin.inputs.GetProjectPlainArgs
import com.pulumi.gcp.organizations.kotlin.inputs.GetProjectPlainArgsBuilder
import com.pulumi.gcp.organizations.kotlin.outputs.GetActiveFolderResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetBillingAccountResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetClientConfigResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetClientOpenIdUserInfoResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetFolderResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetFoldersResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetIAMPolicyResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetOrganizationResult
import com.pulumi.gcp.organizations.kotlin.outputs.GetProjectResult
import kotlinx.coroutines.future.await
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.organizations.kotlin.outputs.GetActiveFolderResult.Companion.toKotlin as getActiveFolderResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetBillingAccountResult.Companion.toKotlin as getBillingAccountResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetClientConfigResult.Companion.toKotlin as getClientConfigResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetClientOpenIdUserInfoResult.Companion.toKotlin as getClientOpenIdUserInfoResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetFolderResult.Companion.toKotlin as getFolderResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetFoldersResult.Companion.toKotlin as getFoldersResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetIAMPolicyResult.Companion.toKotlin as getIAMPolicyResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetOrganizationResult.Companion.toKotlin as getOrganizationResultToKotlin
import com.pulumi.gcp.organizations.kotlin.outputs.GetProjectResult.Companion.toKotlin as getProjectResultToKotlin
public object OrganizationsFunctions {
/**
* Get an active folder within GCP by `display_name` and `parent`.
* ## Example Usage
* ```tf
* data "google_active_folder" "department1" {
* display_name = "Department 1"
* parent = "organizations/1234567"
* }
* ```
* @param argument A collection of arguments for invoking getActiveFolder.
* @return A collection of values returned by getActiveFolder.
*/
public suspend fun getActiveFolder(argument: GetActiveFolderPlainArgs): GetActiveFolderResult =
getActiveFolderResultToKotlin(getActiveFolderPlain(argument.toJava()).await())
/**
* @see [getActiveFolder].
* @param apiMethod The API method to use to search for the folder. Valid values are `LIST` and `SEARCH`. Default Value is `LIST`. `LIST` is [strongly consistent](https://cloud.google.com/resource-manager/reference/rest/v3/folders/list#:~:text=list()%20provides%20a-,strongly%20consistent,-view%20of%20the) and requires `resourcemanager.folders.list` on the parent folder, while `SEARCH` is [eventually consistent](https://cloud.google.com/resource-manager/reference/rest/v3/folders/search#:~:text=eventually%20consistent) and only returns folders that the user has `resourcemanager.folders.get` permission on.
* @param displayName The folder's display name.
* @param parent The resource name of the parent Folder or Organization.
* @return A collection of values returned by getActiveFolder.
*/
public suspend fun getActiveFolder(
apiMethod: String? = null,
displayName: String,
parent: String,
): GetActiveFolderResult {
val argument = GetActiveFolderPlainArgs(
apiMethod = apiMethod,
displayName = displayName,
parent = parent,
)
return getActiveFolderResultToKotlin(getActiveFolderPlain(argument.toJava()).await())
}
/**
* @see [getActiveFolder].
* @param argument Builder for [com.pulumi.gcp.organizations.kotlin.inputs.GetActiveFolderPlainArgs].
* @return A collection of values returned by getActiveFolder.
*/
public suspend fun getActiveFolder(argument: suspend GetActiveFolderPlainArgsBuilder.() -> Unit): GetActiveFolderResult {
val builder = GetActiveFolderPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getActiveFolderResultToKotlin(getActiveFolderPlain(builtArgument.toJava()).await())
}
/**
* Use this data source to get information about a Google Billing Account.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const acct = gcp.organizations.getBillingAccount({
* displayName: "My Billing Account",
* open: true,
* });
* const myProject = new gcp.organizations.Project("my_project", {
* name: "My Project",
* projectId: "your-project-id",
* orgId: "1234567",
* billingAccount: acct.then(acct => acct.id),
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* acct = gcp.organizations.get_billing_account(display_name="My Billing Account",
* open=True)
* my_project = gcp.organizations.Project("my_project",
* name="My Project",
* project_id="your-project-id",
* org_id="1234567",
* billing_account=acct.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var acct = Gcp.Organizations.GetBillingAccount.Invoke(new()
* {
* DisplayName = "My Billing Account",
* Open = true,
* });
* var myProject = new Gcp.Organizations.Project("my_project", new()
* {
* Name = "My Project",
* ProjectId = "your-project-id",
* OrgId = "1234567",
* BillingAccount = acct.Apply(getBillingAccountResult => getBillingAccountResult.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* acct, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
* DisplayName: pulumi.StringRef("My Billing Account"),
* Open: pulumi.BoolRef(true),
* }, nil)
* if err != nil {
* return err
* }
* _, err = organizations.NewProject(ctx, "my_project", &organizations.ProjectArgs{
* Name: pulumi.String("My Project"),
* ProjectId: pulumi.String("your-project-id"),
* OrgId: pulumi.String("1234567"),
* BillingAccount: pulumi.String(acct.Id),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetBillingAccountArgs;
* import com.pulumi.gcp.organizations.Project;
* import com.pulumi.gcp.organizations.ProjectArgs;
* 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 acct = OrganizationsFunctions.getBillingAccount(GetBillingAccountArgs.builder()
* .displayName("My Billing Account")
* .open(true)
* .build());
* var myProject = new Project("myProject", ProjectArgs.builder()
* .name("My Project")
* .projectId("your-project-id")
* .orgId("1234567")
* .billingAccount(acct.applyValue(getBillingAccountResult -> getBillingAccountResult.id()))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* myProject:
* type: gcp:organizations:Project
* name: my_project
* properties:
* name: My Project
* projectId: your-project-id
* orgId: '1234567'
* billingAccount: ${acct.id}
* variables:
* acct:
* fn::invoke:
* Function: gcp:organizations:getBillingAccount
* Arguments:
* displayName: My Billing Account
* open: true
* ```
*
* @param argument A collection of arguments for invoking getBillingAccount.
* @return A collection of values returned by getBillingAccount.
*/
public suspend fun getBillingAccount(argument: GetBillingAccountPlainArgs): GetBillingAccountResult =
getBillingAccountResultToKotlin(getBillingAccountPlain(argument.toJava()).await())
/**
* @see [getBillingAccount].
* @param billingAccount The name of the billing account in the form `{billing_account_id}` or `billingAccounts/{billing_account_id}`.
* @param displayName The display name of the billing account.
* @param lookupProjects `true` if projects associated with the billing account should be read, `false` if this step
* should be skipped. Setting `false` may be useful if the user permissions do not allow listing projects. Defaults to `true`.
* > **NOTE:** One of `billing_account` or `display_name` must be specified.
* @param open `true` if the billing account is open, `false` if the billing account is closed.
* @return A collection of values returned by getBillingAccount.
*/
public suspend fun getBillingAccount(
billingAccount: String? = null,
displayName: String? = null,
lookupProjects: Boolean? = null,
`open`: Boolean? = null,
): GetBillingAccountResult {
val argument = GetBillingAccountPlainArgs(
billingAccount = billingAccount,
displayName = displayName,
lookupProjects = lookupProjects,
`open` = `open`,
)
return getBillingAccountResultToKotlin(getBillingAccountPlain(argument.toJava()).await())
}
/**
* @see [getBillingAccount].
* @param argument Builder for [com.pulumi.gcp.organizations.kotlin.inputs.GetBillingAccountPlainArgs].
* @return A collection of values returned by getBillingAccount.
*/
public suspend fun getBillingAccount(argument: suspend GetBillingAccountPlainArgsBuilder.() -> Unit): GetBillingAccountResult {
val builder = GetBillingAccountPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getBillingAccountResultToKotlin(getBillingAccountPlain(builtArgument.toJava()).await())
}
/**
* ## Example Usage
* ```tf
* data "google_client_config" "current" {
* }
* output "project" {
* value = data.google_client_config.current.project
* }
* ```
* ### Configure Kubernetes Provider With OAuth2 Access Token
* ```tf
* data "google_client_config" "default" {
* }
* data "google_container_cluster" "my_cluster" {
* name = "my-cluster"
* zone = "us-east1-a"
* }
* provider "kubernetes" {
* host = "https://${data.google_container_cluster.my_cluster.endpoint}"
* token = data.google_client_config.default.access_token
* cluster_ca_certificate = base64decode(
* data.google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate,
* )
* }
* ```
* @param argument ## Example Usage
* ```tf
* data "google_client_config" "current" {
* }
* output "project" {
* value = data.google_client_config.current.project
* }
* ```
* ### Configure Kubernetes Provider With OAuth2 Access Token
* ```tf
* data "google_client_config" "default" {
* }
* data "google_container_cluster" "my_cluster" {
* name = "my-cluster"
* zone = "us-east1-a"
* }
* provider "kubernetes" {
* host = "https://${data.google_container_cluster.my_cluster.endpoint}"
* token = data.google_client_config.default.access_token
* cluster_ca_certificate = base64decode(
* data.google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate,
* )
* }
* ```
* @return A collection of values returned by getClientConfig.
*/
public suspend fun getClientConfig(): GetClientConfigResult =
getClientConfigResultToKotlin(getClientConfigPlain().await())
/**
* Get OpenID userinfo about the credentials used with the Google provider,
* specifically the email.
* This datasource enables you to export the email of the account you've
* authenticated the provider with; this can be used alongside
* `data.google_client_config`'s `access_token` to perform OpenID Connect
* authentication with GKE and configure an RBAC role for the email used.
* > This resource will only work as expected if the provider is configured to
* use the `https://www.googleapis.com/auth/userinfo.email` scope! You will
* receive an error otherwise. The provider uses this scope by default.
* ## Example Usage
* ### Exporting An Email
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* export = async () => {
* const me = await gcp.organizations.getClientOpenIdUserInfo({});
* return {
* "my-email": me.email,
* };
* }
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* me = gcp.organizations.get_client_open_id_user_info()
* pulumi.export("my-email", me.email)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var me = Gcp.Organizations.GetClientOpenIdUserInfo.Invoke();
* return new Dictionary
* {
* ["my-email"] = me.Apply(getClientOpenIdUserInfoResult => getClientOpenIdUserInfoResult.Email),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* me, err := organizations.GetClientOpenIdUserInfo(ctx, nil, nil)
* if err != nil {
* return err
* }
* ctx.Export("my-email", me.Email)
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* 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 me = OrganizationsFunctions.getClientOpenIdUserInfo();
* ctx.export("my-email", me.applyValue(getClientOpenIdUserInfoResult -> getClientOpenIdUserInfoResult.email()));
* }
* }
* ```
* ```yaml
* variables:
* me:
* fn::invoke:
* Function: gcp:organizations:getClientOpenIdUserInfo
* Arguments: {}
* outputs:
* my-email: ${me.email}
* ```
*
* ### OpenID Connect W/ Kubernetes Provider + RBAC IAM Role
*
* ```yaml
* resources:
* user:
* type: kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding
* properties:
* metadata:
* name: provider-user-admin
* roleRef:
* apiGroup: rbac.authorization.k8s.io
* kind: ClusterRole
* name: cluster-admin
* subject:
* - kind: User
* name: ${providerIdentity.email}
* variables:
* providerIdentity:
* fn::invoke:
* Function: gcp:organizations:getClientOpenIdUserInfo
* Arguments: {}
* provider:
* fn::invoke:
* Function: gcp:organizations:getClientConfig
* Arguments: {}
* myCluster:
* fn::invoke:
* Function: gcp:container:getCluster
* Arguments:
* name: my-cluster
* zone: us-east1-a
* ```
*
* @param argument Get OpenID userinfo about the credentials used with the Google provider,
* specifically the email.
* This datasource enables you to export the email of the account you've
* authenticated the provider with; this can be used alongside
* `data.google_client_config`'s `access_token` to perform OpenID Connect
* authentication with GKE and configure an RBAC role for the email used.
* > This resource will only work as expected if the provider is configured to
* use the `https://www.googleapis.com/auth/userinfo.email` scope! You will
* receive an error otherwise. The provider uses this scope by default.
* ## Example Usage
* ### Exporting An Email
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* export = async () => {
* const me = await gcp.organizations.getClientOpenIdUserInfo({});
* return {
* "my-email": me.email,
* };
* }
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* me = gcp.organizations.get_client_open_id_user_info()
* pulumi.export("my-email", me.email)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var me = Gcp.Organizations.GetClientOpenIdUserInfo.Invoke();
* return new Dictionary
* {
* ["my-email"] = me.Apply(getClientOpenIdUserInfoResult => getClientOpenIdUserInfoResult.Email),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* me, err := organizations.GetClientOpenIdUserInfo(ctx, nil, nil)
* if err != nil {
* return err
* }
* ctx.Export("my-email", me.Email)
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* 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 me = OrganizationsFunctions.getClientOpenIdUserInfo();
* ctx.export("my-email", me.applyValue(getClientOpenIdUserInfoResult -> getClientOpenIdUserInfoResult.email()));
* }
* }
* ```
* ```yaml
* variables:
* me:
* fn::invoke:
* Function: gcp:organizations:getClientOpenIdUserInfo
* Arguments: {}
* outputs:
* my-email: ${me.email}
* ```
*
* ### OpenID Connect W/ Kubernetes Provider + RBAC IAM Role
*
* ```yaml
* resources:
* user:
* type: kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding
* properties:
* metadata:
* name: provider-user-admin
* roleRef:
* apiGroup: rbac.authorization.k8s.io
* kind: ClusterRole
* name: cluster-admin
* subject:
* - kind: User
* name: ${providerIdentity.email}
* variables:
* providerIdentity:
* fn::invoke:
* Function: gcp:organizations:getClientOpenIdUserInfo
* Arguments: {}
* provider:
* fn::invoke:
* Function: gcp:organizations:getClientConfig
* Arguments: {}
* myCluster:
* fn::invoke:
* Function: gcp:container:getCluster
* Arguments:
* name: my-cluster
* zone: us-east1-a
* ```
*
* @return A collection of values returned by getClientOpenIdUserInfo.
*/
public suspend fun getClientOpenIdUserInfo(): GetClientOpenIdUserInfoResult =
getClientOpenIdUserInfoResultToKotlin(getClientOpenIdUserInfoPlain().await())
/**
* Use this data source to get information about a Google Cloud Folder.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const myFolder1 = gcp.organizations.getFolder({
* folder: "folders/12345",
* lookupOrganization: true,
* });
* const myFolder2 = gcp.organizations.getFolder({
* folder: "folders/23456",
* });
* export const myFolder1Organization = myFolder1.then(myFolder1 => myFolder1.organization);
* export const myFolder2Parent = myFolder2.then(myFolder2 => myFolder2.parent);
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_folder1 = gcp.organizations.get_folder(folder="folders/12345",
* lookup_organization=True)
* my_folder2 = gcp.organizations.get_folder(folder="folders/23456")
* pulumi.export("myFolder1Organization", my_folder1.organization)
* pulumi.export("myFolder2Parent", my_folder2.parent)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var myFolder1 = Gcp.Organizations.GetFolder.Invoke(new()
* {
* Folder = "folders/12345",
* LookupOrganization = true,
* });
* var myFolder2 = Gcp.Organizations.GetFolder.Invoke(new()
* {
* Folder = "folders/23456",
* });
* return new Dictionary
* {
* ["myFolder1Organization"] = myFolder1.Apply(getFolderResult => getFolderResult.Organization),
* ["myFolder2Parent"] = myFolder2.Apply(getFolderResult => getFolderResult.Parent),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* myFolder1, err := organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
* Folder: "folders/12345",
* LookupOrganization: pulumi.BoolRef(true),
* }, nil)
* if err != nil {
* return err
* }
* myFolder2, err := organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
* Folder: "folders/23456",
* }, nil)
* if err != nil {
* return err
* }
* ctx.Export("myFolder1Organization", myFolder1.Organization)
* ctx.Export("myFolder2Parent", myFolder2.Parent)
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetFolderArgs;
* 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 myFolder1 = OrganizationsFunctions.getFolder(GetFolderArgs.builder()
* .folder("folders/12345")
* .lookupOrganization(true)
* .build());
* final var myFolder2 = OrganizationsFunctions.getFolder(GetFolderArgs.builder()
* .folder("folders/23456")
* .build());
* ctx.export("myFolder1Organization", myFolder1.applyValue(getFolderResult -> getFolderResult.organization()));
* ctx.export("myFolder2Parent", myFolder2.applyValue(getFolderResult -> getFolderResult.parent()));
* }
* }
* ```
* ```yaml
* variables:
* myFolder1:
* fn::invoke:
* Function: gcp:organizations:getFolder
* Arguments:
* folder: folders/12345
* lookupOrganization: true
* myFolder2:
* fn::invoke:
* Function: gcp:organizations:getFolder
* Arguments:
* folder: folders/23456
* outputs:
* myFolder1Organization: ${myFolder1.organization}
* myFolder2Parent: ${myFolder2.parent}
* ```
*
* @param argument A collection of arguments for invoking getFolder.
* @return A collection of values returned by getFolder.
*/
public suspend fun getFolder(argument: GetFolderPlainArgs): GetFolderResult =
getFolderResultToKotlin(getFolderPlain(argument.toJava()).await())
/**
* @see [getFolder].
* @param folder The name of the Folder in the form `{folder_id}` or `folders/{folder_id}`.
* @param lookupOrganization `true` to find the organization that the folder belongs, `false` to avoid the lookup. It searches up the tree. (defaults to `false`)
* @return A collection of values returned by getFolder.
*/
public suspend fun getFolder(folder: String, lookupOrganization: Boolean? = null): GetFolderResult {
val argument = GetFolderPlainArgs(
folder = folder,
lookupOrganization = lookupOrganization,
)
return getFolderResultToKotlin(getFolderPlain(argument.toJava()).await())
}
/**
* @see [getFolder].
* @param argument Builder for [com.pulumi.gcp.organizations.kotlin.inputs.GetFolderPlainArgs].
* @return A collection of values returned by getFolder.
*/
public suspend fun getFolder(argument: suspend GetFolderPlainArgsBuilder.() -> Unit): GetFolderResult {
val builder = GetFolderPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getFolderResultToKotlin(getFolderPlain(builtArgument.toJava()).await())
}
/**
* Retrieve information about a set of folders based on a parent ID. See the
* [REST API](https://cloud.google.com/resource-manager/reference/rest/v3/folders/list)
* for more details.
* ## Example Usage
* ### Searching For Folders At The Root Of An Org
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const my-org-folders = gcp.organizations.getFolders({
* parentId: `organizations/${organizationId}`,
* });
* const first-folder = my_org_folders.then(my_org_folders => gcp.organizations.getFolder({
* folder: my_org_folders.folders?.[0]?.name,
* }));
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_org_folders = gcp.organizations.get_folders(parent_id=f"organizations/{organization_id}")
* first_folder = gcp.organizations.get_folder(folder=my_org_folders.folders[0].name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var my_org_folders = Gcp.Organizations.GetFolders.Invoke(new()
* {
* ParentId = $"organizations/{organizationId}",
* });
* var first_folder = Gcp.Organizations.GetFolder.Invoke(new()
* {
* Folder = my_org_folders.Apply(getFoldersResult => getFoldersResult.Folders[0]?.Name),
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/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("organizations/%v", organizationId),
* }, 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
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetFoldersArgs;
* import com.pulumi.gcp.organizations.inputs.GetFolderArgs;
* 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 my-org-folders = OrganizationsFunctions.getFolders(GetFoldersArgs.builder()
* .parentId(String.format("organizations/%s", organizationId))
* .build());
* final var first-folder = OrganizationsFunctions.getFolder(GetFolderArgs.builder()
* .folder(my_org_folders.folders()[0].name())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* my-org-folders:
* fn::invoke:
* Function: gcp:organizations:getFolders
* Arguments:
* parentId: organizations/${organizationId}
* first-folder:
* fn::invoke:
* Function: gcp:organizations:getFolder
* Arguments:
* folder: ${["my-org-folders"].folders[0].name}
* ```
*
* @param argument A collection of arguments for invoking getFolders.
* @return A collection of values returned by getFolders.
*/
public suspend fun getFolders(argument: GetFoldersPlainArgs): GetFoldersResult =
getFoldersResultToKotlin(getFoldersPlain(argument.toJava()).await())
/**
* @see [getFolders].
* @param parentId A string parent as defined in the [REST API](https://cloud.google.com/resource-manager/reference/rest/v3/folders/list#query-parameters).
* @return A collection of values returned by getFolders.
*/
public suspend fun getFolders(parentId: String): GetFoldersResult {
val argument = GetFoldersPlainArgs(
parentId = parentId,
)
return getFoldersResultToKotlin(getFoldersPlain(argument.toJava()).await())
}
/**
* @see [getFolders].
* @param argument Builder for [com.pulumi.gcp.organizations.kotlin.inputs.GetFoldersPlainArgs].
* @return A collection of values returned by getFolders.
*/
public suspend fun getFolders(argument: suspend GetFoldersPlainArgsBuilder.() -> Unit): GetFoldersResult {
val builder = GetFoldersPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getFoldersResultToKotlin(getFoldersPlain(builtArgument.toJava()).await())
}
/**
* Generates an IAM policy document that may be referenced by and applied to
* other Google Cloud Platform IAM resources, such as the `gcp.projects.IAMPolicy` resource.
* **Note:** Please review the documentation of the resource that you will be using the datasource with. Some resources such as `gcp.projects.IAMPolicy` and others have limitations in their API methods which are noted on their respective page.
* @param argument A collection of arguments for invoking getIAMPolicy.
* @return A collection of values returned by getIAMPolicy.
*/
public suspend fun getIAMPolicy(argument: GetIAMPolicyPlainArgs): GetIAMPolicyResult =
getIAMPolicyResultToKotlin(getIAMPolicyPlain(argument.toJava()).await())
/**
* @see [getIAMPolicy].
* @param auditConfigs A nested configuration block that defines logging additional configuration for your project. This field is only supported on `gcp.projects.IAMPolicy`, `gcp.folder.IAMPolicy` and `gcp.organizations.IAMPolicy`.
* @param bindings A nested configuration block (described below)
* defining a binding to be included in the policy document. Multiple
* `binding` arguments are supported.
* Each document configuration must have one or more `binding` blocks, which
* each accept the following arguments:
* @return A collection of values returned by getIAMPolicy.
*/
public suspend fun getIAMPolicy(
auditConfigs: List? = null,
bindings: List? = null,
): GetIAMPolicyResult {
val argument = GetIAMPolicyPlainArgs(
auditConfigs = auditConfigs,
bindings = bindings,
)
return getIAMPolicyResultToKotlin(getIAMPolicyPlain(argument.toJava()).await())
}
/**
* @see [getIAMPolicy].
* @param argument Builder for [com.pulumi.gcp.organizations.kotlin.inputs.GetIAMPolicyPlainArgs].
* @return A collection of values returned by getIAMPolicy.
*/
public suspend fun getIAMPolicy(argument: suspend GetIAMPolicyPlainArgsBuilder.() -> Unit): GetIAMPolicyResult {
val builder = GetIAMPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getIAMPolicyResultToKotlin(getIAMPolicyPlain(builtArgument.toJava()).await())
}
/**
* Get information about a Google Cloud Organization. Note that you must have the `roles/resourcemanager.organizationViewer` role (or equivalent permissions) at the organization level to use this datasource.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const org = gcp.organizations.getOrganization({
* domain: "example.com",
* });
* const sales = new gcp.organizations.Folder("sales", {
* displayName: "Sales",
* parent: org.then(org => org.name),
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* org = gcp.organizations.get_organization(domain="example.com")
* sales = gcp.organizations.Folder("sales",
* display_name="Sales",
* parent=org.name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var org = Gcp.Organizations.GetOrganization.Invoke(new()
* {
* Domain = "example.com",
* });
* var sales = new Gcp.Organizations.Folder("sales", new()
* {
* DisplayName = "Sales",
* Parent = org.Apply(getOrganizationResult => getOrganizationResult.Name),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* org, err := organizations.GetOrganization(ctx, &organizations.GetOrganizationArgs{
* Domain: pulumi.StringRef("example.com"),
* }, nil)
* if err != nil {
* return err
* }
* _, err = organizations.NewFolder(ctx, "sales", &organizations.FolderArgs{
* DisplayName: pulumi.String("Sales"),
* Parent: pulumi.String(org.Name),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetOrganizationArgs;
* import com.pulumi.gcp.organizations.Folder;
* import com.pulumi.gcp.organizations.FolderArgs;
* 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 org = OrganizationsFunctions.getOrganization(GetOrganizationArgs.builder()
* .domain("example.com")
* .build());
* var sales = new Folder("sales", FolderArgs.builder()
* .displayName("Sales")
* .parent(org.applyValue(getOrganizationResult -> getOrganizationResult.name()))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* sales:
* type: gcp:organizations:Folder
* properties:
* displayName: Sales
* parent: ${org.name}
* variables:
* org:
* fn::invoke:
* Function: gcp:organizations:getOrganization
* Arguments:
* domain: example.com
* ```
*
* @param argument A collection of arguments for invoking getOrganization.
* @return A collection of values returned by getOrganization.
*/
public suspend fun getOrganization(argument: GetOrganizationPlainArgs): GetOrganizationResult =
getOrganizationResultToKotlin(getOrganizationPlain(argument.toJava()).await())
/**
* @see [getOrganization].
* @param domain The domain name of the Organization.
* > **NOTE:** One of `organization` or `domain` must be specified.
* @param organization The Organization's numeric ID, including an optional `organizations/` prefix.
* @return A collection of values returned by getOrganization.
*/
public suspend fun getOrganization(domain: String? = null, organization: String? = null): GetOrganizationResult {
val argument = GetOrganizationPlainArgs(
domain = domain,
organization = organization,
)
return getOrganizationResultToKotlin(getOrganizationPlain(argument.toJava()).await())
}
/**
* @see [getOrganization].
* @param argument Builder for [com.pulumi.gcp.organizations.kotlin.inputs.GetOrganizationPlainArgs].
* @return A collection of values returned by getOrganization.
*/
public suspend fun getOrganization(argument: suspend GetOrganizationPlainArgsBuilder.() -> Unit): GetOrganizationResult {
val builder = GetOrganizationPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getOrganizationResultToKotlin(getOrganizationPlain(builtArgument.toJava()).await())
}
/**
* Use this data source to get project details.
* For more information see
* [API](https://cloud.google.com/resource-manager/reference/rest/v1/projects#Project)
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const project = gcp.organizations.getProject({});
* export const projectNumber = project.then(project => project.number);
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* project = gcp.organizations.get_project()
* pulumi.export("projectNumber", project.number)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var project = Gcp.Organizations.GetProject.Invoke();
* return new Dictionary
* {
* ["projectNumber"] = project.Apply(getProjectResult => getProjectResult.Number),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* ctx.Export("projectNumber", project.Number)
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* 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 project = OrganizationsFunctions.getProject();
* ctx.export("projectNumber", project.applyValue(getProjectResult -> getProjectResult.number()));
* }
* }
* ```
* ```yaml
* variables:
* project:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments: {}
* outputs:
* projectNumber: ${project.number}
* ```
*
* @param argument A collection of arguments for invoking getProject.
* @return A collection of values returned by getProject.
*/
public suspend fun getProject(argument: GetProjectPlainArgs): GetProjectResult =
getProjectResultToKotlin(getProjectPlain(argument.toJava()).await())
/**
* @see [getProject].
* @param projectId The project ID. If it is not provided, the provider project is used.
* @return A collection of values returned by getProject.
*/
public suspend fun getProject(projectId: String? = null): GetProjectResult {
val argument = GetProjectPlainArgs(
projectId = projectId,
)
return getProjectResultToKotlin(getProjectPlain(argument.toJava()).await())
}
/**
* @see [getProject].
* @param argument Builder for [com.pulumi.gcp.organizations.kotlin.inputs.GetProjectPlainArgs].
* @return A collection of values returned by getProject.
*/
public suspend fun getProject(argument: suspend GetProjectPlainArgsBuilder.() -> Unit): GetProjectResult {
val builder = GetProjectPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getProjectResultToKotlin(getProjectPlain(builtArgument.toJava()).await())
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy