user_group_memberships
Creates, updates, deletes, gets or lists a user_group_memberships resource.
Overview​
| Name | user_group_memberships |
| Type | Resource |
| Id | oci.identity.user_group_memberships |
Fields​
The following fields are returned by SELECT queries:
- get
- list
The membership was retrieved.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the membership. |
compartmentId | string | The OCID of the tenancy containing the user, group, and membership object. |
groupId | string | The OCID of the group. |
inactiveStatus | integer (int64) | The detailed status of INACTIVE lifecycleState. |
lifecycleState | string | The 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) |
timeCreated | string (date-time) | 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. |
An object that represents the membership of a user in a group. When you add a user to a group, the result is a<br />UserGroupMembership with its own OCID. To remove a user from a group, you delete the UserGroupMembership object.<br />
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the membership. |
compartmentId | string | The OCID of the tenancy containing the user, group, and membership object. |
groupId | string | The OCID of the group. |
inactiveStatus | integer (int64) | The detailed status of INACTIVE lifecycleState. |
lifecycleState | string | The 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) |
timeCreated | string (date-time) | 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. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | userGroupMembershipId, region | Gets the specified UserGroupMembership's information. | |
list | select | compartmentId, region | userId, groupId, page, limit | Lists 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_group | exec | region, userId, groupId | opc-retry-token | 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 /> |
remove_user_from_group | exec | userGroupMembershipId, region | if-match | Removes 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.
| Name | Datatype | Description |
|---|---|---|
compartmentId | string | The OCID of the compartment (remember that the tenancy is simply the root compartment). |
region | string | OCI 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) |
userGroupMembershipId | string | The OCID of the userGroupMembership. |
groupId | string | The OCID of the group. |
if-match | string | For 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. |
limit | integer | The maximum number of items to return in a paginated "List" call. |
opc-retry-token | string | A 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). |
page | string | The value of the opc-next-page response header from the previous "List" call. |
userId | string | The OCID of the user. |
SELECT examples​
- get
- list
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
;
Lists 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 />
SELECT
id,
compartmentId,
groupId,
inactiveStatus,
lifecycleState,
timeCreated,
userId
FROM oci.identity.user_group_memberships
WHERE compartmentId = '{{ compartmentId }}' -- required
AND region = '{{ region }}' -- required
AND userId = '{{ userId }}'
AND groupId = '{{ groupId }}'
AND page = '{{ page }}'
AND limit = '{{ limit }}'
;
Lifecycle Methods​
- add_user_to_group
- remove_user_from_group
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 }}"
}'
;
Removes a user from a group by deleting the corresponding UserGroupMembership.
EXEC oci.identity.user_group_memberships.remove_user_from_group
@userGroupMembershipId='{{ userGroupMembershipId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}'
;