private void ProcessRequest(Instance request) { try { var device = new ChromeOsDevice { AnnotatedLocation = String.IsNullOrEmpty(AnnotatedLocation) ? null : AnnotatedLocation, AnnotatedUser = String.IsNullOrEmpty(AnnotatedUser) ? null : AnnotatedUser, Notes = String.IsNullOrEmpty(Notes) ? null : Notes }; var service = request.DirectoryService.Chromeosdevices.Update(device, "my_customer", DeviceId); service.Projection = ChromeosdevicesResource.UpdateRequest.ProjectionEnum.FULL; service.Execute(); } catch (Exception e) { Console.WriteLine("Failed to Update Chrome Device!"); Console.WriteLine("Error: " + e); } }
/// <summary> /// Update Chrome OS Device /// Documentation https://developers.google.com/directory/directory_v1/reference/chromeosdevices/update /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Directory service.</param> /// <param name="customerId">Immutable ID of the G Suite account</param> /// <param name="deviceId">Immutable ID of Chrome OS Device</param> /// <param name="body">A valid Directory directory_v1 body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>ChromeOsDeviceResponse</returns> public static ChromeOsDevice Update(DirectoryService service, string customerId, string deviceId, ChromeOsDevice body, ChromeosdevicesUpdateOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (customerId == null) { throw new ArgumentNullException(customerId); } if (deviceId == null) { throw new ArgumentNullException(deviceId); } // Building the initial request. var request = service.Chromeosdevices.Update(body, customerId, deviceId); // Applying optional parameters to the request. request = (ChromeosdevicesResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Chromeosdevices.Update failed.", ex); } }