Skip to content

create_campaign

create_campaign(
    name: campaignName,
    signal_catalog_arn: arn,
    target_arn: arn,
    collection_scheme: CollectionScheme,
    *,
    config_overrides: Optional[IoTFleetWiseClientConfig] = None,
    description: Optional[description] = None,
    start_time: Optional[timestamp] = None,
    expiry_time: Optional[timestamp] = None,
    post_trigger_collection_duration: Optional[uint32] = None,
    diagnostics_mode: Optional[DiagnosticsMode] = None,
    spooling_mode: Optional[SpoolingMode] = None,
    compression: Optional[Compression] = None,
    priority: Optional[priority] = None,
    signals_to_collect: Optional[SignalInformationList] = None,
    data_extra_dimensions: Optional[DataExtraDimensionNodePathList] = None,
    tags: Optional[TagList] = None,
    data_destination_configs: Optional[DataDestinationConfigs] = None,
    data_partitions: Optional[DataPartitions] = None,
    signals_to_fetch: Optional[SignalFetchInformationList] = None,
) -> CreateCampaignResponse

Creates an orchestration of data collection rules. The Amazon Web Services IoT FleetWise Edge Agent software running in vehicles uses campaigns to decide how to collect and transfer data to the cloud. You create campaigns in the cloud. After you or your team approve campaigns, Amazon Web Services IoT FleetWise automatically deploys them to vehicles.

For more information, see Collect and transfer data with campaigns in the Amazon Web Services IoT FleetWise Developer Guide.

Access to certain Amazon Web Services IoT FleetWise features is currently gated. For more information, see Amazon Web Services Region and feature availability in the Amazon Web Services IoT FleetWise Developer Guide.

Parameters:

  • name (campaignName) –

    The name of the campaign to create.

  • description (Optional[description], default: None ) –

    An optional description of the campaign to help identify its purpose.

  • signal_catalog_arn (arn) –

    The Amazon Resource Name (ARN) of the signal catalog to associate with the campaign.

  • target_arn (arn) –

    The ARN of the vehicle or fleet to deploy a campaign to.

  • start_time (Optional[timestamp], default: None ) –

    The time, in milliseconds, to deliver a campaign after it was approved. If it's not specified, 0 is used.

    Default: 0

  • expiry_time (Optional[timestamp], default: None ) –

    The time the campaign expires, in seconds since epoch (January 1, 1970 at midnight UTC time). Vehicle data isn't collected after the campaign expires.

    Default: 253402214400 (December 31, 9999, 00:00:00 UTC)

  • post_trigger_collection_duration (Optional[uint32], default: None ) –

    How long (in milliseconds) to collect raw data after a triggering event initiates the collection. If it's not specified, 0 is used.

    Default: 0

  • diagnostics_mode (Optional[DiagnosticsMode], default: None ) –

    Option for a vehicle to send diagnostic trouble codes to Amazon Web Services IoT FleetWise. If you want to send diagnostic trouble codes, use SEND_ACTIVE_DTCS. If it's not specified, OFF is used.

    Default: OFF

  • spooling_mode (Optional[SpoolingMode], default: None ) –

    Determines whether to store collected data after a vehicle lost a connection with the cloud. After a connection is re-established, the data is automatically forwarded to Amazon Web Services IoT FleetWise. If you want to store collected data when a vehicle loses connection with the cloud, use TO_DISK. If it's not specified, OFF is used.

    Default: OFF

  • compression (Optional[Compression], default: None ) –

    Determines whether to compress signals before transmitting data to Amazon Web Services IoT FleetWise. If you don't want to compress the signals, use OFF. If it's not specified, SNAPPY is used.

    Default: SNAPPY

  • priority (Optional[priority], default: None ) –

    A number indicating the priority of one campaign over another campaign for a certain vehicle or fleet. A campaign with the lowest value is deployed to vehicles before any other campaigns. If it's not specified, 0 is used.

    Default: 0

  • signals_to_collect (Optional[SignalInformationList], default: None ) –

    A list of information about signals to collect.

    If you upload a signal as a condition in a data partition for a campaign, then those same signals must be included in signalsToCollect.

  • collection_scheme (CollectionScheme) –

    The data collection scheme associated with the campaign. You can specify a scheme that collects data based on time or an event.

  • data_extra_dimensions (Optional[DataExtraDimensionNodePathList], default: None ) –

    A list of vehicle attributes to associate with a campaign.

    Enrich the data with specified vehicle attributes. For example, add make and model to the campaign, and Amazon Web Services IoT FleetWise will associate the data with those attributes as dimensions in Amazon Timestream. You can then query the data against make and model.

    Default: An empty array

  • tags (Optional[TagList], default: None ) –

    Metadata that can be used to manage the campaign.

  • data_destination_configs (Optional[DataDestinationConfigs], default: None ) –

    The destination where the campaign sends data. You can send data to an MQTT topic, or store it in Amazon S3 or Amazon Timestream.

    MQTT is the publish/subscribe messaging protocol used by Amazon Web Services IoT to communicate with your devices.

    Amazon S3 optimizes the cost of data storage and provides additional mechanisms to use vehicle data, such as data lakes, centralized data storage, data processing pipelines, and analytics. Amazon Web Services IoT FleetWise supports at-least-once file delivery to S3. Your vehicle data is stored on multiple Amazon Web Services IoT FleetWise servers for redundancy and high availability.

    You can use Amazon Timestream to access and analyze time series data, and Timestream to query vehicle data so that you can identify trends and patterns.

  • data_partitions (Optional[DataPartitions], default: None ) –

    The data partitions associated with the signals collected from the vehicle.

  • signals_to_fetch (Optional[SignalFetchInformationList], default: None ) –

    A list of information about signals to fetch.

