updateDevice method

Future<UpdateDeviceResponse> updateDevice({
  1. required String deviceId,
  2. required String globalNetworkId,
  3. AWSLocation? awsLocation,
  4. String? description,
  5. Location? location,
  6. String? model,
  7. String? serialNumber,
  8. String? siteId,
  9. String? type,
  10. String? vendor,
})

Updates the details for an existing device. To remove information for any of the parameters, specify an empty string.

May throw ValidationException. May throw AccessDeniedException. May throw ResourceNotFoundException. May throw ConflictException. May throw ThrottlingException. May throw InternalServerException.

Parameter deviceId : The ID of the device.

Parameter globalNetworkId : The ID of the global network.

Parameter awsLocation : The AWS location of the device.

Parameter description : A description of the device.

Length Constraints: Maximum length of 256 characters.

Parameter model : The model of the device.

Length Constraints: Maximum length of 128 characters.

Parameter serialNumber : The serial number of the device.

Length Constraints: Maximum length of 128 characters.

Parameter siteId : The ID of the site.

Parameter type : The type of the device.

Parameter vendor : The vendor of the device.

Length Constraints: Maximum length of 128 characters.

Implementation

Future<UpdateDeviceResponse> updateDevice({
  required String deviceId,
  required String globalNetworkId,
  AWSLocation? awsLocation,
  String? description,
  Location? location,
  String? model,
  String? serialNumber,
  String? siteId,
  String? type,
  String? vendor,
}) async {
  ArgumentError.checkNotNull(deviceId, 'deviceId');
  ArgumentError.checkNotNull(globalNetworkId, 'globalNetworkId');
  final $payload = <String, dynamic>{
    if (awsLocation != null) 'AWSLocation': awsLocation,
    if (description != null) 'Description': description,
    if (location != null) 'Location': location,
    if (model != null) 'Model': model,
    if (serialNumber != null) 'SerialNumber': serialNumber,
    if (siteId != null) 'SiteId': siteId,
    if (type != null) 'Type': type,
    if (vendor != null) 'Vendor': vendor,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/global-networks/${Uri.encodeComponent(globalNetworkId)}/devices/${Uri.encodeComponent(deviceId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateDeviceResponse.fromJson(response);
}