1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. rdc
  5. getOrganizations
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.rdc.getOrganizations

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    This data source provides the Rdc Organizations of the current Alibaba Cloud user.

    NOTE: Available in v1.137.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-testAccOrganizations-Organizations";
    const _default = new alicloud.rdc.Organization("default", {
        organizationName: name,
        source: name,
    });
    const ids = alicloud.rdc.getOrganizationsOutput({
        ids: [_default.id],
    });
    export const rdcOrganizationId1 = ids.apply(ids => ids.id);
    const nameRegex = alicloud.rdc.getOrganizations({
        nameRegex: "^my-Organization",
    });
    export const rdcOrganizationId2 = nameRegex.then(nameRegex => nameRegex.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-testAccOrganizations-Organizations"
    default = alicloud.rdc.Organization("default",
        organization_name=name,
        source=name)
    ids = alicloud.rdc.get_organizations_output(ids=[default.id])
    pulumi.export("rdcOrganizationId1", ids.id)
    name_regex = alicloud.rdc.get_organizations(name_regex="^my-Organization")
    pulumi.export("rdcOrganizationId2", name_regex.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rdc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-testAccOrganizations-Organizations"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := rdc.NewOrganization(ctx, "default", &rdc.OrganizationArgs{
    			OrganizationName: pulumi.String(name),
    			Source:           pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		ids := rdc.GetOrganizationsOutput(ctx, rdc.GetOrganizationsOutputArgs{
    			Ids: pulumi.StringArray{
    				_default.ID(),
    			},
    		}, nil)
    		ctx.Export("rdcOrganizationId1", ids.ApplyT(func(ids rdc.GetOrganizationsResult) (*string, error) {
    			return &ids.Id, nil
    		}).(pulumi.StringPtrOutput))
    		nameRegex, err := rdc.GetOrganizations(ctx, &rdc.GetOrganizationsArgs{
    			NameRegex: pulumi.StringRef("^my-Organization"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("rdcOrganizationId2", nameRegex.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-testAccOrganizations-Organizations";
        var @default = new AliCloud.Rdc.Organization("default", new()
        {
            OrganizationName = name,
            Source = name,
        });
    
        var ids = AliCloud.Rdc.GetOrganizations.Invoke(new()
        {
            Ids = new[]
            {
                @default.Id,
            },
        });
    
        var nameRegex = AliCloud.Rdc.GetOrganizations.Invoke(new()
        {
            NameRegex = "^my-Organization",
        });
    
        return new Dictionary<string, object?>
        {
            ["rdcOrganizationId1"] = ids.Apply(getOrganizationsResult => getOrganizationsResult.Id),
            ["rdcOrganizationId2"] = nameRegex.Apply(getOrganizationsResult => getOrganizationsResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.rdc.Organization;
    import com.pulumi.alicloud.rdc.OrganizationArgs;
    import com.pulumi.alicloud.rdc.RdcFunctions;
    import com.pulumi.alicloud.rdc.inputs.GetOrganizationsArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("tf-testAccOrganizations-Organizations");
            var default_ = new Organization("default", OrganizationArgs.builder()
                .organizationName(name)
                .source(name)
                .build());
    
            final var ids = RdcFunctions.getOrganizations(GetOrganizationsArgs.builder()
                .ids(default_.id())
                .build());
    
            ctx.export("rdcOrganizationId1", ids.applyValue(getOrganizationsResult -> getOrganizationsResult).applyValue(ids -> ids.applyValue(getOrganizationsResult -> getOrganizationsResult.id())));
            final var nameRegex = RdcFunctions.getOrganizations(GetOrganizationsArgs.builder()
                .nameRegex("^my-Organization")
                .build());
    
            ctx.export("rdcOrganizationId2", nameRegex.applyValue(getOrganizationsResult -> getOrganizationsResult.id()));
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-testAccOrganizations-Organizations
    resources:
      default:
        type: alicloud:rdc:Organization
        properties:
          organizationName: ${name}
          source: ${name}
    variables:
      ids:
        fn::invoke:
          Function: alicloud:rdc:getOrganizations
          Arguments:
            ids:
              - ${default.id}
      nameRegex:
        fn::invoke:
          Function: alicloud:rdc:getOrganizations
          Arguments:
            nameRegex: ^my-Organization
    outputs:
      rdcOrganizationId1: ${ids.id}
      rdcOrganizationId2: ${nameRegex.id}
    

    Using getOrganizations

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getOrganizations(args: GetOrganizationsArgs, opts?: InvokeOptions): Promise<GetOrganizationsResult>
    function getOrganizationsOutput(args: GetOrganizationsOutputArgs, opts?: InvokeOptions): Output<GetOrganizationsResult>
    def get_organizations(ids: Optional[Sequence[str]] = None,
                          name_regex: Optional[str] = None,
                          output_file: Optional[str] = None,
                          real_pk: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetOrganizationsResult
    def get_organizations_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                          name_regex: Optional[pulumi.Input[str]] = None,
                          output_file: Optional[pulumi.Input[str]] = None,
                          real_pk: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationsResult]
    func GetOrganizations(ctx *Context, args *GetOrganizationsArgs, opts ...InvokeOption) (*GetOrganizationsResult, error)
    func GetOrganizationsOutput(ctx *Context, args *GetOrganizationsOutputArgs, opts ...InvokeOption) GetOrganizationsResultOutput

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

    public static class GetOrganizations 
    {
        public static Task<GetOrganizationsResult> InvokeAsync(GetOrganizationsArgs args, InvokeOptions? opts = null)
        public static Output<GetOrganizationsResult> Invoke(GetOrganizationsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetOrganizationsResult> getOrganizations(GetOrganizationsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:rdc/getOrganizations:getOrganizations
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of Organization IDs.
    NameRegex string
    A regex string to filter results by Organization name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RealPk string
    User pk, not required, only required when the ak used by the calling interface is inconsistent with the user pk
    Ids []string
    A list of Organization IDs.
    NameRegex string
    A regex string to filter results by Organization name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RealPk string
    User pk, not required, only required when the ak used by the calling interface is inconsistent with the user pk
    ids List<String>
    A list of Organization IDs.
    nameRegex String
    A regex string to filter results by Organization name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    realPk String
    User pk, not required, only required when the ak used by the calling interface is inconsistent with the user pk
    ids string[]
    A list of Organization IDs.
    nameRegex string
    A regex string to filter results by Organization name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    realPk string
    User pk, not required, only required when the ak used by the calling interface is inconsistent with the user pk
    ids Sequence[str]
    A list of Organization IDs.
    name_regex str
    A regex string to filter results by Organization name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    real_pk str
    User pk, not required, only required when the ak used by the calling interface is inconsistent with the user pk
    ids List<String>
    A list of Organization IDs.
    nameRegex String
    A regex string to filter results by Organization name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    realPk String
    User pk, not required, only required when the ak used by the calling interface is inconsistent with the user pk

    getOrganizations Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    Organizations List<Pulumi.AliCloud.Rdc.Outputs.GetOrganizationsOrganization>
    NameRegex string
    OutputFile string
    RealPk string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    Organizations []GetOrganizationsOrganization
    NameRegex string
    OutputFile string
    RealPk string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    organizations List<GetOrganizationsOrganization>
    nameRegex String
    outputFile String
    realPk String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    organizations GetOrganizationsOrganization[]
    nameRegex string
    outputFile string
    realPk string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    organizations Sequence[GetOrganizationsOrganization]
    name_regex str
    output_file str
    real_pk str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    organizations List<Property Map>
    nameRegex String
    outputFile String
    realPk String

    Supporting Types

    GetOrganizationsOrganization

    Id string
    The ID of the Organization.
    OrganizationId string
    The first ID of the resource.
    OrganizationName string
    Company name.
    Id string
    The ID of the Organization.
    OrganizationId string
    The first ID of the resource.
    OrganizationName string
    Company name.
    id String
    The ID of the Organization.
    organizationId String
    The first ID of the resource.
    organizationName String
    Company name.
    id string
    The ID of the Organization.
    organizationId string
    The first ID of the resource.
    organizationName string
    Company name.
    id str
    The ID of the Organization.
    organization_id str
    The first ID of the resource.
    organization_name str
    Company name.
    id String
    The ID of the Organization.
    organizationId String
    The first ID of the resource.
    organizationName String
    Company name.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi