createStateTemplate method

Future<CreateStateTemplateResponse> createStateTemplate({
  1. required String name,
  2. required String signalCatalogArn,
  3. required List<String> stateTemplateProperties,
  4. List<String>? dataExtraDimensions,
  5. String? description,
  6. List<String>? metadataExtraDimensions,
  7. List<Tag>? tags,
})

Creates a state template. State templates contain state properties, which are signals that belong to a signal catalog that is synchronized between the Amazon Web Services IoT FleetWise Edge and the Amazon Web Services Cloud.

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

Parameter name : The name of the state template.

Parameter signalCatalogArn : The ARN of the signal catalog associated with the state template.

Parameter stateTemplateProperties : A list of signals from which data is collected. The state template properties contain the fully qualified names of the signals.

Parameter dataExtraDimensions : A list of vehicle attributes to associate with the payload published on the state template's MQTT topic. (See Processing last known state vehicle data using MQTT messaging). For example, if you add Vehicle.Attributes.Make and Vehicle.Attributes.Model attributes, Amazon Web Services IoT FleetWise will enrich the protobuf encoded payload with those attributes in the extraDimensions field.

Parameter description : A brief description of the state template.

Parameter metadataExtraDimensions : A list of vehicle attributes to associate with user properties of the messages published on the state template's MQTT topic. (See Processing last known state vehicle data using MQTT messaging). For example, if you add Vehicle.Attributes.Make and Vehicle.Attributes.Model attributes, Amazon Web Services IoT FleetWise will include these attributes as User Properties with the MQTT message.

Default: An empty array

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

Implementation

Future<CreateStateTemplateResponse> createStateTemplate({
  required String name,
  required String signalCatalogArn,
  required List<String> stateTemplateProperties,
  List<String>? dataExtraDimensions,
  String? description,
  List<String>? metadataExtraDimensions,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'IoTAutobahnControlPlane.CreateStateTemplate'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'signalCatalogArn': signalCatalogArn,
      'stateTemplateProperties': stateTemplateProperties,
      if (dataExtraDimensions != null)
        'dataExtraDimensions': dataExtraDimensions,
      if (description != null) 'description': description,
      if (metadataExtraDimensions != null)
        'metadataExtraDimensions': metadataExtraDimensions,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateStateTemplateResponse.fromJson(jsonResponse.body);
}