1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\CloudIdentity\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudIdentity\CheckTransitiveMembershipResponse;
|
---|
21 | use Google\Service\CloudIdentity\ListMembershipsResponse;
|
---|
22 | use Google\Service\CloudIdentity\LookupMembershipNameResponse;
|
---|
23 | use Google\Service\CloudIdentity\Membership;
|
---|
24 | use Google\Service\CloudIdentity\ModifyMembershipRolesRequest;
|
---|
25 | use Google\Service\CloudIdentity\ModifyMembershipRolesResponse;
|
---|
26 | use Google\Service\CloudIdentity\Operation;
|
---|
27 | use Google\Service\CloudIdentity\SearchDirectGroupsResponse;
|
---|
28 | use Google\Service\CloudIdentity\SearchTransitiveGroupsResponse;
|
---|
29 | use Google\Service\CloudIdentity\SearchTransitiveMembershipsResponse;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "memberships" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $cloudidentityService = new Google\Service\CloudIdentity(...);
|
---|
36 | * $memberships = $cloudidentityService->groups_memberships;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class GroupsMemberships extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Check a potential member for membership in a group. **Note:** This feature is
|
---|
43 | * only available to Google Workspace Enterprise Standard, Enterprise Plus, and
|
---|
44 | * Enterprise for Education; and Cloud Identity Premium accounts. If the account
|
---|
45 | * of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code
|
---|
46 | * will be returned. A member has membership to a group as long as there is a
|
---|
47 | * single viewable transitive membership between the group and the member. The
|
---|
48 | * actor must have view permissions to at least one transitive membership
|
---|
49 | * between the member and group. (memberships.checkTransitiveMembership)
|
---|
50 | *
|
---|
51 | * @param string $parent [Resource
|
---|
52 | * name](https://cloud.google.com/apis/design/resource_names) of the group to
|
---|
53 | * check the transitive membership in. Format: `groups/{group}`, where `group`
|
---|
54 | * is the unique id assigned to the Group to which the Membership belongs to.
|
---|
55 | * @param array $optParams Optional parameters.
|
---|
56 | *
|
---|
57 | * @opt_param string query Required. A CEL expression that MUST include member
|
---|
58 | * specification. This is a `required` field. Certain groups are uniquely
|
---|
59 | * identified by both a 'member_key_id' and a 'member_key_namespace', which
|
---|
60 | * requires an additional query input: 'member_key_namespace'. Example query:
|
---|
61 | * `member_key_id == 'member_key_id_value'`
|
---|
62 | * @return CheckTransitiveMembershipResponse
|
---|
63 | * @throws \Google\Service\Exception
|
---|
64 | */
|
---|
65 | public function checkTransitiveMembership($parent, $optParams = [])
|
---|
66 | {
|
---|
67 | $params = ['parent' => $parent];
|
---|
68 | $params = array_merge($params, $optParams);
|
---|
69 | return $this->call('checkTransitiveMembership', [$params], CheckTransitiveMembershipResponse::class);
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Creates a `Membership`. (memberships.create)
|
---|
73 | *
|
---|
74 | * @param string $parent Required. The parent `Group` resource under which to
|
---|
75 | * create the `Membership`. Must be of the form `groups/{group}`.
|
---|
76 | * @param Membership $postBody
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | * @return Operation
|
---|
79 | * @throws \Google\Service\Exception
|
---|
80 | */
|
---|
81 | public function create($parent, Membership $postBody, $optParams = [])
|
---|
82 | {
|
---|
83 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
84 | $params = array_merge($params, $optParams);
|
---|
85 | return $this->call('create', [$params], Operation::class);
|
---|
86 | }
|
---|
87 | /**
|
---|
88 | * Deletes a `Membership`. (memberships.delete)
|
---|
89 | *
|
---|
90 | * @param string $name Required. The [resource
|
---|
91 | * name](https://cloud.google.com/apis/design/resource_names) of the
|
---|
92 | * `Membership` to delete. Must be of the form
|
---|
93 | * `groups/{group}/memberships/{membership}`
|
---|
94 | * @param array $optParams Optional parameters.
|
---|
95 | * @return Operation
|
---|
96 | * @throws \Google\Service\Exception
|
---|
97 | */
|
---|
98 | public function delete($name, $optParams = [])
|
---|
99 | {
|
---|
100 | $params = ['name' => $name];
|
---|
101 | $params = array_merge($params, $optParams);
|
---|
102 | return $this->call('delete', [$params], Operation::class);
|
---|
103 | }
|
---|
104 | /**
|
---|
105 | * Retrieves a `Membership`. (memberships.get)
|
---|
106 | *
|
---|
107 | * @param string $name Required. The [resource
|
---|
108 | * name](https://cloud.google.com/apis/design/resource_names) of the
|
---|
109 | * `Membership` to retrieve. Must be of the form
|
---|
110 | * `groups/{group}/memberships/{membership}`.
|
---|
111 | * @param array $optParams Optional parameters.
|
---|
112 | * @return Membership
|
---|
113 | * @throws \Google\Service\Exception
|
---|
114 | */
|
---|
115 | public function get($name, $optParams = [])
|
---|
116 | {
|
---|
117 | $params = ['name' => $name];
|
---|
118 | $params = array_merge($params, $optParams);
|
---|
119 | return $this->call('get', [$params], Membership::class);
|
---|
120 | }
|
---|
121 | /**
|
---|
122 | * Get a membership graph of just a member or both a member and a group.
|
---|
123 | * **Note:** This feature is only available to Google Workspace Enterprise
|
---|
124 | * Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity
|
---|
125 | * Premium accounts. If the account of the member is not one of these, a 403
|
---|
126 | * (PERMISSION_DENIED) HTTP status code will be returned. Given a member, the
|
---|
127 | * response will contain all membership paths from the member. Given both a
|
---|
128 | * group and a member, the response will contain all membership paths between
|
---|
129 | * the group and the member. (memberships.getMembershipGraph)
|
---|
130 | *
|
---|
131 | * @param string $parent Required. [Resource
|
---|
132 | * name](https://cloud.google.com/apis/design/resource_names) of the group to
|
---|
133 | * search transitive memberships in. Format: `groups/{group}`, where `group` is
|
---|
134 | * the unique ID assigned to the Group to which the Membership belongs to. group
|
---|
135 | * can be a wildcard collection id "-". When a group is specified, the
|
---|
136 | * membership graph will be constrained to paths between the member (defined in
|
---|
137 | * the query) and the parent. If a wildcard collection is provided, all
|
---|
138 | * membership paths connected to the member will be returned.
|
---|
139 | * @param array $optParams Optional parameters.
|
---|
140 | *
|
---|
141 | * @opt_param string query Required. A CEL expression that MUST include member
|
---|
142 | * specification AND label(s). Certain groups are uniquely identified by both a
|
---|
143 | * 'member_key_id' and a 'member_key_namespace', which requires an additional
|
---|
144 | * query input: 'member_key_namespace'. Example query: `member_key_id ==
|
---|
145 | * 'member_key_id_value' && in labels`
|
---|
146 | * @return Operation
|
---|
147 | * @throws \Google\Service\Exception
|
---|
148 | */
|
---|
149 | public function getMembershipGraph($parent, $optParams = [])
|
---|
150 | {
|
---|
151 | $params = ['parent' => $parent];
|
---|
152 | $params = array_merge($params, $optParams);
|
---|
153 | return $this->call('getMembershipGraph', [$params], Operation::class);
|
---|
154 | }
|
---|
155 | /**
|
---|
156 | * Lists the `Membership`s within a `Group`. (memberships.listGroupsMemberships)
|
---|
157 | *
|
---|
158 | * @param string $parent Required. The parent `Group` resource under which to
|
---|
159 | * lookup the `Membership` name. Must be of the form `groups/{group}`.
|
---|
160 | * @param array $optParams Optional parameters.
|
---|
161 | *
|
---|
162 | * @opt_param int pageSize The maximum number of results to return. Note that
|
---|
163 | * the number of results returned may be less than this value even if there are
|
---|
164 | * more available results. To fetch all results, clients must continue calling
|
---|
165 | * this method repeatedly until the response no longer contains a
|
---|
166 | * `next_page_token`. If unspecified, defaults to 200 for `GroupView.BASIC` and
|
---|
167 | * to 50 for `GroupView.FULL`. Must not be greater than 1000 for
|
---|
168 | * `GroupView.BASIC` or 500 for `GroupView.FULL`.
|
---|
169 | * @opt_param string pageToken The `next_page_token` value returned from a
|
---|
170 | * previous search request, if any.
|
---|
171 | * @opt_param string view The level of detail to be returned. If unspecified,
|
---|
172 | * defaults to `View.BASIC`.
|
---|
173 | * @return ListMembershipsResponse
|
---|
174 | * @throws \Google\Service\Exception
|
---|
175 | */
|
---|
176 | public function listGroupsMemberships($parent, $optParams = [])
|
---|
177 | {
|
---|
178 | $params = ['parent' => $parent];
|
---|
179 | $params = array_merge($params, $optParams);
|
---|
180 | return $this->call('list', [$params], ListMembershipsResponse::class);
|
---|
181 | }
|
---|
182 | /**
|
---|
183 | * Looks up the [resource
|
---|
184 | * name](https://cloud.google.com/apis/design/resource_names) of a `Membership`
|
---|
185 | * by its `EntityKey`. (memberships.lookup)
|
---|
186 | *
|
---|
187 | * @param string $parent Required. The parent `Group` resource under which to
|
---|
188 | * lookup the `Membership` name. Must be of the form `groups/{group}`.
|
---|
189 | * @param array $optParams Optional parameters.
|
---|
190 | *
|
---|
191 | * @opt_param string memberKey.id The ID of the entity. For Google-managed
|
---|
192 | * entities, the `id` should be the email address of an existing group or user.
|
---|
193 | * Email addresses need to adhere to [name guidelines for users and
|
---|
194 | * groups](https://support.google.com/a/answer/9193374). For external-identity-
|
---|
195 | * mapped entities, the `id` must be a string conforming to the Identity
|
---|
196 | * Source's requirements. Must be unique within a `namespace`.
|
---|
197 | * @opt_param string memberKey.namespace The namespace in which the entity
|
---|
198 | * exists. If not specified, the `EntityKey` represents a Google-managed entity
|
---|
199 | * such as a Google user or a Google Group. If specified, the `EntityKey`
|
---|
200 | * represents an external-identity-mapped group. The namespace must correspond
|
---|
201 | * to an identity source created in Admin Console and must be in the form of
|
---|
202 | * `identitysources/{identity_source}`.
|
---|
203 | * @return LookupMembershipNameResponse
|
---|
204 | * @throws \Google\Service\Exception
|
---|
205 | */
|
---|
206 | public function lookup($parent, $optParams = [])
|
---|
207 | {
|
---|
208 | $params = ['parent' => $parent];
|
---|
209 | $params = array_merge($params, $optParams);
|
---|
210 | return $this->call('lookup', [$params], LookupMembershipNameResponse::class);
|
---|
211 | }
|
---|
212 | /**
|
---|
213 | * Modifies the `MembershipRole`s of a `Membership`.
|
---|
214 | * (memberships.modifyMembershipRoles)
|
---|
215 | *
|
---|
216 | * @param string $name Required. The [resource
|
---|
217 | * name](https://cloud.google.com/apis/design/resource_names) of the
|
---|
218 | * `Membership` whose roles are to be modified. Must be of the form
|
---|
219 | * `groups/{group}/memberships/{membership}`.
|
---|
220 | * @param ModifyMembershipRolesRequest $postBody
|
---|
221 | * @param array $optParams Optional parameters.
|
---|
222 | * @return ModifyMembershipRolesResponse
|
---|
223 | * @throws \Google\Service\Exception
|
---|
224 | */
|
---|
225 | public function modifyMembershipRoles($name, ModifyMembershipRolesRequest $postBody, $optParams = [])
|
---|
226 | {
|
---|
227 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
228 | $params = array_merge($params, $optParams);
|
---|
229 | return $this->call('modifyMembershipRoles', [$params], ModifyMembershipRolesResponse::class);
|
---|
230 | }
|
---|
231 | /**
|
---|
232 | * Searches direct groups of a member. (memberships.searchDirectGroups)
|
---|
233 | *
|
---|
234 | * @param string $parent [Resource
|
---|
235 | * name](https://cloud.google.com/apis/design/resource_names) of the group to
|
---|
236 | * search transitive memberships in. Format: groups/{group_id}, where group_id
|
---|
237 | * is always '-' as this API will search across all groups for a given member.
|
---|
238 | * @param array $optParams Optional parameters.
|
---|
239 | *
|
---|
240 | * @opt_param string orderBy The ordering of membership relation for the display
|
---|
241 | * name or email in the response. The syntax for this field can be found at
|
---|
242 | * https://cloud.google.com/apis/design/design_patterns#sorting_order. Example:
|
---|
243 | * Sort by the ascending display name: order_by="group_name" or
|
---|
244 | * order_by="group_name asc". Sort by the descending display name:
|
---|
245 | * order_by="group_name desc". Sort by the ascending group key:
|
---|
246 | * order_by="group_key" or order_by="group_key asc". Sort by the descending
|
---|
247 | * group key: order_by="group_key desc".
|
---|
248 | * @opt_param int pageSize The default page size is 200 (max 1000).
|
---|
249 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
250 | * previous list request, if any
|
---|
251 | * @opt_param string query Required. A CEL expression that MUST include member
|
---|
252 | * specification AND label(s). Users can search on label attributes of groups.
|
---|
253 | * CONTAINS match ('in') is supported on labels. Identity-mapped groups are
|
---|
254 | * uniquely identified by both a `member_key_id` and a `member_key_namespace`,
|
---|
255 | * which requires an additional query input: `member_key_namespace`. Example
|
---|
256 | * query: `member_key_id == 'member_key_id_value' && 'label_value' in labels`
|
---|
257 | * @return SearchDirectGroupsResponse
|
---|
258 | * @throws \Google\Service\Exception
|
---|
259 | */
|
---|
260 | public function searchDirectGroups($parent, $optParams = [])
|
---|
261 | {
|
---|
262 | $params = ['parent' => $parent];
|
---|
263 | $params = array_merge($params, $optParams);
|
---|
264 | return $this->call('searchDirectGroups', [$params], SearchDirectGroupsResponse::class);
|
---|
265 | }
|
---|
266 | /**
|
---|
267 | * Search transitive groups of a member. **Note:** This feature is only
|
---|
268 | * available to Google Workspace Enterprise Standard, Enterprise Plus, and
|
---|
269 | * Enterprise for Education; and Cloud Identity Premium accounts. If the account
|
---|
270 | * of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code
|
---|
271 | * will be returned. A transitive group is any group that has a direct or
|
---|
272 | * indirect membership to the member. Actor must have view permissions all
|
---|
273 | * transitive groups. (memberships.searchTransitiveGroups)
|
---|
274 | *
|
---|
275 | * @param string $parent [Resource
|
---|
276 | * name](https://cloud.google.com/apis/design/resource_names) of the group to
|
---|
277 | * search transitive memberships in. Format: `groups/{group}`, where `group` is
|
---|
278 | * always '-' as this API will search across all groups for a given member.
|
---|
279 | * @param array $optParams Optional parameters.
|
---|
280 | *
|
---|
281 | * @opt_param int pageSize The default page size is 200 (max 1000).
|
---|
282 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
283 | * previous list request, if any.
|
---|
284 | * @opt_param string query Required. A CEL expression that MUST include member
|
---|
285 | * specification AND label(s). This is a `required` field. Users can search on
|
---|
286 | * label attributes of groups. CONTAINS match ('in') is supported on labels.
|
---|
287 | * Identity-mapped groups are uniquely identified by both a `member_key_id` and
|
---|
288 | * a `member_key_namespace`, which requires an additional query input:
|
---|
289 | * `member_key_namespace`. Example query: `member_key_id ==
|
---|
290 | * 'member_key_id_value' && in labels` Query may optionally contain equality
|
---|
291 | * operators on the parent of the group restricting the search within a
|
---|
292 | * particular customer, e.g. `parent == 'customers/{customer_id}'`. The
|
---|
293 | * `customer_id` must begin with "C" (for example, 'C046psxkn'). This filtering
|
---|
294 | * is only supported for Admins with groups read permissons on the input
|
---|
295 | * customer. Example query: `member_key_id == 'member_key_id_value' && in labels
|
---|
296 | * && parent == 'customers/C046psxkn'`
|
---|
297 | * @return SearchTransitiveGroupsResponse
|
---|
298 | * @throws \Google\Service\Exception
|
---|
299 | */
|
---|
300 | public function searchTransitiveGroups($parent, $optParams = [])
|
---|
301 | {
|
---|
302 | $params = ['parent' => $parent];
|
---|
303 | $params = array_merge($params, $optParams);
|
---|
304 | return $this->call('searchTransitiveGroups', [$params], SearchTransitiveGroupsResponse::class);
|
---|
305 | }
|
---|
306 | /**
|
---|
307 | * Search transitive memberships of a group. **Note:** This feature is only
|
---|
308 | * available to Google Workspace Enterprise Standard, Enterprise Plus, and
|
---|
309 | * Enterprise for Education; and Cloud Identity Premium accounts. If the account
|
---|
310 | * of the group is not one of these, a 403 (PERMISSION_DENIED) HTTP status code
|
---|
311 | * will be returned. A transitive membership is any direct or indirect
|
---|
312 | * membership of a group. Actor must have view permissions to all transitive
|
---|
313 | * memberships. (memberships.searchTransitiveMemberships)
|
---|
314 | *
|
---|
315 | * @param string $parent [Resource
|
---|
316 | * name](https://cloud.google.com/apis/design/resource_names) of the group to
|
---|
317 | * search transitive memberships in. Format: `groups/{group}`, where `group` is
|
---|
318 | * the unique ID assigned to the Group.
|
---|
319 | * @param array $optParams Optional parameters.
|
---|
320 | *
|
---|
321 | * @opt_param int pageSize The default page size is 200 (max 1000).
|
---|
322 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
323 | * previous list request, if any.
|
---|
324 | * @return SearchTransitiveMembershipsResponse
|
---|
325 | * @throws \Google\Service\Exception
|
---|
326 | */
|
---|
327 | public function searchTransitiveMemberships($parent, $optParams = [])
|
---|
328 | {
|
---|
329 | $params = ['parent' => $parent];
|
---|
330 | $params = array_merge($params, $optParams);
|
---|
331 | return $this->call('searchTransitiveMemberships', [$params], SearchTransitiveMembershipsResponse::class);
|
---|
332 | }
|
---|
333 | }
|
---|
334 |
|
---|
335 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
336 | class_alias(GroupsMemberships::class, 'Google_Service_CloudIdentity_Resource_GroupsMemberships');
|
---|