createVehicle method

Future<CreateVehicleResponse> createVehicle({
  1. required String decoderManifestArn,
  2. required String modelManifestArn,
  3. required String vehicleName,
  4. VehicleAssociationBehavior? associationBehavior,
  5. Map<String, String>? attributes,
  6. List<StateTemplateAssociation>? stateTemplates,
  7. List<Tag>? tags,
})

Creates a vehicle, which is an instance of a vehicle model (model manifest). Vehicles created from the same vehicle model consist of the same signals inherited from the vehicle model. For more information, see Create a vehicle (AWS CLI) in the Amazon Web Services IoT FleetWise Developer Guide.

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

Parameter decoderManifestArn : The ARN of a decoder manifest.

Parameter modelManifestArn : The Amazon Resource Name ARN of a vehicle model.

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

Parameter associationBehavior : An option to create a new Amazon Web Services IoT thing when creating a vehicle, or to validate an existing Amazon Web Services IoT thing as a vehicle.

Default:

Parameter attributes : Static information about a vehicle in a key-value pair. For example: "engineType" : "1.3 L R2"

To use attributes with Campaigns or State Templates, you must include them using the request parameters dataExtraDimensions and/or metadataExtraDimensions (for state templates only) when creating your campaign/state template.

Parameter stateTemplates : Associate state templates with the vehicle. You can monitor the last known state of the vehicle in near real time.

Parameter tags : Metadata that can be used to manage the vehicle.

Implementation

Future<CreateVehicleResponse> createVehicle({
  required String decoderManifestArn,
  required String modelManifestArn,
  required String vehicleName,
  VehicleAssociationBehavior? associationBehavior,
  Map<String, String>? attributes,
  List<StateTemplateAssociation>? stateTemplates,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'IoTAutobahnControlPlane.CreateVehicle'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'decoderManifestArn': decoderManifestArn,
      'modelManifestArn': modelManifestArn,
      'vehicleName': vehicleName,
      if (associationBehavior != null)
        'associationBehavior': associationBehavior.value,
      if (attributes != null) 'attributes': attributes,
      if (stateTemplates != null) 'stateTemplates': stateTemplates,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateVehicleResponse.fromJson(jsonResponse.body);
}