oci.Identity.getUserGroupMemberships
Explore with Pulumi AI
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
andgroupId
to determine if the specified user is in the specified group. If the answer is no, the response is an empty list. - Although
userId
andgroupId
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:
- Compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Filters
List<Get
User Group Memberships Filter> - Group
Id string - The OCID of the group.
- User
Id string - The OCID of the user.
- Compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Filters
[]Get
User Group Memberships Filter - Group
Id string - The OCID of the group.
- User
Id string - The OCID of the user.
- compartment
Id String - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- filters
List<Get
User Group Memberships Filter> - group
Id String - The OCID of the group.
- user
Id String - The OCID of the user.
- compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- filters
Get
User Group Memberships Filter[] - group
Id string - The OCID of the group.
- user
Id 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.
Get User Group Memberships Filter] - group_
id str - The OCID of the group.
- user_
id str - The OCID of the user.
- compartment
Id String - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- filters List<Property Map>
- group
Id String - The OCID of the group.
- user
Id String - The OCID of the user.
getUserGroupMemberships Result
The following output properties are available:
- Compartment
Id 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<Get
User Group Memberships Membership> - The list of memberships.
- Filters
List<Get
User Group Memberships Filter> - Group
Id string - The OCID of the group.
- User
Id string - The OCID of the user.
- Compartment
Id 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
[]Get
User Group Memberships Membership - The list of memberships.
- Filters
[]Get
User Group Memberships Filter - Group
Id string - The OCID of the group.
- User
Id string - The OCID of the user.
- compartment
Id 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<Get
User Group Memberships Membership> - The list of memberships.
- filters
List<Get
User Group Memberships Filter> - group
Id String - The OCID of the group.
- user
Id String - The OCID of the user.
- compartment
Id 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
Get
User Group Memberships Membership[] - The list of memberships.
- filters
Get
User Group Memberships Filter[] - group
Id string - The OCID of the group.
- user
Id 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.
Get User Group Memberships Membership] - The list of memberships.
- filters
Sequence[identity.
Get User Group Memberships Filter] - group_
id str - The OCID of the group.
- user_
id str - The OCID of the user.
- compartment
Id 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>
- group
Id String - The OCID of the group.
- user
Id String - The OCID of the user.
Supporting Types
GetUserGroupMembershipsFilter
GetUserGroupMembershipsMembership
- Compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Group
Id string - The OCID of the group.
- Id string
- The OCID of the membership.
- Inactive
State string - The detailed status of INACTIVE lifecycleState.
- State string
- The membership's current state.
- Time
Created string - Date and time the membership was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- User
Id string - The OCID of the user.
- Compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Group
Id string - The OCID of the group.
- Id string
- The OCID of the membership.
- Inactive
State string - The detailed status of INACTIVE lifecycleState.
- State string
- The membership's current state.
- Time
Created string - Date and time the membership was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- User
Id string - The OCID of the user.
- compartment
Id String - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- group
Id String - The OCID of the group.
- id String
- The OCID of the membership.
- inactive
State String - The detailed status of INACTIVE lifecycleState.
- state String
- The membership's current state.
- time
Created String - Date and time the membership was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- user
Id String - The OCID of the user.
- compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- group
Id string - The OCID of the group.
- id string
- The OCID of the membership.
- inactive
State string - The detailed status of INACTIVE lifecycleState.
- state string
- The membership's current state.
- time
Created string - Date and time the membership was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- user
Id 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.
- compartment
Id String - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- group
Id String - The OCID of the group.
- id String
- The OCID of the membership.
- inactive
State String - The detailed status of INACTIVE lifecycleState.
- state String
- The membership's current state.
- time
Created String - Date and time the membership was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- user
Id 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.