[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\AndroidEnterprise\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\AndroidEnterprise\Device;
|
---|
| 21 | use Google\Service\AndroidEnterprise\DeviceState;
|
---|
| 22 | use Google\Service\AndroidEnterprise\DevicesListResponse;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "devices" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $androidenterpriseService = new Google\Service\AndroidEnterprise(...);
|
---|
| 29 | * $devices = $androidenterpriseService->devices;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class Devices extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Uploads a report containing any changes in app states on the device since the
|
---|
| 36 | * last report was generated. You can call this method up to 3 times every 24
|
---|
| 37 | * hours for a given device. If you exceed the quota, then the Google Play EMM
|
---|
| 38 | * API returns HTTP 429 Too Many Requests. (devices.forceReportUpload)
|
---|
| 39 | *
|
---|
| 40 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 41 | * @param string $userId The ID of the user.
|
---|
| 42 | * @param string $deviceId The ID of the device.
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | * @throws \Google\Service\Exception
|
---|
| 45 | */
|
---|
| 46 | public function forceReportUpload($enterpriseId, $userId, $deviceId, $optParams = [])
|
---|
| 47 | {
|
---|
| 48 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId, 'deviceId' => $deviceId];
|
---|
| 49 | $params = array_merge($params, $optParams);
|
---|
| 50 | return $this->call('forceReportUpload', [$params]);
|
---|
| 51 | }
|
---|
| 52 | /**
|
---|
| 53 | * Retrieves the details of a device. (devices.get)
|
---|
| 54 | *
|
---|
| 55 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 56 | * @param string $userId The ID of the user.
|
---|
| 57 | * @param string $deviceId The ID of the device.
|
---|
| 58 | * @param array $optParams Optional parameters.
|
---|
| 59 | * @return Device
|
---|
| 60 | * @throws \Google\Service\Exception
|
---|
| 61 | */
|
---|
| 62 | public function get($enterpriseId, $userId, $deviceId, $optParams = [])
|
---|
| 63 | {
|
---|
| 64 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId, 'deviceId' => $deviceId];
|
---|
| 65 | $params = array_merge($params, $optParams);
|
---|
| 66 | return $this->call('get', [$params], Device::class);
|
---|
| 67 | }
|
---|
| 68 | /**
|
---|
| 69 | * Retrieves whether a device's access to Google services is enabled or
|
---|
| 70 | * disabled. The device state takes effect only if enforcing EMM policies on
|
---|
| 71 | * Android devices is enabled in the Google Admin Console. Otherwise, the device
|
---|
| 72 | * state is ignored and all devices are allowed access to Google services. This
|
---|
| 73 | * is only supported for Google-managed users. (devices.getState)
|
---|
| 74 | *
|
---|
| 75 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 76 | * @param string $userId The ID of the user.
|
---|
| 77 | * @param string $deviceId The ID of the device.
|
---|
| 78 | * @param array $optParams Optional parameters.
|
---|
| 79 | * @return DeviceState
|
---|
| 80 | * @throws \Google\Service\Exception
|
---|
| 81 | */
|
---|
| 82 | public function getState($enterpriseId, $userId, $deviceId, $optParams = [])
|
---|
| 83 | {
|
---|
| 84 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId, 'deviceId' => $deviceId];
|
---|
| 85 | $params = array_merge($params, $optParams);
|
---|
| 86 | return $this->call('getState', [$params], DeviceState::class);
|
---|
| 87 | }
|
---|
| 88 | /**
|
---|
| 89 | * Retrieves the IDs of all of a user's devices. (devices.listDevices)
|
---|
| 90 | *
|
---|
| 91 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 92 | * @param string $userId The ID of the user.
|
---|
| 93 | * @param array $optParams Optional parameters.
|
---|
| 94 | * @return DevicesListResponse
|
---|
| 95 | * @throws \Google\Service\Exception
|
---|
| 96 | */
|
---|
| 97 | public function listDevices($enterpriseId, $userId, $optParams = [])
|
---|
| 98 | {
|
---|
| 99 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId];
|
---|
| 100 | $params = array_merge($params, $optParams);
|
---|
| 101 | return $this->call('list', [$params], DevicesListResponse::class);
|
---|
| 102 | }
|
---|
| 103 | /**
|
---|
| 104 | * Sets whether a device's access to Google services is enabled or disabled. The
|
---|
| 105 | * device state takes effect only if enforcing EMM policies on Android devices
|
---|
| 106 | * is enabled in the Google Admin Console. Otherwise, the device state is
|
---|
| 107 | * ignored and all devices are allowed access to Google services. This is only
|
---|
| 108 | * supported for Google-managed users. (devices.setState)
|
---|
| 109 | *
|
---|
| 110 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 111 | * @param string $userId The ID of the user.
|
---|
| 112 | * @param string $deviceId The ID of the device.
|
---|
| 113 | * @param DeviceState $postBody
|
---|
| 114 | * @param array $optParams Optional parameters.
|
---|
| 115 | * @return DeviceState
|
---|
| 116 | * @throws \Google\Service\Exception
|
---|
| 117 | */
|
---|
| 118 | public function setState($enterpriseId, $userId, $deviceId, DeviceState $postBody, $optParams = [])
|
---|
| 119 | {
|
---|
| 120 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId, 'deviceId' => $deviceId, 'postBody' => $postBody];
|
---|
| 121 | $params = array_merge($params, $optParams);
|
---|
| 122 | return $this->call('setState', [$params], DeviceState::class);
|
---|
| 123 | }
|
---|
| 124 | /**
|
---|
| 125 | * Updates the device policy. To ensure the policy is properly enforced, you
|
---|
| 126 | * need to prevent unmanaged accounts from accessing Google Play by setting the
|
---|
| 127 | * allowed_accounts in the managed configuration for the Google Play package.
|
---|
| 128 | * See restrict accounts in Google Play. When provisioning a new device, you
|
---|
| 129 | * should set the device policy using this method before adding the managed
|
---|
| 130 | * Google Play Account to the device, otherwise the policy will not be applied
|
---|
| 131 | * for a short period of time after adding the account to the device.
|
---|
| 132 | * (devices.update)
|
---|
| 133 | *
|
---|
| 134 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 135 | * @param string $userId The ID of the user.
|
---|
| 136 | * @param string $deviceId The ID of the device.
|
---|
| 137 | * @param Device $postBody
|
---|
| 138 | * @param array $optParams Optional parameters.
|
---|
| 139 | *
|
---|
| 140 | * @opt_param string updateMask Mask that identifies which fields to update. If
|
---|
| 141 | * not set, all modifiable fields will be modified. When set in a query
|
---|
| 142 | * parameter, this field should be specified as updateMask=,,...
|
---|
| 143 | * @return Device
|
---|
| 144 | * @throws \Google\Service\Exception
|
---|
| 145 | */
|
---|
| 146 | public function update($enterpriseId, $userId, $deviceId, Device $postBody, $optParams = [])
|
---|
| 147 | {
|
---|
| 148 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId, 'deviceId' => $deviceId, 'postBody' => $postBody];
|
---|
| 149 | $params = array_merge($params, $optParams);
|
---|
| 150 | return $this->call('update', [$params], Device::class);
|
---|
| 151 | }
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 155 | class_alias(Devices::class, 'Google_Service_AndroidEnterprise_Resource_Devices');
|
---|