Raises:

Source code in docs_src/capo_iotfleetwise/_services/io_t_fleet_wise.py
def create_campaign(
    self,
    name: "capo_iotfleetwise.types.campaign_name.campaignName",
    signal_catalog_arn: "capo_iotfleetwise.types.arn.arn",
    target_arn: "capo_iotfleetwise.types.arn.arn",
    collection_scheme: "capo_iotfleetwise.types.collection_scheme.CollectionScheme",
    *,
    config_overrides: Optional[IoTFleetWiseClientConfig] = None,
    description: Optional["capo_iotfleetwise.types.description.description"] = None,
    start_time: Optional["capo_iotfleetwise.types.timestamp.timestamp"] = None,
    expiry_time: Optional["capo_iotfleetwise.types.timestamp.timestamp"] = None,
    post_trigger_collection_duration: Optional[
        "capo_iotfleetwise.types.uint32.uint32"
    ] = None,
    diagnostics_mode: Optional[
        "capo_iotfleetwise.types.diagnostics_mode.DiagnosticsMode"
    ] = None,
    spooling_mode: Optional[
        "capo_iotfleetwise.types.spooling_mode.SpoolingMode"
    ] = None,
    compression: Optional["capo_iotfleetwise.types.compression.Compression"] = None,
    priority: Optional["capo_iotfleetwise.types.priority.priority"] = None,
    signals_to_collect: Optional[
        "capo_iotfleetwise.types.signal_information_list.SignalInformationList"
    ] = None,
    data_extra_dimensions: Optional[
        "capo_iotfleetwise.types.data_extra_dimension_node_path_list.DataExtraDimensionNodePathList"
    ] = None,
    tags: Optional["capo_iotfleetwise.types.tag_list.TagList"] = None,
    data_destination_configs: Optional[
        "capo_iotfleetwise.types.data_destination_configs.DataDestinationConfigs"
    ] = None,
    data_partitions: Optional[
        "capo_iotfleetwise.types.data_partitions.DataPartitions"
    ] = None,
    signals_to_fetch: Optional[
        "capo_iotfleetwise.types.signal_fetch_information_list.SignalFetchInformationList"
    ] = None,
) -> "capo_iotfleetwise.types.create_campaign_response.CreateCampaignResponse":
    """<p>Creates an orchestration of data collection rules. The Amazon Web Services IoT FleetWise Edge Agent software running in vehicles uses campaigns to decide how to collect and transfer data to the cloud. You create campaigns in the cloud. After you or your team approve campaigns, Amazon Web Services IoT FleetWise automatically deploys them to vehicles. </p> <p>For more information, see <a href="https://docs.aws.amazon.com/iot-fleetwise/latest/developerguide/campaigns.html">Collect and transfer data with campaigns</a> in the <i>Amazon Web Services IoT FleetWise Developer Guide</i>.</p> <important> <p>Access to certain Amazon Web Services IoT FleetWise features is currently gated. For more information, see <a href="https://docs.aws.amazon.com/iot-fleetwise/latest/developerguide/fleetwise-regions.html">Amazon Web Services Region and feature availability</a> in the <i>Amazon Web Services IoT FleetWise Developer Guide</i>.</p> </important>

    Args:
        name: <p> The name of the campaign to create. </p>
        description: <p>An optional description of the campaign to help identify its purpose.</p>
        signal_catalog_arn: <p>The Amazon Resource Name (ARN) of the signal catalog to associate with the campaign. </p>
        target_arn: <p> The ARN of the vehicle or fleet to deploy a campaign to. </p>
        start_time: <p>The time, in milliseconds, to deliver a campaign after it was approved. If it's not specified, <code>0</code> is used.</p> <p>Default: <code>0</code> </p>
        expiry_time: <p>The time the campaign expires, in seconds since epoch (January 1, 1970 at midnight UTC time). Vehicle data isn't collected after the campaign expires. </p> <p>Default: 253402214400 (December 31, 9999, 00:00:00 UTC)</p>
        post_trigger_collection_duration: <p>How long (in milliseconds) to collect raw data after a triggering event initiates the collection. If it's not specified, <code>0</code> is used.</p> <p>Default: <code>0</code> </p>
        diagnostics_mode: <p>Option for a vehicle to send diagnostic trouble codes to Amazon Web Services IoT FleetWise. If you want to send diagnostic trouble codes, use <code>SEND_ACTIVE_DTCS</code>. If it's not specified, <code>OFF</code> is used.</p> <p>Default: <code>OFF</code> </p>
        spooling_mode: <p>Determines whether to store collected data after a vehicle lost a connection with the cloud. After a connection is re-established, the data is automatically forwarded to Amazon Web Services IoT FleetWise. If you want to store collected data when a vehicle loses connection with the cloud, use <code>TO_DISK</code>. If it's not specified, <code>OFF</code> is used.</p> <p>Default: <code>OFF</code> </p>
        compression: <p>Determines whether to compress signals before transmitting data to Amazon Web Services IoT FleetWise. If you don't want to compress the signals, use <code>OFF</code>. If it's not specified, <code>SNAPPY</code> is used. </p> <p>Default: <code>SNAPPY</code> </p>
        priority: <p>A number indicating the priority of one campaign over another campaign for a certain vehicle or fleet. A campaign with the lowest value is deployed to vehicles before any other campaigns. If it's not specified, <code>0</code> is used. </p> <p>Default: <code>0</code> </p>
        signals_to_collect: <p>A list of information about signals to collect. </p> <note> <p>If you upload a signal as a condition in a data partition for a campaign, then those same signals must be included in <code>signalsToCollect</code>.</p> </note>
        collection_scheme: <p> The data collection scheme associated with the campaign. You can specify a scheme that collects data based on time or an event.</p>
        data_extra_dimensions: <p>A list of vehicle attributes to associate with a campaign. </p> <p>Enrich the data with specified vehicle attributes. For example, add <code>make</code> and <code>model</code> to the campaign, and Amazon Web Services IoT FleetWise will associate the data with those attributes as dimensions in Amazon Timestream. You can then query the data against <code>make</code> and <code>model</code>.</p> <p>Default: An empty array</p>
        tags: <p>Metadata that can be used to manage the campaign.</p>
        data_destination_configs: <p>The destination where the campaign sends data. You can send data to an MQTT topic, or store it in Amazon S3 or Amazon Timestream.</p> <p>MQTT is the publish/subscribe messaging protocol used by Amazon Web Services IoT to communicate with your devices.</p> <p>Amazon S3 optimizes the cost of data storage and provides additional mechanisms to use vehicle data, such as data lakes, centralized data storage, data processing pipelines, and analytics. Amazon Web Services IoT FleetWise supports at-least-once file delivery to S3. Your vehicle data is stored on multiple Amazon Web Services IoT FleetWise servers for redundancy and high availability.</p> <p>You can use Amazon Timestream to access and analyze time series data, and Timestream to query vehicle data so that you can identify trends and patterns.</p>
        data_partitions: <p>The data partitions associated with the signals collected from the vehicle.</p>
        signals_to_fetch: <p>A list of information about signals to fetch.</p>

    Raises:
        capo_iotfleetwise.errors.internal_server_exception.InternalServerException: <p>The request couldn't be completed because the server temporarily failed.</p>
        capo_iotfleetwise.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permission to perform this action.</p>
        capo_iotfleetwise.errors.conflict_exception.ConflictException: <p>The request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time.</p>
        capo_iotfleetwise.errors.limit_exceeded_exception.LimitExceededException: <p>A service quota was exceeded. </p>
        capo_iotfleetwise.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource wasn't found.</p>
        capo_iotfleetwise.errors.throttling_exception.ThrottlingException: <p>The request couldn't be completed due to throttling.</p>
        capo_iotfleetwise.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_iotfleetwise.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iotfleetwise.types.create_campaign_request.CreateCampaignRequest]",
    ) -> OperationResponse[
        "capo_iotfleetwise.types.create_campaign_response.CreateCampaignResponse"
    ]:
        import capo_iotfleetwise._operations.io_t_autobahn_control_plane.create_campaign

        output, http_response = (
            capo_iotfleetwise._operations.io_t_autobahn_control_plane.create_campaign.create_campaign(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_iotfleetwise.types.create_campaign_request.CreateCampaignRequest",
    ) -> dict[str, Any]:
        import capo_iotfleetwise.types.create_campaign_request

        return capo_iotfleetwise.types.create_campaign_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCampaign", redact_input=_redact_input),
    )
    input_: capo_iotfleetwise.types.create_campaign_request.CreateCampaignRequest = {
        "name": name,
        "signal_catalog_arn": signal_catalog_arn,
        "target_arn": target_arn,
        "collection_scheme": collection_scheme,
    }
    if description is not None:
        input_["description"] = description
    if start_time is not None:
        input_["start_time"] = start_time
    if expiry_time is not None:
        input_["expiry_time"] = expiry_time
    if post_trigger_collection_duration is not None:
        input_["post_trigger_collection_duration"] = (
            post_trigger_collection_duration
        )
    if diagnostics_mode is not None:
        input_["diagnostics_mode"] = diagnostics_mode
    if spooling_mode is not None:
        input_["spooling_mode"] = spooling_mode
    if compression is not None:
        input_["compression"] = compression
    if priority is not None:
        input_["priority"] = priority
    if signals_to_collect is not None:
        input_["signals_to_collect"] = signals_to_collect
    if data_extra_dimensions is not None:
        input_["data_extra_dimensions"] = data_extra_dimensions
    if tags is not None:
        input_["tags"] = tags
    if data_destination_configs is not None:
        input_["data_destination_configs"] = data_destination_configs
    if data_partitions is not None:
        input_["data_partitions"] = data_partitions
    if signals_to_fetch is not None:
        input_["signals_to_fetch"] = signals_to_fetch

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output