1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. getUserGroupMemberships
Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi

oci.Identity.getUserGroupMemberships

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi

    This data source provides the list of User Group Memberships in Oracle Cloud Infrastructure Identity service.

    Lists the UserGroupMembership objects in your tenancy. You must specify your tenancy’s OCID as the value for the compartment ID (see Where to Get the Tenancy’s OCID and User’s OCID). You must also then filter the list in one of these ways:

    • You can limit the results to just the memberships for a given user by specifying a userId.
    • Similarly, you can limit the results to just the memberships for a given group by specifying a groupId.
    • You can set both the userId and groupId to determine if the specified user is in the specified group. If the answer is no, the response is an empty list.
    • AlthoughuserId and groupId are not individually required, you must set one of them.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testUserGroupMemberships = oci.Identity.getUserGroupMemberships({
        compartmentId: tenancyOcid,
        groupId: testGroup.id,
        userId: testUser.id,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_user_group_memberships = oci.Identity.get_user_group_memberships(compartment_id=tenancy_ocid,
        group_id=test_group["id"],
        user_id=test_user["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/go/oci/Identity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Identity.GetUserGroupMemberships(ctx, &identity.GetUserGroupMembershipsArgs{
    			CompartmentId: tenancyOcid,
    			GroupId:       pulumi.StringRef(testGroup.Id),
    			UserId:        pulumi.StringRef(testUser.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testUserGroupMemberships = Oci.Identity.GetUserGroupMemberships.Invoke(new()
        {
            CompartmentId = tenancyOcid,
            GroupId = testGroup.Id,
            UserId = testUser.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Identity.IdentityFunctions;
    import com.pulumi.oci.Identity.inputs.GetUserGroupMembershipsArgs;
    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 testUserGroupMemberships = IdentityFunctions.getUserGroupMemberships(GetUserGroupMembershipsArgs.builder()
                .compartmentId(tenancyOcid)
                .groupId(testGroup.id())
                .userId(testUser.id())
                .build());
    
        }
    }
    
    variables:
      testUserGroupMemberships:
        fn::invoke:
          Function: oci:Identity:getUserGroupMemberships
          Arguments:
            compartmentId: ${tenancyOcid}
            groupId: ${testGroup.id}
            userId: ${testUser.id}
    

    Using getUserGroupMemberships

    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 getUserGroupMemberships(args: GetUserGroupMembershipsArgs, opts?: InvokeOptions): Promise<GetUserGroupMembershipsResult>
    function getUserGroupMembershipsOutput(args: GetUserGroupMembershipsOutputArgs, opts?: InvokeOptions): Output<GetUserGroupMembershipsResult>
    def get_user_group_memberships(compartment_id: Optional[str] = None,
                                   filters: Optional[Sequence[_identity.GetUserGroupMembershipsFilter]] = None,
                                   group_id: Optional[str] = None,
                                   user_id: Optional[str] = None,
                                   opts: Optional[InvokeOptions] = None) -> GetUserGroupMembershipsResult
    def get_user_group_memberships_output(compartment_id: Optional[pulumi.Input[str]] = None,
                                   filters: Optional[pulumi.Input[Sequence[pulumi.Input[_identity.GetUserGroupMembershipsFilterArgs]]]] = None,
                                   group_id: Optional[pulumi.Input[str]] = None,
                                   user_id: Optional[pulumi.Input[str]] = None,
                                   opts: Optional[InvokeOptions] = None) -> Output[GetUserGroupMembershipsResult]
    func GetUserGroupMemberships(ctx *Context, args *GetUserGroupMembershipsArgs, opts ...InvokeOption) (*GetUserGroupMembershipsResult, error)
    func GetUserGroupMembershipsOutput(ctx *Context, args *GetUserGroupMembershipsOutputArgs, opts ...InvokeOption) GetUserGroupMembershipsResultOutput

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

    public static class GetUserGroupMemberships 
    {
        public static Task<GetUserGroupMembershipsResult> InvokeAsync(GetUserGroupMembershipsArgs args, InvokeOptions? opts = null)
        public static Output<GetUserGroupMembershipsResult> Invoke(GetUserGroupMembershipsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUserGroupMembershipsResult> getUserGroupMemberships(GetUserGroupMembershipsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: oci:Identity/getUserGroupMemberships:getUserGroupMemberships
      arguments:
        # arguments dictionary

    The following arguments are supported:

    CompartmentId string
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    Filters List<GetUserGroupMembershipsFilter>
    GroupId string
    The OCID of the group.
    UserId string
    The OCID of the user.
    CompartmentId string
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    Filters []GetUserGroupMembershipsFilter
    GroupId string
    The OCID of the group.
    UserId string
    The OCID of the user.
    compartmentId String
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    filters List<GetUserGroupMembershipsFilter>
    groupId String
    The OCID of the group.
    userId String
    The OCID of the user.
    compartmentId string
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    filters GetUserGroupMembershipsFilter[]
    groupId string
    The OCID of the group.
    userId string
    The OCID of the user.
    compartment_id str
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    filters Sequence[identity.GetUserGroupMembershipsFilter]
    group_id str
    The OCID of the group.
    user_id str
    The OCID of the user.
    compartmentId String
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    filters List<Property Map>
    groupId String
    The OCID of the group.
    userId String
    The OCID of the user.

    getUserGroupMemberships Result

    The following output properties are available:

    CompartmentId string
    The OCID of the tenancy containing the user, group, and membership object.
    Id string
    The provider-assigned unique ID for this managed resource.
    Memberships List<GetUserGroupMembershipsMembership>
    The list of memberships.
    Filters List<GetUserGroupMembershipsFilter>
    GroupId string
    The OCID of the group.
    UserId string
    The OCID of the user.
    CompartmentId string
    The OCID of the tenancy containing the user, group, and membership object.
    Id string
    The provider-assigned unique ID for this managed resource.
    Memberships []GetUserGroupMembershipsMembership
    The list of memberships.
    Filters []GetUserGroupMembershipsFilter
    GroupId string
    The OCID of the group.
    UserId string
    The OCID of the user.
    compartmentId String
    The OCID of the tenancy containing the user, group, and membership object.
    id String
    The provider-assigned unique ID for this managed resource.
    memberships List<GetUserGroupMembershipsMembership>
    The list of memberships.
    filters List<GetUserGroupMembershipsFilter>
    groupId String
    The OCID of the group.
    userId String
    The OCID of the user.
    compartmentId string
    The OCID of the tenancy containing the user, group, and membership object.
    id string
    The provider-assigned unique ID for this managed resource.
    memberships GetUserGroupMembershipsMembership[]
    The list of memberships.
    filters GetUserGroupMembershipsFilter[]
    groupId string
    The OCID of the group.
    userId string
    The OCID of the user.
    compartment_id str
    The OCID of the tenancy containing the user, group, and membership object.
    id str
    The provider-assigned unique ID for this managed resource.
    memberships Sequence[identity.GetUserGroupMembershipsMembership]
    The list of memberships.
    filters Sequence[identity.GetUserGroupMembershipsFilter]
    group_id str
    The OCID of the group.
    user_id str
    The OCID of the user.
    compartmentId String
    The OCID of the tenancy containing the user, group, and membership object.
    id String
    The provider-assigned unique ID for this managed resource.
    memberships List<Property Map>
    The list of memberships.
    filters List<Property Map>
    groupId String
    The OCID of the group.
    userId String
    The OCID of the user.

    Supporting Types

    GetUserGroupMembershipsFilter

    Name string
    Values List<string>
    Regex bool
    Name string
    Values []string
    Regex bool
    name String
    values List<String>
    regex Boolean
    name string
    values string[]
    regex boolean
    name str
    values Sequence[str]
    regex bool
    name String
    values List<String>
    regex Boolean

    GetUserGroupMembershipsMembership

    CompartmentId string
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    GroupId string
    The OCID of the group.
    Id string
    The OCID of the membership.
    InactiveState string
    The detailed status of INACTIVE lifecycleState.
    State string
    The membership's current state.
    TimeCreated string
    Date and time the membership was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    UserId string
    The OCID of the user.
    CompartmentId string
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    GroupId string
    The OCID of the group.
    Id string
    The OCID of the membership.
    InactiveState string
    The detailed status of INACTIVE lifecycleState.
    State string
    The membership's current state.
    TimeCreated string
    Date and time the membership was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    UserId string
    The OCID of the user.
    compartmentId String
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    groupId String
    The OCID of the group.
    id String
    The OCID of the membership.
    inactiveState String
    The detailed status of INACTIVE lifecycleState.
    state String
    The membership's current state.
    timeCreated String
    Date and time the membership was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    userId String
    The OCID of the user.
    compartmentId string
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    groupId string
    The OCID of the group.
    id string
    The OCID of the membership.
    inactiveState string
    The detailed status of INACTIVE lifecycleState.
    state string
    The membership's current state.
    timeCreated string
    Date and time the membership was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    userId string
    The OCID of the user.
    compartment_id str
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    group_id str
    The OCID of the group.
    id str
    The OCID of the membership.
    inactive_state str
    The detailed status of INACTIVE lifecycleState.
    state str
    The membership's current state.
    time_created str
    Date and time the membership was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    user_id str
    The OCID of the user.
    compartmentId String
    The OCID of the compartment (remember that the tenancy is simply the root compartment).
    groupId String
    The OCID of the group.
    id String
    The OCID of the membership.
    inactiveState String
    The detailed status of INACTIVE lifecycleState.
    state String
    The membership's current state.
    timeCreated String
    Date and time the membership was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    userId String
    The OCID of the user.

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi