Skip to main content

user_group_memberships

Creates, updates, deletes, gets or lists a user_group_memberships resource.

Overview​

Nameuser_group_memberships
TypeResource
Idoci.identity.user_group_memberships

Fields​

The following fields are returned by SELECT queries:

The membership was retrieved.

NameDatatypeDescription
idstringThe OCID of the membership.
compartmentIdstringThe OCID of the tenancy containing the user, group, and membership object.
groupIdstringThe OCID of the group.
inactiveStatusinteger (int64)The detailed status of INACTIVE lifecycleState.
lifecycleStatestringThe membership's current state. After creating a membership object, make sure its lifecycleState changes from CREATING to ACTIVE before using it. (CREATING, ACTIVE, INACTIVE, DELETING, DELETED)
timeCreatedstring (date-time)Date and time the membership was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
userIdstringThe OCID of the user.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectuserGroupMembershipId, regionGets the specified UserGroupMembership's information.
listselectcompartmentId, regionuserId, groupId, page, limitLists the UserGroupMembership objects in your tenancy. You must specify your tenancy's OCID<br />as the value for the compartment ID<br />(see [Where to Get the Tenancy's OCID and User's OCID](/Content/API/Concepts/apisigningkey.htm#five)).<br />You must also then filter the list in one of these ways:<br /><br />- You can limit the results to just the memberships for a given user by specifying a userId.<br />- Similarly, you can limit the results to just the memberships for a given group by specifying a groupId.<br />- You can set both the userId and groupId to determine if the specified user is in the specified group.<br />If the answer is no, the response is an empty list.<br />- AlthoughuserId and groupId are not individually required, you must set one of them.<br />
add_user_to_groupexecregion, userId, groupIdopc-retry-tokenAdds the specified user to the specified group and returns a UserGroupMembership object with its own OCID.<br /><br />After you send your request, the new object's lifecycleState will temporarily be CREATING. Before using the<br />object, first make sure its lifecycleState has changed to ACTIVE.<br />
remove_user_from_groupexecuserGroupMembershipId, regionif-matchRemoves a user from a group by deleting the corresponding UserGroupMembership.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
compartmentIdstringThe OCID of the compartment (remember that the tenancy is simply the root compartment).
regionstringOCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION)
userGroupMembershipIdstringThe OCID of the userGroupMembership.
groupIdstringThe OCID of the group.
if-matchstringFor optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.
limitintegerThe maximum number of items to return in a paginated "List" call.
opc-retry-tokenstringA token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
pagestringThe value of the opc-next-page response header from the previous "List" call.
userIdstringThe OCID of the user.

SELECT examples​

Gets the specified UserGroupMembership's information.

SELECT
id,
compartmentId,
groupId,
inactiveStatus,
lifecycleState,
timeCreated,
userId
FROM oci.identity.user_group_memberships
WHERE userGroupMembershipId = '{{ userGroupMembershipId }}' -- required
AND region = '{{ region }}' -- required
;

Lifecycle Methods​

Adds the specified user to the specified group and returns a UserGroupMembership object with its own OCID.<br /><br />After you send your request, the new object's lifecycleState will temporarily be CREATING. Before using the<br />object, first make sure its lifecycleState has changed to ACTIVE.<br />

EXEC oci.identity.user_group_memberships.add_user_to_group
@region='{{ region }}' --required,
@opc-retry-token='{{ opc-retry-token }}'
@@json=
'{
"groupId": "{{ groupId }}",
"userId": "{{ userId }}"
}'
;