com.pulumi.aws.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-aws-kotlin Show documentation
Show all versions of pulumi-aws-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.aws.organizations.kotlin
import com.pulumi.aws.organizations.OrganizationsFunctions.getDelegatedAdministratorsPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getDelegatedServicesPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getOrganizationPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getOrganizationalUnitChildAccountsPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getOrganizationalUnitDescendantAccountsPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getOrganizationalUnitDescendantOrganizationalUnitsPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getOrganizationalUnitPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getOrganizationalUnitsPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getPoliciesForTargetPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getPoliciesPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getPolicyPlain
import com.pulumi.aws.organizations.OrganizationsFunctions.getResourceTagsPlain
import com.pulumi.aws.organizations.kotlin.inputs.GetDelegatedAdministratorsPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetDelegatedAdministratorsPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetDelegatedServicesPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetDelegatedServicesPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitChildAccountsPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitChildAccountsPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitDescendantAccountsPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitDescendantAccountsPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitDescendantOrganizationalUnitsPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitDescendantOrganizationalUnitsPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitsPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitsPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetPoliciesForTargetPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetPoliciesForTargetPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetPoliciesPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetPoliciesPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetPolicyPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetPolicyPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.inputs.GetResourceTagsPlainArgs
import com.pulumi.aws.organizations.kotlin.inputs.GetResourceTagsPlainArgsBuilder
import com.pulumi.aws.organizations.kotlin.outputs.GetDelegatedAdministratorsResult
import com.pulumi.aws.organizations.kotlin.outputs.GetDelegatedServicesResult
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationResult
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitChildAccountsResult
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitDescendantAccountsResult
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitDescendantOrganizationalUnitsResult
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitResult
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitsResult
import com.pulumi.aws.organizations.kotlin.outputs.GetPoliciesForTargetResult
import com.pulumi.aws.organizations.kotlin.outputs.GetPoliciesResult
import com.pulumi.aws.organizations.kotlin.outputs.GetPolicyResult
import com.pulumi.aws.organizations.kotlin.outputs.GetResourceTagsResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.aws.organizations.kotlin.outputs.GetDelegatedAdministratorsResult.Companion.toKotlin as getDelegatedAdministratorsResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetDelegatedServicesResult.Companion.toKotlin as getDelegatedServicesResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationResult.Companion.toKotlin as getOrganizationResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitChildAccountsResult.Companion.toKotlin as getOrganizationalUnitChildAccountsResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitDescendantAccountsResult.Companion.toKotlin as getOrganizationalUnitDescendantAccountsResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitDescendantOrganizationalUnitsResult.Companion.toKotlin as getOrganizationalUnitDescendantOrganizationalUnitsResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitResult.Companion.toKotlin as getOrganizationalUnitResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetOrganizationalUnitsResult.Companion.toKotlin as getOrganizationalUnitsResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetPoliciesForTargetResult.Companion.toKotlin as getPoliciesForTargetResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetPoliciesResult.Companion.toKotlin as getPoliciesResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetPolicyResult.Companion.toKotlin as getPolicyResultToKotlin
import com.pulumi.aws.organizations.kotlin.outputs.GetResourceTagsResult.Companion.toKotlin as getResourceTagsResultToKotlin
public object OrganizationsFunctions {
/**
* Get a list of AWS accounts that are designated as delegated administrators in this organization
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = aws.organizations.getDelegatedAdministrators({
* servicePrincipal: "SERVICE PRINCIPAL",
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.organizations.get_delegated_administrators(service_principal="SERVICE PRINCIPAL")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = Aws.Organizations.GetDelegatedAdministrators.Invoke(new()
* {
* ServicePrincipal = "SERVICE PRINCIPAL",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := organizations.GetDelegatedAdministrators(ctx, &organizations.GetDelegatedAdministratorsArgs{
* ServicePrincipal: pulumi.StringRef("SERVICE PRINCIPAL"),
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetDelegatedAdministratorsArgs;
* 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 = OrganizationsFunctions.getDelegatedAdministrators(GetDelegatedAdministratorsArgs.builder()
* .servicePrincipal("SERVICE PRINCIPAL")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* example:
* fn::invoke:
* Function: aws:organizations:getDelegatedAdministrators
* Arguments:
* servicePrincipal: SERVICE PRINCIPAL
* ```
*
* @param argument A collection of arguments for invoking getDelegatedAdministrators.
* @return A collection of values returned by getDelegatedAdministrators.
*/
public suspend fun getDelegatedAdministrators(argument: GetDelegatedAdministratorsPlainArgs): GetDelegatedAdministratorsResult =
getDelegatedAdministratorsResultToKotlin(getDelegatedAdministratorsPlain(argument.toJava()).await())
/**
* @see [getDelegatedAdministrators].
* @param servicePrincipal Specifies a service principal name. If specified, then the operation lists the delegated administrators only for the specified service. If you don't specify a service principal, the operation lists all delegated administrators for all services in your organization.
* @return A collection of values returned by getDelegatedAdministrators.
*/
public suspend fun getDelegatedAdministrators(servicePrincipal: String? = null): GetDelegatedAdministratorsResult {
val argument = GetDelegatedAdministratorsPlainArgs(
servicePrincipal = servicePrincipal,
)
return getDelegatedAdministratorsResultToKotlin(getDelegatedAdministratorsPlain(argument.toJava()).await())
}
/**
* @see [getDelegatedAdministrators].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetDelegatedAdministratorsPlainArgs].
* @return A collection of values returned by getDelegatedAdministrators.
*/
public suspend fun getDelegatedAdministrators(argument: suspend GetDelegatedAdministratorsPlainArgsBuilder.() -> Unit): GetDelegatedAdministratorsResult {
val builder = GetDelegatedAdministratorsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getDelegatedAdministratorsResultToKotlin(getDelegatedAdministratorsPlain(builtArgument.toJava()).await())
}
/**
* Get a list the AWS services for which the specified account is a delegated administrator
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = aws.organizations.getDelegatedServices({
* accountId: "AWS ACCOUNT ID",
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.organizations.get_delegated_services(account_id="AWS ACCOUNT ID")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = Aws.Organizations.GetDelegatedServices.Invoke(new()
* {
* AccountId = "AWS ACCOUNT ID",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := organizations.GetDelegatedServices(ctx, &organizations.GetDelegatedServicesArgs{
* AccountId: "AWS ACCOUNT ID",
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetDelegatedServicesArgs;
* 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 = OrganizationsFunctions.getDelegatedServices(GetDelegatedServicesArgs.builder()
* .accountId("AWS ACCOUNT ID")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* example:
* fn::invoke:
* Function: aws:organizations:getDelegatedServices
* Arguments:
* accountId: AWS ACCOUNT ID
* ```
*
* @param argument A collection of arguments for invoking getDelegatedServices.
* @return A collection of values returned by getDelegatedServices.
*/
public suspend fun getDelegatedServices(argument: GetDelegatedServicesPlainArgs): GetDelegatedServicesResult =
getDelegatedServicesResultToKotlin(getDelegatedServicesPlain(argument.toJava()).await())
/**
* @see [getDelegatedServices].
* @param accountId Account ID number of a delegated administrator account in the organization.
* @return A collection of values returned by getDelegatedServices.
*/
public suspend fun getDelegatedServices(accountId: String): GetDelegatedServicesResult {
val argument = GetDelegatedServicesPlainArgs(
accountId = accountId,
)
return getDelegatedServicesResultToKotlin(getDelegatedServicesPlain(argument.toJava()).await())
}
/**
* @see [getDelegatedServices].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetDelegatedServicesPlainArgs].
* @return A collection of values returned by getDelegatedServices.
*/
public suspend fun getDelegatedServices(argument: suspend GetDelegatedServicesPlainArgsBuilder.() -> Unit): GetDelegatedServicesResult {
val builder = GetDelegatedServicesPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getDelegatedServicesResultToKotlin(getDelegatedServicesPlain(builtArgument.toJava()).await())
}
/**
* Get information about the organization that the user's account belongs to
* ## Example Usage
* ### List all account IDs for the organization
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = aws.organizations.getOrganization({});
* export const accountIds = example.then(example => example.accounts.map(__item => __item.id));
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.organizations.get_organization()
* pulumi.export("accountIds", [__item.id for __item in example.accounts])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = Aws.Organizations.GetOrganization.Invoke();
* return new Dictionary
* {
* ["accountIds"] = example.Apply(getOrganizationResult => getOrganizationResult.Accounts).Select(__item => __item.Id).ToList(),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := organizations.LookupOrganization(ctx, map[string]interface{}{
* }, nil);
* if err != nil {
* return err
* }
* ctx.Export("accountIds", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:3,11-33)))
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.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 example = OrganizationsFunctions.getOrganization();
* ctx.export("accountIds", example.applyValue(getOrganizationResult -> getOrganizationResult.accounts()).stream().map(element -> element.id()).collect(toList()));
* }
* }
* ```
*
* ### SNS topic that can be interacted by the organization only
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = aws.organizations.getOrganization({});
* const snsTopic = new aws.sns.Topic("sns_topic", {name: "my-sns-topic"});
* const snsTopicPolicy = pulumi.all([example, snsTopic.arn]).apply(([example, arn]) => aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* actions: [
* "SNS:Subscribe",
* "SNS:Publish",
* ],
* conditions: [{
* test: "StringEquals",
* variable: "aws:PrincipalOrgID",
* values: [example.id],
* }],
* principals: [{
* type: "AWS",
* identifiers: ["*"],
* }],
* resources: [arn],
* }],
* }));
* const snsTopicPolicyTopicPolicy = new aws.sns.TopicPolicy("sns_topic_policy", {
* arn: snsTopic.arn,
* policy: snsTopicPolicy.apply(snsTopicPolicy => snsTopicPolicy.json),
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.organizations.get_organization()
* sns_topic = aws.sns.Topic("sns_topic", name="my-sns-topic")
* sns_topic_policy = sns_topic.arn.apply(lambda arn: aws.iam.get_policy_document_output(statements=[{
* "effect": "Allow",
* "actions": [
* "SNS:Subscribe",
* "SNS:Publish",
* ],
* "conditions": [{
* "test": "StringEquals",
* "variable": "aws:PrincipalOrgID",
* "values": [example.id],
* }],
* "principals": [{
* "type": "AWS",
* "identifiers": ["*"],
* }],
* "resources": [arn],
* }]))
* sns_topic_policy_topic_policy = aws.sns.TopicPolicy("sns_topic_policy",
* arn=sns_topic.arn,
* policy=sns_topic_policy.json)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = Aws.Organizations.GetOrganization.Invoke();
* var snsTopic = new Aws.Sns.Topic("sns_topic", new()
* {
* Name = "my-sns-topic",
* });
* var snsTopicPolicy = Aws.Iam.GetPolicyDocument.Invoke(new()
* {
* Statements = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
* {
* Effect = "Allow",
* Actions = new[]
* {
* "SNS:Subscribe",
* "SNS:Publish",
* },
* Conditions = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
* {
* Test = "StringEquals",
* Variable = "aws:PrincipalOrgID",
* Values = new[]
* {
* example.Apply(getOrganizationResult => getOrganizationResult.Id),
* },
* },
* },
* Principals = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
* {
* Type = "AWS",
* Identifiers = new[]
* {
* "*",
* },
* },
* },
* Resources = new[]
* {
* snsTopic.Arn,
* },
* },
* },
* });
* var snsTopicPolicyTopicPolicy = new Aws.Sns.TopicPolicy("sns_topic_policy", new()
* {
* Arn = snsTopic.Arn,
* Policy = snsTopicPolicy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := organizations.LookupOrganization(ctx, map[string]interface{}{
* }, nil);
* if err != nil {
* return err
* }
* snsTopic, err := sns.NewTopic(ctx, "sns_topic", &sns.TopicArgs{
* Name: pulumi.String("my-sns-topic"),
* })
* if err != nil {
* return err
* }
* snsTopicPolicy := snsTopic.Arn.ApplyT(func(arn string) (iam.GetPolicyDocumentResult, error) {
* return iam.GetPolicyDocumentResult(interface{}(iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
* Statements: []iam.GetPolicyDocumentStatement{
* {
* Effect: "Allow",
* Actions: []string{
* "SNS:Subscribe",
* "SNS:Publish",
* },
* Conditions: []iam.GetPolicyDocumentStatementCondition{
* {
* Test: "StringEquals",
* Variable: "aws:PrincipalOrgID",
* Values: interface{}{
* example.Id,
* },
* },
* },
* Principals: []iam.GetPolicyDocumentStatementPrincipal{
* {
* Type: "AWS",
* Identifiers: []string{
* "*",
* },
* },
* },
* Resources: interface{}{
* arn,
* },
* },
* },
* }, nil))), nil
* }).(iam.GetPolicyDocumentResultOutput)
* _, err = sns.NewTopicPolicy(ctx, "sns_topic_policy", &sns.TopicPolicyArgs{
* Arn: snsTopic.Arn,
* Policy: pulumi.String(snsTopicPolicy.ApplyT(func(snsTopicPolicy iam.GetPolicyDocumentResult) (*string, error) {
* return &snsTopicPolicy.Json, nil
* }).(pulumi.StringPtrOutput)),
* })
* 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.sns.Topic;
* import com.pulumi.aws.sns.TopicArgs;
* import com.pulumi.aws.iam.IamFunctions;
* import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
* import com.pulumi.aws.sns.TopicPolicy;
* import com.pulumi.aws.sns.TopicPolicyArgs;
* 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 = OrganizationsFunctions.getOrganization();
* var snsTopic = new Topic("snsTopic", TopicArgs.builder()
* .name("my-sns-topic")
* .build());
* final var snsTopicPolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
* .statements(GetPolicyDocumentStatementArgs.builder()
* .effect("Allow")
* .actions(
* "SNS:Subscribe",
* "SNS:Publish")
* .conditions(GetPolicyDocumentStatementConditionArgs.builder()
* .test("StringEquals")
* .variable("aws:PrincipalOrgID")
* .values(example.applyValue(getOrganizationResult -> getOrganizationResult.id()))
* .build())
* .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
* .type("AWS")
* .identifiers("*")
* .build())
* .resources(snsTopic.arn())
* .build())
* .build());
* var snsTopicPolicyTopicPolicy = new TopicPolicy("snsTopicPolicyTopicPolicy", TopicPolicyArgs.builder()
* .arn(snsTopic.arn())
* .policy(snsTopicPolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(snsTopicPolicy -> snsTopicPolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* snsTopic:
* type: aws:sns:Topic
* name: sns_topic
* properties:
* name: my-sns-topic
* snsTopicPolicyTopicPolicy:
* type: aws:sns:TopicPolicy
* name: sns_topic_policy
* properties:
* arn: ${snsTopic.arn}
* policy: ${snsTopicPolicy.json}
* variables:
* example:
* fn::invoke:
* Function: aws:organizations:getOrganization
* Arguments: {}
* snsTopicPolicy:
* fn::invoke:
* Function: aws:iam:getPolicyDocument
* Arguments:
* statements:
* - effect: Allow
* actions:
* - SNS:Subscribe
* - SNS:Publish
* conditions:
* - test: StringEquals
* variable: aws:PrincipalOrgID
* values:
* - ${example.id}
* principals:
* - type: AWS
* identifiers:
* - '*'
* resources:
* - ${snsTopic.arn}
* ```
*
* @param argument Get information about the organization that the user's account belongs to
* ## Example Usage
* ### List all account IDs for the organization
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = aws.organizations.getOrganization({});
* export const accountIds = example.then(example => example.accounts.map(__item => __item.id));
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.organizations.get_organization()
* pulumi.export("accountIds", [__item.id for __item in example.accounts])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = Aws.Organizations.GetOrganization.Invoke();
* return new Dictionary
* {
* ["accountIds"] = example.Apply(getOrganizationResult => getOrganizationResult.Accounts).Select(__item => __item.Id).ToList(),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := organizations.LookupOrganization(ctx, map[string]interface{}{
* }, nil);
* if err != nil {
* return err
* }
* ctx.Export("accountIds", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:3,11-33)))
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.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 example = OrganizationsFunctions.getOrganization();
* ctx.export("accountIds", example.applyValue(getOrganizationResult -> getOrganizationResult.accounts()).stream().map(element -> element.id()).collect(toList()));
* }
* }
* ```
*
* ### SNS topic that can be interacted by the organization only
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = aws.organizations.getOrganization({});
* const snsTopic = new aws.sns.Topic("sns_topic", {name: "my-sns-topic"});
* const snsTopicPolicy = pulumi.all([example, snsTopic.arn]).apply(([example, arn]) => aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* actions: [
* "SNS:Subscribe",
* "SNS:Publish",
* ],
* conditions: [{
* test: "StringEquals",
* variable: "aws:PrincipalOrgID",
* values: [example.id],
* }],
* principals: [{
* type: "AWS",
* identifiers: ["*"],
* }],
* resources: [arn],
* }],
* }));
* const snsTopicPolicyTopicPolicy = new aws.sns.TopicPolicy("sns_topic_policy", {
* arn: snsTopic.arn,
* policy: snsTopicPolicy.apply(snsTopicPolicy => snsTopicPolicy.json),
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.organizations.get_organization()
* sns_topic = aws.sns.Topic("sns_topic", name="my-sns-topic")
* sns_topic_policy = sns_topic.arn.apply(lambda arn: aws.iam.get_policy_document_output(statements=[{
* "effect": "Allow",
* "actions": [
* "SNS:Subscribe",
* "SNS:Publish",
* ],
* "conditions": [{
* "test": "StringEquals",
* "variable": "aws:PrincipalOrgID",
* "values": [example.id],
* }],
* "principals": [{
* "type": "AWS",
* "identifiers": ["*"],
* }],
* "resources": [arn],
* }]))
* sns_topic_policy_topic_policy = aws.sns.TopicPolicy("sns_topic_policy",
* arn=sns_topic.arn,
* policy=sns_topic_policy.json)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = Aws.Organizations.GetOrganization.Invoke();
* var snsTopic = new Aws.Sns.Topic("sns_topic", new()
* {
* Name = "my-sns-topic",
* });
* var snsTopicPolicy = Aws.Iam.GetPolicyDocument.Invoke(new()
* {
* Statements = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
* {
* Effect = "Allow",
* Actions = new[]
* {
* "SNS:Subscribe",
* "SNS:Publish",
* },
* Conditions = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
* {
* Test = "StringEquals",
* Variable = "aws:PrincipalOrgID",
* Values = new[]
* {
* example.Apply(getOrganizationResult => getOrganizationResult.Id),
* },
* },
* },
* Principals = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
* {
* Type = "AWS",
* Identifiers = new[]
* {
* "*",
* },
* },
* },
* Resources = new[]
* {
* snsTopic.Arn,
* },
* },
* },
* });
* var snsTopicPolicyTopicPolicy = new Aws.Sns.TopicPolicy("sns_topic_policy", new()
* {
* Arn = snsTopic.Arn,
* Policy = snsTopicPolicy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := organizations.LookupOrganization(ctx, map[string]interface{}{
* }, nil);
* if err != nil {
* return err
* }
* snsTopic, err := sns.NewTopic(ctx, "sns_topic", &sns.TopicArgs{
* Name: pulumi.String("my-sns-topic"),
* })
* if err != nil {
* return err
* }
* snsTopicPolicy := snsTopic.Arn.ApplyT(func(arn string) (iam.GetPolicyDocumentResult, error) {
* return iam.GetPolicyDocumentResult(interface{}(iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
* Statements: []iam.GetPolicyDocumentStatement{
* {
* Effect: "Allow",
* Actions: []string{
* "SNS:Subscribe",
* "SNS:Publish",
* },
* Conditions: []iam.GetPolicyDocumentStatementCondition{
* {
* Test: "StringEquals",
* Variable: "aws:PrincipalOrgID",
* Values: interface{}{
* example.Id,
* },
* },
* },
* Principals: []iam.GetPolicyDocumentStatementPrincipal{
* {
* Type: "AWS",
* Identifiers: []string{
* "*",
* },
* },
* },
* Resources: interface{}{
* arn,
* },
* },
* },
* }, nil))), nil
* }).(iam.GetPolicyDocumentResultOutput)
* _, err = sns.NewTopicPolicy(ctx, "sns_topic_policy", &sns.TopicPolicyArgs{
* Arn: snsTopic.Arn,
* Policy: pulumi.String(snsTopicPolicy.ApplyT(func(snsTopicPolicy iam.GetPolicyDocumentResult) (*string, error) {
* return &snsTopicPolicy.Json, nil
* }).(pulumi.StringPtrOutput)),
* })
* 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.sns.Topic;
* import com.pulumi.aws.sns.TopicArgs;
* import com.pulumi.aws.iam.IamFunctions;
* import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
* import com.pulumi.aws.sns.TopicPolicy;
* import com.pulumi.aws.sns.TopicPolicyArgs;
* 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 = OrganizationsFunctions.getOrganization();
* var snsTopic = new Topic("snsTopic", TopicArgs.builder()
* .name("my-sns-topic")
* .build());
* final var snsTopicPolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
* .statements(GetPolicyDocumentStatementArgs.builder()
* .effect("Allow")
* .actions(
* "SNS:Subscribe",
* "SNS:Publish")
* .conditions(GetPolicyDocumentStatementConditionArgs.builder()
* .test("StringEquals")
* .variable("aws:PrincipalOrgID")
* .values(example.applyValue(getOrganizationResult -> getOrganizationResult.id()))
* .build())
* .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
* .type("AWS")
* .identifiers("*")
* .build())
* .resources(snsTopic.arn())
* .build())
* .build());
* var snsTopicPolicyTopicPolicy = new TopicPolicy("snsTopicPolicyTopicPolicy", TopicPolicyArgs.builder()
* .arn(snsTopic.arn())
* .policy(snsTopicPolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(snsTopicPolicy -> snsTopicPolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* snsTopic:
* type: aws:sns:Topic
* name: sns_topic
* properties:
* name: my-sns-topic
* snsTopicPolicyTopicPolicy:
* type: aws:sns:TopicPolicy
* name: sns_topic_policy
* properties:
* arn: ${snsTopic.arn}
* policy: ${snsTopicPolicy.json}
* variables:
* example:
* fn::invoke:
* Function: aws:organizations:getOrganization
* Arguments: {}
* snsTopicPolicy:
* fn::invoke:
* Function: aws:iam:getPolicyDocument
* Arguments:
* statements:
* - effect: Allow
* actions:
* - SNS:Subscribe
* - SNS:Publish
* conditions:
* - test: StringEquals
* variable: aws:PrincipalOrgID
* values:
* - ${example.id}
* principals:
* - type: AWS
* identifiers:
* - '*'
* resources:
* - ${snsTopic.arn}
* ```
*
* @return A collection of values returned by getOrganization.
*/
public suspend fun getOrganization(): GetOrganizationResult =
getOrganizationResultToKotlin(getOrganizationPlain().await())
/**
* Data source for getting an AWS Organizations Organizational Unit.
* ## Example Usage
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const org = aws.organizations.getOrganization({});
* const ou = org.then(org => aws.organizations.getOrganizationalUnit({
* parentId: org.roots?.[0]?.id,
* name: "dev",
* }));
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* org = aws.organizations.get_organization()
* ou = aws.organizations.get_organizational_unit(parent_id=org.roots[0].id,
* name="dev")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var org = Aws.Organizations.GetOrganization.Invoke();
* var ou = Aws.Organizations.GetOrganizationalUnit.Invoke(new()
* {
* ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
* Name = "dev",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* org, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
* if err != nil {
* return err
* }
* _, err = organizations.LookupOrganizationalUnit(ctx, &organizations.LookupOrganizationalUnitArgs{
* ParentId: org.Roots[0].Id,
* Name: "dev",
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetOrganizationalUnitArgs;
* 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();
* final var ou = OrganizationsFunctions.getOrganizationalUnit(GetOrganizationalUnitArgs.builder()
* .parentId(org.applyValue(getOrganizationResult -> getOrganizationResult.roots()[0].id()))
* .name("dev")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* org:
* fn::invoke:
* Function: aws:organizations:getOrganization
* Arguments: {}
* ou:
* fn::invoke:
* Function: aws:organizations:getOrganizationalUnit
* Arguments:
* parentId: ${org.roots[0].id}
* name: dev
* ```
*
* @param argument A collection of arguments for invoking getOrganizationalUnit.
* @return A collection of values returned by getOrganizationalUnit.
*/
public suspend fun getOrganizationalUnit(argument: GetOrganizationalUnitPlainArgs): GetOrganizationalUnitResult =
getOrganizationalUnitResultToKotlin(getOrganizationalUnitPlain(argument.toJava()).await())
/**
* @see [getOrganizationalUnit].
* @param name Name of the organizational unit
* @param parentId Parent ID of the organizational unit.
* @return A collection of values returned by getOrganizationalUnit.
*/
public suspend fun getOrganizationalUnit(name: String, parentId: String): GetOrganizationalUnitResult {
val argument = GetOrganizationalUnitPlainArgs(
name = name,
parentId = parentId,
)
return getOrganizationalUnitResultToKotlin(getOrganizationalUnitPlain(argument.toJava()).await())
}
/**
* @see [getOrganizationalUnit].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitPlainArgs].
* @return A collection of values returned by getOrganizationalUnit.
*/
public suspend fun getOrganizationalUnit(argument: suspend GetOrganizationalUnitPlainArgsBuilder.() -> Unit): GetOrganizationalUnitResult {
val builder = GetOrganizationalUnitPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getOrganizationalUnitResultToKotlin(getOrganizationalUnitPlain(builtArgument.toJava()).await())
}
/**
* Get all direct child accounts under a parent organizational unit. This only provides immediate children, not all children.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const org = aws.organizations.getOrganization({});
* const accounts = org.then(org => aws.organizations.getOrganizationalUnitChildAccounts({
* parentId: org.roots?.[0]?.id,
* }));
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* org = aws.organizations.get_organization()
* accounts = aws.organizations.get_organizational_unit_child_accounts(parent_id=org.roots[0].id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var org = Aws.Organizations.GetOrganization.Invoke();
* var accounts = Aws.Organizations.GetOrganizationalUnitChildAccounts.Invoke(new()
* {
* ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* org, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
* if err != nil {
* return err
* }
* _, err = organizations.GetOrganizationalUnitChildAccounts(ctx, &organizations.GetOrganizationalUnitChildAccountsArgs{
* ParentId: org.Roots[0].Id,
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetOrganizationalUnitChildAccountsArgs;
* 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();
* final var accounts = OrganizationsFunctions.getOrganizationalUnitChildAccounts(GetOrganizationalUnitChildAccountsArgs.builder()
* .parentId(org.applyValue(getOrganizationResult -> getOrganizationResult.roots()[0].id()))
* .build());
* }
* }
* ```
* ```yaml
* variables:
* org:
* fn::invoke:
* Function: aws:organizations:getOrganization
* Arguments: {}
* accounts:
* fn::invoke:
* Function: aws:organizations:getOrganizationalUnitChildAccounts
* Arguments:
* parentId: ${org.roots[0].id}
* ```
*
* @param argument A collection of arguments for invoking getOrganizationalUnitChildAccounts.
* @return A collection of values returned by getOrganizationalUnitChildAccounts.
*/
public suspend fun getOrganizationalUnitChildAccounts(argument: GetOrganizationalUnitChildAccountsPlainArgs): GetOrganizationalUnitChildAccountsResult =
getOrganizationalUnitChildAccountsResultToKotlin(getOrganizationalUnitChildAccountsPlain(argument.toJava()).await())
/**
* @see [getOrganizationalUnitChildAccounts].
* @param parentId The parent ID of the accounts.
* @return A collection of values returned by getOrganizationalUnitChildAccounts.
*/
public suspend fun getOrganizationalUnitChildAccounts(parentId: String): GetOrganizationalUnitChildAccountsResult {
val argument = GetOrganizationalUnitChildAccountsPlainArgs(
parentId = parentId,
)
return getOrganizationalUnitChildAccountsResultToKotlin(getOrganizationalUnitChildAccountsPlain(argument.toJava()).await())
}
/**
* @see [getOrganizationalUnitChildAccounts].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitChildAccountsPlainArgs].
* @return A collection of values returned by getOrganizationalUnitChildAccounts.
*/
public suspend fun getOrganizationalUnitChildAccounts(argument: suspend GetOrganizationalUnitChildAccountsPlainArgsBuilder.() -> Unit): GetOrganizationalUnitChildAccountsResult {
val builder = GetOrganizationalUnitChildAccountsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getOrganizationalUnitChildAccountsResultToKotlin(getOrganizationalUnitChildAccountsPlain(builtArgument.toJava()).await())
}
/**
* Get all direct child accounts under a parent organizational unit. This provides all children.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const org = aws.organizations.getOrganization({});
* const accounts = org.then(org => aws.organizations.getOrganizationalUnitDescendantAccounts({
* parentId: org.roots?.[0]?.id,
* }));
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* org = aws.organizations.get_organization()
* accounts = aws.organizations.get_organizational_unit_descendant_accounts(parent_id=org.roots[0].id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var org = Aws.Organizations.GetOrganization.Invoke();
* var accounts = Aws.Organizations.GetOrganizationalUnitDescendantAccounts.Invoke(new()
* {
* ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* org, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
* if err != nil {
* return err
* }
* _, err = organizations.GetOrganizationalUnitDescendantAccounts(ctx, &organizations.GetOrganizationalUnitDescendantAccountsArgs{
* ParentId: org.Roots[0].Id,
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetOrganizationalUnitDescendantAccountsArgs;
* 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();
* final var accounts = OrganizationsFunctions.getOrganizationalUnitDescendantAccounts(GetOrganizationalUnitDescendantAccountsArgs.builder()
* .parentId(org.applyValue(getOrganizationResult -> getOrganizationResult.roots()[0].id()))
* .build());
* }
* }
* ```
* ```yaml
* variables:
* org:
* fn::invoke:
* Function: aws:organizations:getOrganization
* Arguments: {}
* accounts:
* fn::invoke:
* Function: aws:organizations:getOrganizationalUnitDescendantAccounts
* Arguments:
* parentId: ${org.roots[0].id}
* ```
*
* @param argument A collection of arguments for invoking getOrganizationalUnitDescendantAccounts.
* @return A collection of values returned by getOrganizationalUnitDescendantAccounts.
*/
public suspend fun getOrganizationalUnitDescendantAccounts(argument: GetOrganizationalUnitDescendantAccountsPlainArgs): GetOrganizationalUnitDescendantAccountsResult =
getOrganizationalUnitDescendantAccountsResultToKotlin(getOrganizationalUnitDescendantAccountsPlain(argument.toJava()).await())
/**
* @see [getOrganizationalUnitDescendantAccounts].
* @param parentId The parent ID of the accounts.
* @return A collection of values returned by getOrganizationalUnitDescendantAccounts.
*/
public suspend fun getOrganizationalUnitDescendantAccounts(parentId: String): GetOrganizationalUnitDescendantAccountsResult {
val argument = GetOrganizationalUnitDescendantAccountsPlainArgs(
parentId = parentId,
)
return getOrganizationalUnitDescendantAccountsResultToKotlin(getOrganizationalUnitDescendantAccountsPlain(argument.toJava()).await())
}
/**
* @see [getOrganizationalUnitDescendantAccounts].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitDescendantAccountsPlainArgs].
* @return A collection of values returned by getOrganizationalUnitDescendantAccounts.
*/
public suspend fun getOrganizationalUnitDescendantAccounts(argument: suspend GetOrganizationalUnitDescendantAccountsPlainArgsBuilder.() -> Unit): GetOrganizationalUnitDescendantAccountsResult {
val builder = GetOrganizationalUnitDescendantAccountsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getOrganizationalUnitDescendantAccountsResultToKotlin(getOrganizationalUnitDescendantAccountsPlain(builtArgument.toJava()).await())
}
/**
* Get all direct child organizational units under a parent organizational unit. This provides all children.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const org = aws.organizations.getOrganization({});
* const ous = org.then(org => aws.organizations.getOrganizationalUnitDescendantOrganizationalUnits({
* parentId: org.roots?.[0]?.id,
* }));
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* org = aws.organizations.get_organization()
* ous = aws.organizations.get_organizational_unit_descendant_organizational_units(parent_id=org.roots[0].id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var org = Aws.Organizations.GetOrganization.Invoke();
* var ous = Aws.Organizations.GetOrganizationalUnitDescendantOrganizationalUnits.Invoke(new()
* {
* ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* org, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
* if err != nil {
* return err
* }
* _, err = organizations.GetOrganizationalUnitDescendantOrganizationalUnits(ctx, &organizations.GetOrganizationalUnitDescendantOrganizationalUnitsArgs{
* ParentId: org.Roots[0].Id,
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetOrganizationalUnitDescendantOrganizationalUnitsArgs;
* 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();
* final var ous = OrganizationsFunctions.getOrganizationalUnitDescendantOrganizationalUnits(GetOrganizationalUnitDescendantOrganizationalUnitsArgs.builder()
* .parentId(org.applyValue(getOrganizationResult -> getOrganizationResult.roots()[0].id()))
* .build());
* }
* }
* ```
* ```yaml
* variables:
* org:
* fn::invoke:
* Function: aws:organizations:getOrganization
* Arguments: {}
* ous:
* fn::invoke:
* Function: aws:organizations:getOrganizationalUnitDescendantOrganizationalUnits
* Arguments:
* parentId: ${org.roots[0].id}
* ```
*
* @param argument A collection of arguments for invoking getOrganizationalUnitDescendantOrganizationalUnits.
* @return A collection of values returned by getOrganizationalUnitDescendantOrganizationalUnits.
*/
public suspend fun getOrganizationalUnitDescendantOrganizationalUnits(argument: GetOrganizationalUnitDescendantOrganizationalUnitsPlainArgs): GetOrganizationalUnitDescendantOrganizationalUnitsResult =
getOrganizationalUnitDescendantOrganizationalUnitsResultToKotlin(getOrganizationalUnitDescendantOrganizationalUnitsPlain(argument.toJava()).await())
/**
* @see [getOrganizationalUnitDescendantOrganizationalUnits].
* @param parentId Parent ID of the organizational unit.
* @return A collection of values returned by getOrganizationalUnitDescendantOrganizationalUnits.
*/
public suspend fun getOrganizationalUnitDescendantOrganizationalUnits(parentId: String): GetOrganizationalUnitDescendantOrganizationalUnitsResult {
val argument = GetOrganizationalUnitDescendantOrganizationalUnitsPlainArgs(
parentId = parentId,
)
return getOrganizationalUnitDescendantOrganizationalUnitsResultToKotlin(getOrganizationalUnitDescendantOrganizationalUnitsPlain(argument.toJava()).await())
}
/**
* @see [getOrganizationalUnitDescendantOrganizationalUnits].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitDescendantOrganizationalUnitsPlainArgs].
* @return A collection of values returned by getOrganizationalUnitDescendantOrganizationalUnits.
*/
public suspend fun getOrganizationalUnitDescendantOrganizationalUnits(argument: suspend GetOrganizationalUnitDescendantOrganizationalUnitsPlainArgsBuilder.() -> Unit): GetOrganizationalUnitDescendantOrganizationalUnitsResult {
val builder = GetOrganizationalUnitDescendantOrganizationalUnitsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getOrganizationalUnitDescendantOrganizationalUnitsResultToKotlin(getOrganizationalUnitDescendantOrganizationalUnitsPlain(builtArgument.toJava()).await())
}
/**
* Get all direct child organizational units under a parent organizational unit. This only provides immediate children, not all children.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const org = aws.organizations.getOrganization({});
* const ou = org.then(org => aws.organizations.getOrganizationalUnits({
* parentId: org.roots?.[0]?.id,
* }));
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* org = aws.organizations.get_organization()
* ou = aws.organizations.get_organizational_units(parent_id=org.roots[0].id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var org = Aws.Organizations.GetOrganization.Invoke();
* var ou = Aws.Organizations.GetOrganizationalUnits.Invoke(new()
* {
* ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* org, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
* if err != nil {
* return err
* }
* _, err = organizations.GetOrganizationalUnits(ctx, &organizations.GetOrganizationalUnitsArgs{
* ParentId: org.Roots[0].Id,
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetOrganizationalUnitsArgs;
* 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();
* final var ou = OrganizationsFunctions.getOrganizationalUnits(GetOrganizationalUnitsArgs.builder()
* .parentId(org.applyValue(getOrganizationResult -> getOrganizationResult.roots()[0].id()))
* .build());
* }
* }
* ```
* ```yaml
* variables:
* org:
* fn::invoke:
* Function: aws:organizations:getOrganization
* Arguments: {}
* ou:
* fn::invoke:
* Function: aws:organizations:getOrganizationalUnits
* Arguments:
* parentId: ${org.roots[0].id}
* ```
*
* @param argument A collection of arguments for invoking getOrganizationalUnits.
* @return A collection of values returned by getOrganizationalUnits.
*/
public suspend fun getOrganizationalUnits(argument: GetOrganizationalUnitsPlainArgs): GetOrganizationalUnitsResult =
getOrganizationalUnitsResultToKotlin(getOrganizationalUnitsPlain(argument.toJava()).await())
/**
* @see [getOrganizationalUnits].
* @param parentId Parent ID of the organizational unit.
* @return A collection of values returned by getOrganizationalUnits.
*/
public suspend fun getOrganizationalUnits(parentId: String): GetOrganizationalUnitsResult {
val argument = GetOrganizationalUnitsPlainArgs(
parentId = parentId,
)
return getOrganizationalUnitsResultToKotlin(getOrganizationalUnitsPlain(argument.toJava()).await())
}
/**
* @see [getOrganizationalUnits].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetOrganizationalUnitsPlainArgs].
* @return A collection of values returned by getOrganizationalUnits.
*/
public suspend fun getOrganizationalUnits(argument: suspend GetOrganizationalUnitsPlainArgsBuilder.() -> Unit): GetOrganizationalUnitsResult {
val builder = GetOrganizationalUnitsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getOrganizationalUnitsResultToKotlin(getOrganizationalUnitsPlain(builtArgument.toJava()).await())
}
/**
* Data source for managing an AWS Organizations Policies.
* ## Example Usage
* @param argument A collection of arguments for invoking getPolicies.
* @return A collection of values returned by getPolicies.
*/
public suspend fun getPolicies(argument: GetPoliciesPlainArgs): GetPoliciesResult =
getPoliciesResultToKotlin(getPoliciesPlain(argument.toJava()).await())
/**
* @see [getPolicies].
* @param filter The type of policies to be returned in the response. Valid values are `AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY`
* @return A collection of values returned by getPolicies.
*/
public suspend fun getPolicies(filter: String): GetPoliciesResult {
val argument = GetPoliciesPlainArgs(
filter = filter,
)
return getPoliciesResultToKotlin(getPoliciesPlain(argument.toJava()).await())
}
/**
* @see [getPolicies].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetPoliciesPlainArgs].
* @return A collection of values returned by getPolicies.
*/
public suspend fun getPolicies(argument: suspend GetPoliciesPlainArgsBuilder.() -> Unit): GetPoliciesResult {
val builder = GetPoliciesPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getPoliciesResultToKotlin(getPoliciesPlain(builtArgument.toJava()).await())
}
/**
* Data source for managing an AWS Organizations Policies For Target.
* ## Example Usage
* @param argument A collection of arguments for invoking getPoliciesForTarget.
* @return A collection of values returned by getPoliciesForTarget.
*/
public suspend fun getPoliciesForTarget(argument: GetPoliciesForTargetPlainArgs): GetPoliciesForTargetResult =
getPoliciesForTargetResultToKotlin(getPoliciesForTargetPlain(argument.toJava()).await())
/**
* @see [getPoliciesForTarget].
* @param filter Must supply one of the 5 different policy filters for a target (AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY)
* @param targetId The root (string that begins with "r-" followed by 4-32 lowercase letters or digits), account (12 digit string), or Organizational Unit (string starting with "ou-" followed by 4-32 lowercase letters or digits. This string is followed by a second "-" dash and from 8-32 additional lowercase letters or digits.)
* @return A collection of values returned by getPoliciesForTarget.
*/
public suspend fun getPoliciesForTarget(filter: String, targetId: String): GetPoliciesForTargetResult {
val argument = GetPoliciesForTargetPlainArgs(
filter = filter,
targetId = targetId,
)
return getPoliciesForTargetResultToKotlin(getPoliciesForTargetPlain(argument.toJava()).await())
}
/**
* @see [getPoliciesForTarget].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetPoliciesForTargetPlainArgs].
* @return A collection of values returned by getPoliciesForTarget.
*/
public suspend fun getPoliciesForTarget(argument: suspend GetPoliciesForTargetPlainArgsBuilder.() -> Unit): GetPoliciesForTargetResult {
val builder = GetPoliciesForTargetPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getPoliciesForTargetResultToKotlin(getPoliciesForTargetPlain(builtArgument.toJava()).await())
}
/**
* Data source for managing an AWS Organizations Policy.
* ## Example Usage
* @param argument A collection of arguments for invoking getPolicy.
* @return A collection of values returned by getPolicy.
*/
public suspend fun getPolicy(argument: GetPolicyPlainArgs): GetPolicyResult =
getPolicyResultToKotlin(getPolicyPlain(argument.toJava()).await())
/**
* @see [getPolicy].
* @param policyId The unique identifier (ID) of the policy that you want more details on. Policy id starts with a "p-" followed by 8-28 lowercase or uppercase letters, digits, and underscores.
* @return A collection of values returned by getPolicy.
*/
public suspend fun getPolicy(policyId: String): GetPolicyResult {
val argument = GetPolicyPlainArgs(
policyId = policyId,
)
return getPolicyResultToKotlin(getPolicyPlain(argument.toJava()).await())
}
/**
* @see [getPolicy].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetPolicyPlainArgs].
* @return A collection of values returned by getPolicy.
*/
public suspend fun getPolicy(argument: suspend GetPolicyPlainArgsBuilder.() -> Unit): GetPolicyResult {
val builder = GetPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getPolicyResultToKotlin(getPolicyPlain(builtArgument.toJava()).await())
}
/**
* Get tags attached to the specified AWS Organizations resource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const account = aws.organizations.getResourceTags({
* resourceId: "123456123846",
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* account = aws.organizations.get_resource_tags(resource_id="123456123846")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var account = Aws.Organizations.GetResourceTags.Invoke(new()
* {
* ResourceId = "123456123846",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := organizations.GetResourceTags(ctx, &organizations.GetResourceTagsArgs{
* ResourceId: "123456123846",
* }, 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.aws.organizations.OrganizationsFunctions;
* import com.pulumi.aws.organizations.inputs.GetResourceTagsArgs;
* 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 account = OrganizationsFunctions.getResourceTags(GetResourceTagsArgs.builder()
* .resourceId("123456123846")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* account:
* fn::invoke:
* Function: aws:organizations:getResourceTags
* Arguments:
* resourceId: '123456123846'
* ```
*
* @param argument A collection of arguments for invoking getResourceTags.
* @return A collection of values returned by getResourceTags.
*/
public suspend fun getResourceTags(argument: GetResourceTagsPlainArgs): GetResourceTagsResult =
getResourceTagsResultToKotlin(getResourceTagsPlain(argument.toJava()).await())
/**
* @see [getResourceTags].
* @param resourceId ID of the resource with the tags to list. See details below.
* @param tags Map of key=value pairs for each tag set on the resource.
* @return A collection of values returned by getResourceTags.
*/
public suspend fun getResourceTags(resourceId: String, tags: Map? = null): GetResourceTagsResult {
val argument = GetResourceTagsPlainArgs(
resourceId = resourceId,
tags = tags,
)
return getResourceTagsResultToKotlin(getResourceTagsPlain(argument.toJava()).await())
}
/**
* @see [getResourceTags].
* @param argument Builder for [com.pulumi.aws.organizations.kotlin.inputs.GetResourceTagsPlainArgs].
* @return A collection of values returned by getResourceTags.
*/
public suspend fun getResourceTags(argument: suspend GetResourceTagsPlainArgsBuilder.() -> Unit): GetResourceTagsResult {
val builder = GetResourceTagsPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getResourceTagsResultToKotlin(getResourceTagsPlain(builtArgument.toJava()).await())
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy