update method
Updates the device policy.
To ensure the policy is properly enforced, you need to prevent unmanaged accounts from accessing Google Play by setting the allowed_accounts in the managed configuration for the Google Play package. See restrict accounts in Google Play. When provisioning a new device, you should set the device policy using this method before adding the managed Google Play Account to the device, otherwise the policy will not be applied for a short period of time after adding the account to the device.
request
- The metadata request object.
Request parameters:
enterpriseId
- The ID of the enterprise.
userId
- The ID of the user.
deviceId
- The ID of the device.
updateMask
- Mask that identifies which fields to update. If not set,
all modifiable fields will be modified. When set in a query parameter,
this field should be specified as updateMask=<field1>,<field2>,...
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Device.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Device> update(
Device request,
core.String enterpriseId,
core.String userId,
core.String deviceId, {
core.String? updateMask,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (updateMask != null) 'updateMask': [updateMask],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'androidenterprise/v1/enterprises/' +
commons.escapeVariable('$enterpriseId') +
'/users/' +
commons.escapeVariable('$userId') +
'/devices/' +
commons.escapeVariable('$deviceId');
final response_ = await _requester.request(
url_,
'PUT',
body: body_,
queryParams: queryParams_,
);
return Device.fromJson(response_ as core.Map<core.String, core.dynamic>);
}