## Resource: Membership

A membership within the Cloud Identity Groups API.

A `Membership` defines a relationship between a `Group` and an entity belonging to that `Group`, referred to as a "member".

| JSON representation |
|---|
| ``` { "name": string, "preferredMemberKey": { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/EntityKey`) }, "createTime": string, "updateTime": string, "roles": [ { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#MembershipRole`) } ], "type": enum (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#Type`), "deliverySetting": enum (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#DeliverySetting`) } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership`. Shall be of the form `groups/{group}/memberships/{membership}`. |
| `preferredMemberKey` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/EntityKey`)`` Required. Immutable. The `EntityKey` of the member. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The time when the `Membership` was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The time when the `Membership` was last updated. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `roles[]` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#MembershipRole`)`` The `MembershipRole`s that apply to the `Membership`. If unspecified, defaults to a single `MembershipRole` with `name` `MEMBER`. Must not contain duplicate `MembershipRole`s with the same `name`. |
| `type` | ``enum (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#Type`)`` Output only. The type of the membership. |
| `deliverySetting` | ``enum (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#DeliverySetting`)`` Output only. Delivery setting associated with the membership. |

## MembershipRole

A membership role within the Cloud Identity Groups API.

A `MembershipRole` defines the privileges granted to a `Membership`.

| JSON representation |
|---|
| ``` { "name": string, "expiryDetail": { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#ExpiryDetail`) }, "restrictionEvaluations": { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#RestrictionEvaluations`) } } ``` |

| Fields ||
|---|---|
| `name` | `string` The name of the `MembershipRole`. Must be one of `OWNER`, `MANAGER`, `MEMBER`. |
| `expiryDetail` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#ExpiryDetail`)`` The expiry details of the `MembershipRole`. Expiry details are only supported for `MEMBER` `MembershipRoles`. May be set if `name` is `MEMBER`. Must not be set if `name` is any other value. |
| `restrictionEvaluations` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#RestrictionEvaluations`)`` Evaluations of restrictions applied to parent group on this membership. |

## ExpiryDetail

The `MembershipRole` expiry details.

| JSON representation |
|---|
| ``` { "expireTime": string } ``` |

| Fields ||
|---|---|
| `expireTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` The time at which the `MembershipRole` will expire. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |

## RestrictionEvaluations

Evaluations of restrictions applied to parent group on this membership.

| JSON representation |
|---|
| ``` { "memberRestrictionEvaluation": { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#RestrictionEvaluation`) } } ``` |

| Fields ||
|---|---|
| `memberRestrictionEvaluation` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#RestrictionEvaluation`)`` Evaluation of the member restriction applied to this membership. Empty if the user lacks permission to view the restriction evaluation. |

## RestrictionEvaluation

The evaluated state of this restriction.

| JSON representation |
|---|
| ``` { "state": enum (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#State`) } ``` |

| Fields ||
|---|---|
| `state` | ``enum (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#State`)`` Output only. The current state of the restriction |

## State

All possible states of a restriction.

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | Default. Should not be used. |
| `COMPLIANT` | The member adheres to the parent group's restriction. |
| `FORWARD_COMPLIANT` | The group-group membership might be currently violating some parent group's restriction but in future, it will never allow any new member in the child group which can violate parent group's restriction. |
| `NON_COMPLIANT` | The member violates the parent group's restriction. |
| `EVALUATING` | The state of the membership is under evaluation. |

## Type

| Enums ||
|---|---|
| `TYPE_UNSPECIFIED` | Default. Should not be used. |
| `USER` | Represents user type. |
| `SERVICE_ACCOUNT` | Represents service account type. |
| `GROUP` | Represents group type. |
| `SHARED_DRIVE` | Represents Shared drive. |
| `CBCM_BROWSER` | Represents a CBCM-managed Chrome Browser type. |
| `CHROME_OS_DEVICE` | Represents a ChromeOS-managed ChromeOS device type. |
| `PERSONAL_AGENT` | Represents a Personal Agent type. |
| `COWORKER_AGENT` | Represents a Coworker Agent type. |
| `OTHER` | Represents other type. |

## DeliverySetting

Delivery setting associated with the membership.

| Enums ||
|---|---|
| `DELIVERY_SETTING_UNSPECIFIED` | Default. Should not be used. |
| `ALL_MAIL` | Represents each mail should be delivered |
| `DIGEST` | Represents 1 email for every 25 messages. |
| `DAILY` | Represents daily summary of messages. |
| `NONE` | Represents no delivery. |
| `DISABLED` | Represents disabled state. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/checkTransitiveMembership` | Check a potential member for membership in a group. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/create` | Creates a `Membership`. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/delete` | Deletes a `Membership`. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/get` | Retrieves a `Membership`. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/getMembershipGraph` | Get a membership graph of just a member or both a member and a group. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/list` | Lists the `Membership`s within a `Group`. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/lookup` | Looks up the [resource name](https://cloud.google.com/apis/design/resource_names) of a `Membership` by its `EntityKey`. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/modifyMembershipRoles` | Modifies the `MembershipRole`s of a `Membership`. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/searchDirectGroups` | Searches direct groups of a member. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/searchTransitiveGroups` | Search transitive groups of a member. |
| ### `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/searchTransitiveMemberships` | Search transitive memberships of a group. |