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
18namespace Google\Service\CloudIdentity\Resource;
19
20use Google\Service\CloudIdentity\Group;
21use Google\Service\CloudIdentity\ListGroupsResponse;
22use Google\Service\CloudIdentity\LookupGroupNameResponse;
23use Google\Service\CloudIdentity\Operation;
24use Google\Service\CloudIdentity\SearchGroupsResponse;
25use Google\Service\CloudIdentity\SecuritySettings;
26
27/**
28 * The "groups" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $cloudidentityService = new Google\Service\CloudIdentity(...);
32 *   $groups = $cloudidentityService->groups;
33 *  </code>
34 */
35class Groups extends \Google\Service\Resource
36{
37  /**
38   * Creates a Group. (groups.create)
39   *
40   * @param Group $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string initialGroupConfig Optional. The initial configuration
44   * option for the `Group`.
45   * @return Operation
46   */
47  public function create(Group $postBody, $optParams = [])
48  {
49    $params = ['postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], Operation::class);
52  }
53  /**
54   * Deletes a `Group`. (groups.delete)
55   *
56   * @param string $name Required. The [resource
57   * name](https://cloud.google.com/apis/design/resource_names) of the `Group` to
58   * retrieve. Must be of the form `groups/{group}`.
59   * @param array $optParams Optional parameters.
60   * @return Operation
61   */
62  public function delete($name, $optParams = [])
63  {
64    $params = ['name' => $name];
65    $params = array_merge($params, $optParams);
66    return $this->call('delete', [$params], Operation::class);
67  }
68  /**
69   * Retrieves a `Group`. (groups.get)
70   *
71   * @param string $name Required. The [resource
72   * name](https://cloud.google.com/apis/design/resource_names) of the `Group` to
73   * retrieve. Must be of the form `groups/{group}`.
74   * @param array $optParams Optional parameters.
75   * @return Group
76   */
77  public function get($name, $optParams = [])
78  {
79    $params = ['name' => $name];
80    $params = array_merge($params, $optParams);
81    return $this->call('get', [$params], Group::class);
82  }
83  /**
84   * Get Security Settings (groups.getSecuritySettings)
85   *
86   * @param string $name Required. The security settings to retrieve. Format:
87   * `groups/{group_id}/securitySettings`
88   * @param array $optParams Optional parameters.
89   *
90   * @opt_param string readMask Field-level read mask of which fields to return.
91   * "*" returns all fields. If not specified, all fields will be returned. May
92   * only contain the following field: `member_restriction`.
93   * @return SecuritySettings
94   */
95  public function getSecuritySettings($name, $optParams = [])
96  {
97    $params = ['name' => $name];
98    $params = array_merge($params, $optParams);
99    return $this->call('getSecuritySettings', [$params], SecuritySettings::class);
100  }
101  /**
102   * Lists the `Group` resources under a customer or namespace.
103   * (groups.listGroups)
104   *
105   * @param array $optParams Optional parameters.
106   *
107   * @opt_param int pageSize The maximum number of results to return. Note that
108   * the number of results returned may be less than this value even if there are
109   * more available results. To fetch all results, clients must continue calling
110   * this method repeatedly until the response no longer contains a
111   * `next_page_token`. If unspecified, defaults to 200 for `View.BASIC` and to 50
112   * for `View.FULL`. Must not be greater than 1000 for `View.BASIC` or 500 for
113   * `View.FULL`.
114   * @opt_param string pageToken The `next_page_token` value returned from a
115   * previous list request, if any.
116   * @opt_param string parent Required. The parent resource under which to list
117   * all `Group` resources. Must be of the form
118   * `identitysources/{identity_source}` for external- identity-mapped groups or
119   * `customers/{customer}` for Google Groups. The `customer` must begin with "C"
120   * (for example, 'C046psxkn').
121   * @opt_param string view The level of detail to be returned. If unspecified,
122   * defaults to `View.BASIC`.
123   * @return ListGroupsResponse
124   */
125  public function listGroups($optParams = [])
126  {
127    $params = [];
128    $params = array_merge($params, $optParams);
129    return $this->call('list', [$params], ListGroupsResponse::class);
130  }
131  /**
132   * Looks up the [resource
133   * name](https://cloud.google.com/apis/design/resource_names) of a `Group` by
134   * its `EntityKey`. (groups.lookup)
135   *
136   * @param array $optParams Optional parameters.
137   *
138   * @opt_param string groupKey.id The ID of the entity. For Google-managed
139   * entities, the `id` should be the email address of an existing group or user.
140   * For external-identity-mapped entities, the `id` must be a string conforming
141   * to the Identity Source's requirements. Must be unique within a `namespace`.
142   * @opt_param string groupKey.namespace The namespace in which the entity
143   * exists. If not specified, the `EntityKey` represents a Google-managed entity
144   * such as a Google user or a Google Group. If specified, the `EntityKey`
145   * represents an external-identity-mapped group. The namespace must correspond
146   * to an identity source created in Admin Console and must be in the form of
147   * `identitysources/{identity_source}`.
148   * @return LookupGroupNameResponse
149   */
150  public function lookup($optParams = [])
151  {
152    $params = [];
153    $params = array_merge($params, $optParams);
154    return $this->call('lookup', [$params], LookupGroupNameResponse::class);
155  }
156  /**
157   * Updates a `Group`. (groups.patch)
158   *
159   * @param string $name Output only. The [resource
160   * name](https://cloud.google.com/apis/design/resource_names) of the `Group`.
161   * Shall be of the form `groups/{group}`.
162   * @param Group $postBody
163   * @param array $optParams Optional parameters.
164   *
165   * @opt_param string updateMask Required. The names of fields to update. May
166   * only contain the following field names: `display_name`, `description`,
167   * `labels`.
168   * @return Operation
169   */
170  public function patch($name, Group $postBody, $optParams = [])
171  {
172    $params = ['name' => $name, 'postBody' => $postBody];
173    $params = array_merge($params, $optParams);
174    return $this->call('patch', [$params], Operation::class);
175  }
176  /**
177   * Searches for `Group` resources matching a specified query. (groups.search)
178   *
179   * @param array $optParams Optional parameters.
180   *
181   * @opt_param int pageSize The maximum number of results to return. Note that
182   * the number of results returned may be less than this value even if there are
183   * more available results. To fetch all results, clients must continue calling
184   * this method repeatedly until the response no longer contains a
185   * `next_page_token`. If unspecified, defaults to 200 for `GroupView.BASIC` and
186   * 50 for `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC`
187   * or 500 for `GroupView.FULL`.
188   * @opt_param string pageToken The `next_page_token` value returned from a
189   * previous search request, if any.
190   * @opt_param string query Required. The search query. Must be specified in
191   * [Common Expression Language](https://opensource.google/projects/cel). May
192   * only contain equality operators on the parent and inclusion operators on
193   * labels (e.g., `parent == 'customers/{customer}' &&
194   * 'cloudidentity.googleapis.com/groups.discussion_forum' in labels`). The
195   * `customer` must begin with "C" (for example, 'C046psxkn').
196   * @opt_param string view The level of detail to be returned. If unspecified,
197   * defaults to `View.BASIC`.
198   * @return SearchGroupsResponse
199   */
200  public function search($optParams = [])
201  {
202    $params = [];
203    $params = array_merge($params, $optParams);
204    return $this->call('search', [$params], SearchGroupsResponse::class);
205  }
206  /**
207   * Update Security Settings (groups.updateSecuritySettings)
208   *
209   * @param string $name Output only. The resource name of the security settings.
210   * Shall be of the form `groups/{group_id}/securitySettings`.
211   * @param SecuritySettings $postBody
212   * @param array $optParams Optional parameters.
213   *
214   * @opt_param string updateMask Required. The fully-qualified names of fields to
215   * update. May only contain the following field: `member_restriction.query`.
216   * @return Operation
217   */
218  public function updateSecuritySettings($name, SecuritySettings $postBody, $optParams = [])
219  {
220    $params = ['name' => $name, 'postBody' => $postBody];
221    $params = array_merge($params, $optParams);
222    return $this->call('updateSecuritySettings', [$params], Operation::class);
223  }
224}
225
226// Adding a class alias for backwards compatibility with the previous class name.
227class_alias(Groups::class, 'Google_Service_CloudIdentity_Resource_Groups');
228