1. Packages
  2. New Relic
  3. API Docs
  4. getGroup
New Relic v5.25.3 published on Tuesday, Jun 25, 2024 by Pulumi

newrelic.getGroup

Explore with Pulumi AI

newrelic logo
New Relic v5.25.3 published on Tuesday, Jun 25, 2024 by Pulumi

    The newrelic.Group data source helps search for a group by its name and retrieve the ID of the matching group and other associated attributes.

    Example Usage

    The below example illustrates fetching the ID of a group (and IDs of users who belong to the group, if any) using the required arguments.

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const foo = newrelic.getAuthenticationDomain({
        name: "Test Authentication Domain",
    });
    const fooGetGroup = foo.then(foo => newrelic.getGroup({
        authenticationDomainId: foo.id,
        name: "Test Group",
    }));
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo = newrelic.get_authentication_domain(name="Test Authentication Domain")
    foo_get_group = newrelic.get_group(authentication_domain_id=foo.id,
        name="Test Group")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := newrelic.GetAuthenticationDomain(ctx, &newrelic.GetAuthenticationDomainArgs{
    			Name: "Test Authentication Domain",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.LookupGroup(ctx, &newrelic.LookupGroupArgs{
    			AuthenticationDomainId: foo.Id,
    			Name:                   "Test Group",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = NewRelic.GetAuthenticationDomain.Invoke(new()
        {
            Name = "Test Authentication Domain",
        });
    
        var fooGetGroup = NewRelic.GetGroup.Invoke(new()
        {
            AuthenticationDomainId = foo.Apply(getAuthenticationDomainResult => getAuthenticationDomainResult.Id),
            Name = "Test Group",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetAuthenticationDomainArgs;
    import com.pulumi.newrelic.inputs.GetGroupArgs;
    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 foo = NewrelicFunctions.getAuthenticationDomain(GetAuthenticationDomainArgs.builder()
                .name("Test Authentication Domain")
                .build());
    
            final var fooGetGroup = NewrelicFunctions.getGroup(GetGroupArgs.builder()
                .authenticationDomainId(foo.applyValue(getAuthenticationDomainResult -> getAuthenticationDomainResult.id()))
                .name("Test Group")
                .build());
    
        }
    }
    
    variables:
      foo:
        fn::invoke:
          Function: newrelic:getAuthenticationDomain
          Arguments:
            name: Test Authentication Domain
      fooGetGroup:
        fn::invoke:
          Function: newrelic:getGroup
          Arguments:
            authenticationDomainId: ${foo.id}
            name: Test Group
    

    Additional Examples

    The following example demonstrates utilizing attributes exported by this data source.

    In order to directly reference the attributes id and user_ids from this data source, you can use the syntax data.newrelic_group.foo.id and data.newrelic_group.foo.user_ids, respectively. However, if you need to assign these values to local variables and perform further processing (such as conditionally formatting the user_ids attribute as shown in the example below), consider using the provided configuration. These variables can then be accessed elsewhere using the syntax local.id and local.user_id, respectively.

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    import * as std from "@pulumi/std";
    
    const foo = newrelic.getAuthenticationDomain({
        name: "Test Authentication Domain",
    });
    const fooGetGroup = foo.then(foo => newrelic.getGroup({
        authenticationDomainId: foo.id,
        name: "Test Group",
    }));
    const id = fooGetGroup.then(fooGetGroup => fooGetGroup.id);
    const userIds = Promise.all([fooGetGroup.then(fooGetGroup => fooGetGroup.userIds).length, fooGetGroup.then(fooGetGroup => std.join({
        separator: ", ",
        input: fooGetGroup.userIds,
    }))]).then(([length, invoke]) => length > 0 ? invoke.result : "");
    
    import pulumi
    import pulumi_newrelic as newrelic
    import pulumi_std as std
    
    foo = newrelic.get_authentication_domain(name="Test Authentication Domain")
    foo_get_group = newrelic.get_group(authentication_domain_id=foo.id,
        name="Test Group")
    id = foo_get_group.id
    user_ids = std.join(separator=", ",
        input=foo_get_group.user_ids).result if len(foo_get_group.user_ids) > 0 else ""
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := newrelic.GetAuthenticationDomain(ctx, &newrelic.GetAuthenticationDomainArgs{
    			Name: "Test Authentication Domain",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		fooGetGroup, err := newrelic.LookupGroup(ctx, &newrelic.LookupGroupArgs{
    			AuthenticationDomainId: foo.Id,
    			Name:                   "Test Group",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_ := fooGetGroup.Id
    		var tmp0 *string
    		if len(fooGetGroup.UserIds) > 0 {
    			tmp0 = std.Join(ctx, &std.JoinArgs{
    				Separator: ", ",
    				Input:     fooGetGroup.UserIds,
    			}, nil).Result
    		} else {
    			tmp0 = ""
    		}
    		_ := tmp0
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = NewRelic.GetAuthenticationDomain.Invoke(new()
        {
            Name = "Test Authentication Domain",
        });
    
        var fooGetGroup = NewRelic.GetGroup.Invoke(new()
        {
            AuthenticationDomainId = foo.Apply(getAuthenticationDomainResult => getAuthenticationDomainResult.Id),
            Name = "Test Group",
        });
    
        var id = fooGetGroup.Apply(getGroupResult => getGroupResult.Id);
    
        var userIds = Output.Tuple(fooGetGroup.Apply(getGroupResult => getGroupResult.UserIds).Length, Std.Join.Invoke(new()
        {
            Separator = ", ",
            Input = fooGetGroup.Apply(getGroupResult => getGroupResult.UserIds),
        })).Apply(values =>
        {
            var length = values.Item1;
            var invoke = values.Item2;
            return length > 0 ? invoke.Result : "";
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetAuthenticationDomainArgs;
    import com.pulumi.newrelic.inputs.GetGroupArgs;
    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 foo = NewrelicFunctions.getAuthenticationDomain(GetAuthenticationDomainArgs.builder()
                .name("Test Authentication Domain")
                .build());
    
            final var fooGetGroup = NewrelicFunctions.getGroup(GetGroupArgs.builder()
                .authenticationDomainId(foo.applyValue(getAuthenticationDomainResult -> getAuthenticationDomainResult.id()))
                .name("Test Group")
                .build());
    
            final var id = fooGetGroup.applyValue(getGroupResult -> getGroupResult.id());
    
            final var userIds = fooGetGroup.applyValue(getGroupResult -> getGroupResult.userIds()).length() > 0 ? StdFunctions.join(JoinArgs.builder()
                .separator(", ")
                .input(fooGetGroup.applyValue(getGroupResult -> getGroupResult.userIds()))
                .build()).result() : "";
    
        }
    }
    
    Coming soon!
    

    Using getGroup

    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 getGroup(args: GetGroupArgs, opts?: InvokeOptions): Promise<GetGroupResult>
    function getGroupOutput(args: GetGroupOutputArgs, opts?: InvokeOptions): Output<GetGroupResult>
    def get_group(authentication_domain_id: Optional[str] = None,
                  name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetGroupResult
    def get_group_output(authentication_domain_id: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetGroupResult]
    func LookupGroup(ctx *Context, args *LookupGroupArgs, opts ...InvokeOption) (*LookupGroupResult, error)
    func LookupGroupOutput(ctx *Context, args *LookupGroupOutputArgs, opts ...InvokeOption) LookupGroupResultOutput

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

    public static class GetGroup 
    {
        public static Task<GetGroupResult> InvokeAsync(GetGroupArgs args, InvokeOptions? opts = null)
        public static Output<GetGroupResult> Invoke(GetGroupInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetGroupResult> getGroup(GetGroupArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: newrelic:index/getGroup:getGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AuthenticationDomainId string
    The ID of the authentication domain the group to be searched for belongs to.
    Name string

    The name of the group to search for.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    AuthenticationDomainId string
    The ID of the authentication domain the group to be searched for belongs to.
    Name string

    The name of the group to search for.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    authenticationDomainId String
    The ID of the authentication domain the group to be searched for belongs to.
    name String

    The name of the group to search for.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    authenticationDomainId string
    The ID of the authentication domain the group to be searched for belongs to.
    name string

    The name of the group to search for.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    authentication_domain_id str
    The ID of the authentication domain the group to be searched for belongs to.
    name str

    The name of the group to search for.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    authenticationDomainId String
    The ID of the authentication domain the group to be searched for belongs to.
    name String

    The name of the group to search for.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    getGroup Result

    The following output properties are available:

    AuthenticationDomainId string
    Id string
    The ID of the fetched matching group.
    Name string
    UserIds List<string>
    IDs of users who belong to the group. In the absence of any users in the group, the value of this attribute would be an empty list.
    AuthenticationDomainId string
    Id string
    The ID of the fetched matching group.
    Name string
    UserIds []string
    IDs of users who belong to the group. In the absence of any users in the group, the value of this attribute would be an empty list.
    authenticationDomainId String
    id String
    The ID of the fetched matching group.
    name String
    userIds List<String>
    IDs of users who belong to the group. In the absence of any users in the group, the value of this attribute would be an empty list.
    authenticationDomainId string
    id string
    The ID of the fetched matching group.
    name string
    userIds string[]
    IDs of users who belong to the group. In the absence of any users in the group, the value of this attribute would be an empty list.
    authentication_domain_id str
    id str
    The ID of the fetched matching group.
    name str
    user_ids Sequence[str]
    IDs of users who belong to the group. In the absence of any users in the group, the value of this attribute would be an empty list.
    authenticationDomainId String
    id String
    The ID of the fetched matching group.
    name String
    userIds List<String>
    IDs of users who belong to the group. In the absence of any users in the group, the value of this attribute would be an empty list.

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.25.3 published on Tuesday, Jun 25, 2024 by Pulumi