updateCampaign method

Future<UpdateCampaignResponse> updateCampaign({
  1. required UpdateCampaignAction action,
  2. required String name,
  3. List<String>? dataExtraDimensions,
  4. String? description,
})

Updates a campaign.

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

Parameter action : Specifies how to update a campaign. The action can be one of the following:

  • APPROVE - To approve delivering a data collection scheme to vehicles.
  • SUSPEND - To suspend collecting signal data. The campaign is deleted from vehicles and all vehicles in the suspended campaign will stop sending data.
  • RESUME - To reactivate the SUSPEND campaign. The campaign is redeployed to all vehicles and the vehicles will resume sending data.
  • UPDATE - To update a campaign.

Parameter name : The name of the campaign to update.

Parameter dataExtraDimensions : A list of vehicle attributes to associate with a signal.

Default: An empty array

Parameter description : The description of the campaign.

Implementation

Future<UpdateCampaignResponse> updateCampaign({
  required UpdateCampaignAction action,
  required String name,
  List<String>? dataExtraDimensions,
  String? description,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'IoTAutobahnControlPlane.UpdateCampaign'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'action': action.value,
      'name': name,
      if (dataExtraDimensions != null)
        'dataExtraDimensions': dataExtraDimensions,
      if (description != null) 'description': description,
    },
  );

  return UpdateCampaignResponse.fromJson(jsonResponse.body);
}