updateVehicle method

Future<UpdateVehicleResponse> updateVehicle({
  1. required String vehicleName,
  2. UpdateMode? attributeUpdateMode,
  3. Map<String, String>? attributes,
  4. String? decoderManifestArn,
  5. String? modelManifestArn,
  6. List<StateTemplateAssociation>? stateTemplatesToAdd,
  7. List<String>? stateTemplatesToRemove,
  8. List<StateTemplateAssociation>? stateTemplatesToUpdate,
})

Updates a vehicle.

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

Parameter vehicleName : The unique ID of the vehicle to update.

Parameter attributeUpdateMode : The method the specified attributes will update the existing attributes on the vehicle. UseOverwite to replace the vehicle attributes with the specified attributes. Or use Merge to combine all attributes.

This is required if attributes are present in the input.

Parameter attributes : Static information about a vehicle in a key-value pair. For example:

"engineType" : "1.3 L R2"

Parameter decoderManifestArn : The ARN of the decoder manifest associated with this vehicle.

Parameter modelManifestArn : The ARN of a vehicle model (model manifest) associated with the vehicle.

Parameter stateTemplatesToAdd : Associate state templates with the vehicle.

Parameter stateTemplatesToRemove : Remove state templates from the vehicle.

Parameter stateTemplatesToUpdate : Change the stateTemplateUpdateStrategy of state templates already associated with the vehicle.

Implementation

Future<UpdateVehicleResponse> updateVehicle({
  required String vehicleName,
  UpdateMode? attributeUpdateMode,
  Map<String, String>? attributes,
  String? decoderManifestArn,
  String? modelManifestArn,
  List<StateTemplateAssociation>? stateTemplatesToAdd,
  List<String>? stateTemplatesToRemove,
  List<StateTemplateAssociation>? stateTemplatesToUpdate,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'IoTAutobahnControlPlane.UpdateVehicle'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'vehicleName': vehicleName,
      if (attributeUpdateMode != null)
        'attributeUpdateMode': attributeUpdateMode.value,
      if (attributes != null) 'attributes': attributes,
      if (decoderManifestArn != null)
        'decoderManifestArn': decoderManifestArn,
      if (modelManifestArn != null) 'modelManifestArn': modelManifestArn,
      if (stateTemplatesToAdd != null)
        'stateTemplatesToAdd': stateTemplatesToAdd,
      if (stateTemplatesToRemove != null)
        'stateTemplatesToRemove': stateTemplatesToRemove,
      if (stateTemplatesToUpdate != null)
        'stateTemplatesToUpdate': stateTemplatesToUpdate,
    },
  );

  return UpdateVehicleResponse.fromJson(jsonResponse.body);
}