1. Packages
  2. Linode
  3. API Docs
  4. getChildAccounts
Linode v4.21.0 published on Friday, Jun 7, 2024 by Pulumi

linode.getChildAccounts

Explore with Pulumi AI

linode logo
Linode v4.21.0 published on Friday, Jun 7, 2024 by Pulumi

    Provides information about Linode Child Accounts that match a set of filters.

    Example Usage

    The following example shows how one might use this data source to access Child Accounts under the current Account.

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const all = linode.getChildAccounts({});
    const filtered = linode.getChildAccounts({
        filters: [
            {
                name: "email",
                values: ["example@linode.com"],
            },
            {
                name: "first_name",
                values: ["John"],
            },
            {
                name: "last_name",
                values: ["Smith"],
            },
        ],
    });
    export const allAccounts = all.then(all => all.childAccounts.map(__item => __item.euuid));
    export const filteredAccounts = filtered.then(filtered => filtered.childAccounts.map(__item => __item.euuid));
    
    import pulumi
    import pulumi_linode as linode
    
    all = linode.get_child_accounts()
    filtered = linode.get_child_accounts(filters=[
        linode.GetChildAccountsFilterArgs(
            name="email",
            values=["example@linode.com"],
        ),
        linode.GetChildAccountsFilterArgs(
            name="first_name",
            values=["John"],
        ),
        linode.GetChildAccountsFilterArgs(
            name="last_name",
            values=["Smith"],
        ),
    ])
    pulumi.export("allAccounts", [__item.euuid for __item in all.child_accounts])
    pulumi.export("filteredAccounts", [__item.euuid for __item in filtered.child_accounts])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		all, err := linode.GetChildAccounts(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		filtered, err := linode.GetChildAccounts(ctx, &linode.GetChildAccountsArgs{
    			Filters: []linode.GetChildAccountsFilter{
    				{
    					Name: "email",
    					Values: []string{
    						"example@linode.com",
    					},
    				},
    				{
    					Name: "first_name",
    					Values: []string{
    						"John",
    					},
    				},
    				{
    					Name: "last_name",
    					Values: []string{
    						"Smith",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		var splat0 []*string
    		for _, val0 := range all.ChildAccounts {
    			splat0 = append(splat0, val0.Euuid)
    		}
    		ctx.Export("allAccounts", splat0)
    		var splat1 []*string
    		for _, val0 := range filtered.ChildAccounts {
    			splat1 = append(splat1, val0.Euuid)
    		}
    		ctx.Export("filteredAccounts", splat1)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Linode.GetChildAccounts.Invoke();
    
        var filtered = Linode.GetChildAccounts.Invoke(new()
        {
            Filters = new[]
            {
                new Linode.Inputs.GetChildAccountsFilterInputArgs
                {
                    Name = "email",
                    Values = new[]
                    {
                        "example@linode.com",
                    },
                },
                new Linode.Inputs.GetChildAccountsFilterInputArgs
                {
                    Name = "first_name",
                    Values = new[]
                    {
                        "John",
                    },
                },
                new Linode.Inputs.GetChildAccountsFilterInputArgs
                {
                    Name = "last_name",
                    Values = new[]
                    {
                        "Smith",
                    },
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["allAccounts"] = all.Apply(getChildAccountsResult => getChildAccountsResult.ChildAccounts).Select(__item => __item.Euuid).ToList(),
            ["filteredAccounts"] = filtered.Apply(getChildAccountsResult => getChildAccountsResult.ChildAccounts).Select(__item => __item.Euuid).ToList(),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.LinodeFunctions;
    import com.pulumi.linode.inputs.GetChildAccountsArgs;
    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 all = LinodeFunctions.getChildAccounts();
    
            final var filtered = LinodeFunctions.getChildAccounts(GetChildAccountsArgs.builder()
                .filters(            
                    GetChildAccountsFilterArgs.builder()
                        .name("email")
                        .values("example@linode.com")
                        .build(),
                    GetChildAccountsFilterArgs.builder()
                        .name("first_name")
                        .values("John")
                        .build(),
                    GetChildAccountsFilterArgs.builder()
                        .name("last_name")
                        .values("Smith")
                        .build())
                .build());
    
            ctx.export("allAccounts", all.applyValue(getChildAccountsResult -> getChildAccountsResult.childAccounts()).stream().map(element -> element.euuid()).collect(toList()));
            ctx.export("filteredAccounts", filtered.applyValue(getChildAccountsResult -> getChildAccountsResult.childAccounts()).stream().map(element -> element.euuid()).collect(toList()));
        }
    }
    
    Coming soon!
    

    Filterable Fields

    • euuid

    • email

    • first_name

    • last_name

    • company

    • address_1

    • address_2

    • phone

    • city

    • state

    • country

    • zip

    • capabilities

    • active_since

    Using getChildAccounts

    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 getChildAccounts(args: GetChildAccountsArgs, opts?: InvokeOptions): Promise<GetChildAccountsResult>
    function getChildAccountsOutput(args: GetChildAccountsOutputArgs, opts?: InvokeOptions): Output<GetChildAccountsResult>
    def get_child_accounts(child_accounts: Optional[Sequence[GetChildAccountsChildAccount]] = None,
                           filters: Optional[Sequence[GetChildAccountsFilter]] = None,
                           opts: Optional[InvokeOptions] = None) -> GetChildAccountsResult
    def get_child_accounts_output(child_accounts: Optional[pulumi.Input[Sequence[pulumi.Input[GetChildAccountsChildAccountArgs]]]] = None,
                           filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetChildAccountsFilterArgs]]]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetChildAccountsResult]
    func GetChildAccounts(ctx *Context, args *GetChildAccountsArgs, opts ...InvokeOption) (*GetChildAccountsResult, error)
    func GetChildAccountsOutput(ctx *Context, args *GetChildAccountsOutputArgs, opts ...InvokeOption) GetChildAccountsResultOutput

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

    public static class GetChildAccounts 
    {
        public static Task<GetChildAccountsResult> InvokeAsync(GetChildAccountsArgs args, InvokeOptions? opts = null)
        public static Output<GetChildAccountsResult> Invoke(GetChildAccountsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetChildAccountsResult> getChildAccounts(GetChildAccountsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: linode:index/getChildAccounts:getChildAccounts
      arguments:
        # arguments dictionary

    The following arguments are supported:

    getChildAccounts Result

    The following output properties are available:

    Supporting Types

    GetChildAccountsChildAccount

    ActiveSince string
    When this account was first activated
    Address1 string
    First line of this Account's billing address.
    Address2 string
    Second line of this Account's billing address.
    Balance double
    This Account's balance, in US dollars.
    Capabilities List<string>
    A set containing all the capabilities of this Account.
    City string
    The city for this Account's billing address.
    Company string
    The company name associated with this Account.
    Country string
    The two-letter country code of this Account's billing address.
    Email string
    The email address for this Account, for account management communications, and may be used for other communications as configured.
    Euuid string
    The unique ID of this Account.
    FirstName string
    The first name of the person associated with this Account.
    Id string
    The Email of the Account.
    LastName string
    The last name of the person associated with this Account.
    Phone string
    The phone number associated with this Account.
    State string
    If billing address is in the United States, this is the State portion of the Account's billing address. If the address is outside the US, this is the Province associated with the Account's billing address.
    Zip string
    The zip code of this Account's billing address.
    ActiveSince string
    When this account was first activated
    Address1 string
    First line of this Account's billing address.
    Address2 string
    Second line of this Account's billing address.
    Balance float64
    This Account's balance, in US dollars.
    Capabilities []string
    A set containing all the capabilities of this Account.
    City string
    The city for this Account's billing address.
    Company string
    The company name associated with this Account.
    Country string
    The two-letter country code of this Account's billing address.
    Email string
    The email address for this Account, for account management communications, and may be used for other communications as configured.
    Euuid string
    The unique ID of this Account.
    FirstName string
    The first name of the person associated with this Account.
    Id string
    The Email of the Account.
    LastName string
    The last name of the person associated with this Account.
    Phone string
    The phone number associated with this Account.
    State string
    If billing address is in the United States, this is the State portion of the Account's billing address. If the address is outside the US, this is the Province associated with the Account's billing address.
    Zip string
    The zip code of this Account's billing address.
    activeSince String
    When this account was first activated
    address1 String
    First line of this Account's billing address.
    address2 String
    Second line of this Account's billing address.
    balance Double
    This Account's balance, in US dollars.
    capabilities List<String>
    A set containing all the capabilities of this Account.
    city String
    The city for this Account's billing address.
    company String
    The company name associated with this Account.
    country String
    The two-letter country code of this Account's billing address.
    email String
    The email address for this Account, for account management communications, and may be used for other communications as configured.
    euuid String
    The unique ID of this Account.
    firstName String
    The first name of the person associated with this Account.
    id String
    The Email of the Account.
    lastName String
    The last name of the person associated with this Account.
    phone String
    The phone number associated with this Account.
    state String
    If billing address is in the United States, this is the State portion of the Account's billing address. If the address is outside the US, this is the Province associated with the Account's billing address.
    zip String
    The zip code of this Account's billing address.
    activeSince string
    When this account was first activated
    address1 string
    First line of this Account's billing address.
    address2 string
    Second line of this Account's billing address.
    balance number
    This Account's balance, in US dollars.
    capabilities string[]
    A set containing all the capabilities of this Account.
    city string
    The city for this Account's billing address.
    company string
    The company name associated with this Account.
    country string
    The two-letter country code of this Account's billing address.
    email string
    The email address for this Account, for account management communications, and may be used for other communications as configured.
    euuid string
    The unique ID of this Account.
    firstName string
    The first name of the person associated with this Account.
    id string
    The Email of the Account.
    lastName string
    The last name of the person associated with this Account.
    phone string
    The phone number associated with this Account.
    state string
    If billing address is in the United States, this is the State portion of the Account's billing address. If the address is outside the US, this is the Province associated with the Account's billing address.
    zip string
    The zip code of this Account's billing address.
    active_since str
    When this account was first activated
    address1 str
    First line of this Account's billing address.
    address2 str
    Second line of this Account's billing address.
    balance float
    This Account's balance, in US dollars.
    capabilities Sequence[str]
    A set containing all the capabilities of this Account.
    city str
    The city for this Account's billing address.
    company str
    The company name associated with this Account.
    country str
    The two-letter country code of this Account's billing address.
    email str
    The email address for this Account, for account management communications, and may be used for other communications as configured.
    euuid str
    The unique ID of this Account.
    first_name str
    The first name of the person associated with this Account.
    id str
    The Email of the Account.
    last_name str
    The last name of the person associated with this Account.
    phone str
    The phone number associated with this Account.
    state str
    If billing address is in the United States, this is the State portion of the Account's billing address. If the address is outside the US, this is the Province associated with the Account's billing address.
    zip str
    The zip code of this Account's billing address.
    activeSince String
    When this account was first activated
    address1 String
    First line of this Account's billing address.
    address2 String
    Second line of this Account's billing address.
    balance Number
    This Account's balance, in US dollars.
    capabilities List<String>
    A set containing all the capabilities of this Account.
    city String
    The city for this Account's billing address.
    company String
    The company name associated with this Account.
    country String
    The two-letter country code of this Account's billing address.
    email String
    The email address for this Account, for account management communications, and may be used for other communications as configured.
    euuid String
    The unique ID of this Account.
    firstName String
    The first name of the person associated with this Account.
    id String
    The Email of the Account.
    lastName String
    The last name of the person associated with this Account.
    phone String
    The phone number associated with this Account.
    state String
    If billing address is in the United States, this is the State portion of the Account's billing address. If the address is outside the US, this is the Province associated with the Account's billing address.
    zip String
    The zip code of this Account's billing address.

    GetChildAccountsFilter

    Name string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    Values List<string>
    A list of values for the filter to allow. These values should all be in string form.
    MatchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    Name string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    Values []string
    A list of values for the filter to allow. These values should all be in string form.
    MatchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    name String
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values List<String>
    A list of values for the filter to allow. These values should all be in string form.
    matchBy String
    The method to match the field by. (exact, regex, substring; default exact)
    name string
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values string[]
    A list of values for the filter to allow. These values should all be in string form.
    matchBy string
    The method to match the field by. (exact, regex, substring; default exact)
    name str
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values Sequence[str]
    A list of values for the filter to allow. These values should all be in string form.
    match_by str
    The method to match the field by. (exact, regex, substring; default exact)
    name String
    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
    values List<String>
    A list of values for the filter to allow. These values should all be in string form.
    matchBy String
    The method to match the field by. (exact, regex, substring; default exact)

    Package Details

    Repository
    Linode pulumi/pulumi-linode
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the linode Terraform Provider.
    linode logo
    Linode v4.21.0 published on Friday, Jun 7, 2024 by Pulumi