[e3d4e0a] | 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\Directory\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Directory\OrgUnit;
|
---|
| 21 | use Google\Service\Directory\OrgUnits as OrgUnitsModel;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "orgunits" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $adminService = new Google\Service\Directory(...);
|
---|
| 28 | * $orgunits = $adminService->orgunits;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class Orgunits extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Removes an organizational unit. (orgunits.delete)
|
---|
| 35 | *
|
---|
| 36 | * @param string $customerId The unique ID for the customer's Google Workspace
|
---|
| 37 | * account. As an account administrator, you can also use the `my_customer`
|
---|
| 38 | * alias to represent your account's `customerId`. The `customerId` is also
|
---|
| 39 | * returned as part of the [Users resource](/admin-
|
---|
| 40 | * sdk/directory/v1/reference/users).
|
---|
| 41 | * @param string $orgUnitPath The full path of the organizational unit (minus
|
---|
| 42 | * the leading `/`) or its unique ID.
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | * @throws \Google\Service\Exception
|
---|
| 45 | */
|
---|
| 46 | public function delete($customerId, $orgUnitPath, $optParams = [])
|
---|
| 47 | {
|
---|
| 48 | $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath];
|
---|
| 49 | $params = array_merge($params, $optParams);
|
---|
| 50 | return $this->call('delete', [$params]);
|
---|
| 51 | }
|
---|
| 52 | /**
|
---|
| 53 | * Retrieves an organizational unit. (orgunits.get)
|
---|
| 54 | *
|
---|
| 55 | * @param string $customerId The unique ID for the customer's Google Workspace
|
---|
| 56 | * account. As an account administrator, you can also use the `my_customer`
|
---|
| 57 | * alias to represent your account's `customerId`. The `customerId` is also
|
---|
| 58 | * returned as part of the [Users resource](/admin-
|
---|
| 59 | * sdk/directory/v1/reference/users).
|
---|
| 60 | * @param string $orgUnitPath The full path of the organizational unit (minus
|
---|
| 61 | * the leading `/`) or its unique ID.
|
---|
| 62 | * @param array $optParams Optional parameters.
|
---|
| 63 | * @return OrgUnit
|
---|
| 64 | * @throws \Google\Service\Exception
|
---|
| 65 | */
|
---|
| 66 | public function get($customerId, $orgUnitPath, $optParams = [])
|
---|
| 67 | {
|
---|
| 68 | $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath];
|
---|
| 69 | $params = array_merge($params, $optParams);
|
---|
| 70 | return $this->call('get', [$params], OrgUnit::class);
|
---|
| 71 | }
|
---|
| 72 | /**
|
---|
| 73 | * Adds an organizational unit. (orgunits.insert)
|
---|
| 74 | *
|
---|
| 75 | * @param string $customerId The unique ID for the customer's Google Workspace
|
---|
| 76 | * account. As an account administrator, you can also use the `my_customer`
|
---|
| 77 | * alias to represent your account's `customerId`. The `customerId` is also
|
---|
| 78 | * returned as part of the [Users resource](/admin-
|
---|
| 79 | * sdk/directory/v1/reference/users).
|
---|
| 80 | * @param OrgUnit $postBody
|
---|
| 81 | * @param array $optParams Optional parameters.
|
---|
| 82 | * @return OrgUnit
|
---|
| 83 | * @throws \Google\Service\Exception
|
---|
| 84 | */
|
---|
| 85 | public function insert($customerId, OrgUnit $postBody, $optParams = [])
|
---|
| 86 | {
|
---|
| 87 | $params = ['customerId' => $customerId, 'postBody' => $postBody];
|
---|
| 88 | $params = array_merge($params, $optParams);
|
---|
| 89 | return $this->call('insert', [$params], OrgUnit::class);
|
---|
| 90 | }
|
---|
| 91 | /**
|
---|
| 92 | * Retrieves a list of all organizational units for an account.
|
---|
| 93 | * (orgunits.listOrgunits)
|
---|
| 94 | *
|
---|
| 95 | * @param string $customerId The unique ID for the customer's Google Workspace
|
---|
| 96 | * account. As an account administrator, you can also use the `my_customer`
|
---|
| 97 | * alias to represent your account's `customerId`. The `customerId` is also
|
---|
| 98 | * returned as part of the [Users resource](/admin-
|
---|
| 99 | * sdk/directory/v1/reference/users).
|
---|
| 100 | * @param array $optParams Optional parameters.
|
---|
| 101 | *
|
---|
| 102 | * @opt_param string orgUnitPath The full path to the organizational unit or its
|
---|
| 103 | * unique ID. Returns the children of the specified organizational unit.
|
---|
| 104 | * @opt_param string type Whether to return all sub-organizations or just
|
---|
| 105 | * immediate children.
|
---|
| 106 | * @return OrgUnitsModel
|
---|
| 107 | * @throws \Google\Service\Exception
|
---|
| 108 | */
|
---|
| 109 | public function listOrgunits($customerId, $optParams = [])
|
---|
| 110 | {
|
---|
| 111 | $params = ['customerId' => $customerId];
|
---|
| 112 | $params = array_merge($params, $optParams);
|
---|
| 113 | return $this->call('list', [$params], OrgUnitsModel::class);
|
---|
| 114 | }
|
---|
| 115 | /**
|
---|
| 116 | * Updates an organizational unit. This method supports [patch
|
---|
| 117 | * semantics](/admin-sdk/directory/v1/guides/performance#patch) (orgunits.patch)
|
---|
| 118 | *
|
---|
| 119 | * @param string $customerId The unique ID for the customer's Google Workspace
|
---|
| 120 | * account. As an account administrator, you can also use the `my_customer`
|
---|
| 121 | * alias to represent your account's `customerId`. The `customerId` is also
|
---|
| 122 | * returned as part of the [Users resource](/admin-
|
---|
| 123 | * sdk/directory/v1/reference/users).
|
---|
| 124 | * @param string $orgUnitPath The full path of the organizational unit (minus
|
---|
| 125 | * the leading `/`) or its unique ID.
|
---|
| 126 | * @param OrgUnit $postBody
|
---|
| 127 | * @param array $optParams Optional parameters.
|
---|
| 128 | * @return OrgUnit
|
---|
| 129 | * @throws \Google\Service\Exception
|
---|
| 130 | */
|
---|
| 131 | public function patch($customerId, $orgUnitPath, OrgUnit $postBody, $optParams = [])
|
---|
| 132 | {
|
---|
| 133 | $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath, 'postBody' => $postBody];
|
---|
| 134 | $params = array_merge($params, $optParams);
|
---|
| 135 | return $this->call('patch', [$params], OrgUnit::class);
|
---|
| 136 | }
|
---|
| 137 | /**
|
---|
| 138 | * Updates an organizational unit. (orgunits.update)
|
---|
| 139 | *
|
---|
| 140 | * @param string $customerId The unique ID for the customer's Google Workspace
|
---|
| 141 | * account. As an account administrator, you can also use the `my_customer`
|
---|
| 142 | * alias to represent your account's `customerId`. The `customerId` is also
|
---|
| 143 | * returned as part of the [Users resource](/admin-
|
---|
| 144 | * sdk/directory/v1/reference/users).
|
---|
| 145 | * @param string $orgUnitPath The full path of the organizational unit (minus
|
---|
| 146 | * the leading `/`) or its unique ID.
|
---|
| 147 | * @param OrgUnit $postBody
|
---|
| 148 | * @param array $optParams Optional parameters.
|
---|
| 149 | * @return OrgUnit
|
---|
| 150 | * @throws \Google\Service\Exception
|
---|
| 151 | */
|
---|
| 152 | public function update($customerId, $orgUnitPath, OrgUnit $postBody, $optParams = [])
|
---|
| 153 | {
|
---|
| 154 | $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath, 'postBody' => $postBody];
|
---|
| 155 | $params = array_merge($params, $optParams);
|
---|
| 156 | return $this->call('update', [$params], OrgUnit::class);
|
---|
| 157 | }
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 161 | class_alias(Orgunits::class, 'Google_Service_Directory_Resource_Orgunits');
|
---|