Skip to content

create_ota_task async

create_ota_task(
    s3_url: S3Url,
    ota_type: OtaType,
    *,
    config_overrides: Optional[AsyncIoTManagedIntegrationsClientConfig] = None,
    description: Optional[OtaDescription] = None,
    protocol: Optional[OtaProtocol] = None,
    target: Optional[Target] = None,
    task_configuration_id: Optional[OtaTaskConfigurationId] = None,
    ota_mechanism: Optional[OtaMechanism] = None,
    ota_target_query_string: Optional[OtaTargetQueryString] = None,
    client_token: Optional[ClientToken] = None,
    ota_scheduling_config: Optional[OtaTaskSchedulingConfig] = None,
    ota_task_execution_retry_config: Optional[OtaTaskExecutionRetryConfig] = None,
    tags: Optional[TagsMap] = None,
) -> CreateOtaTaskResponse

Create an over-the-air (OTA) task to target a device.

Parameters:

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

    The description of the over-the-air (OTA) task.

  • s3_url (S3Url) –

    The URL to the Amazon S3 bucket where the over-the-air (OTA) task is stored.

  • protocol (Optional[OtaProtocol], default: None ) –

    The connection protocol the over-the-air (OTA) task uses to update the device.

  • target (Optional[Target], default: None ) –

    The device targeted for the over-the-air (OTA) task.

  • task_configuration_id (Optional[OtaTaskConfigurationId], default: None ) –

    The identifier for the over-the-air (OTA) task configuration.

  • ota_mechanism (Optional[OtaMechanism], default: None ) –

    The deployment mechanism for the over-the-air (OTA) task.

  • ota_type (OtaType) –

    The frequency type for the over-the-air (OTA) task.

  • ota_target_query_string (Optional[OtaTargetQueryString], default: None ) –

    The query string to add things to the thing group.

  • client_token (Optional[ClientToken], default: None ) –

    An idempotency token. If you retry a request that completed successfully initially using the same client token and parameters, then the retry attempt will succeed without performing any further actions.

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

    A set of key/value pairs that are used to manage the over-the-air (OTA) task.

Raises:

Source code in docs_src/capo_iot_managed_integrations/_services/async_io_t_managed_integrations.py
async def create_ota_task(
    self,
    s3_url: "capo_iot_managed_integrations.types.s3_url.S3Url",
    ota_type: "capo_iot_managed_integrations.types.ota_type.OtaType",
    *,
    config_overrides: Optional[AsyncIoTManagedIntegrationsClientConfig] = None,
    description: Optional[
        "capo_iot_managed_integrations.types.ota_description.OtaDescription"
    ] = None,
    protocol: Optional[
        "capo_iot_managed_integrations.types.ota_protocol.OtaProtocol"
    ] = None,
    target: Optional["capo_iot_managed_integrations.types.target.Target"] = None,
    task_configuration_id: Optional[
        "capo_iot_managed_integrations.types.ota_task_configuration_id.OtaTaskConfigurationId"
    ] = None,
    ota_mechanism: Optional[
        "capo_iot_managed_integrations.types.ota_mechanism.OtaMechanism"
    ] = None,
    ota_target_query_string: Optional[
        "capo_iot_managed_integrations.types.ota_target_query_string.OtaTargetQueryString"
    ] = None,
    client_token: Optional[
        "capo_iot_managed_integrations.types.client_token.ClientToken"
    ] = None,
    ota_scheduling_config: Optional[
        "capo_iot_managed_integrations.types.ota_task_scheduling_config.OtaTaskSchedulingConfig"
    ] = None,
    ota_task_execution_retry_config: Optional[
        "capo_iot_managed_integrations.types.ota_task_execution_retry_config.OtaTaskExecutionRetryConfig"
    ] = None,
    tags: Optional["capo_iot_managed_integrations.types.tags_map.TagsMap"] = None,
) -> "capo_iot_managed_integrations.types.create_ota_task_response.CreateOtaTaskResponse":
    """<p>Create an over-the-air (OTA) task to target a device.</p>

    Args:
        description: <p>The description of the over-the-air (OTA) task.</p>
        s3_url: <p>The URL to the Amazon S3 bucket where the over-the-air (OTA) task is stored.</p>
        protocol: <p>The connection protocol the over-the-air (OTA) task uses to update the device.</p>
        target: <p>The device targeted for the over-the-air (OTA) task.</p>
        task_configuration_id: <p>The identifier for the over-the-air (OTA) task configuration.</p>
        ota_mechanism: <p>The deployment mechanism for the over-the-air (OTA) task.</p>
        ota_type: <p>The frequency type for the over-the-air (OTA) task.</p>
        ota_target_query_string: <p>The query string to add things to the thing group.</p>
        client_token: <p>An idempotency token. If you retry a request that completed successfully initially using the same client token and parameters, then the retry attempt will succeed without performing any further actions.</p>
        tags: <p>A set of key/value pairs that are used to manage the over-the-air (OTA) task.</p>

    Raises:
        capo_iot_managed_integrations.errors.access_denied_exception.AccessDeniedException: <p>User is not authorized.</p>
        capo_iot_managed_integrations.errors.conflict_exception.ConflictException: <p>There is a conflict with the request.</p>
        capo_iot_managed_integrations.errors.internal_server_exception.InternalServerException: <p>Internal error from the service that indicates an unexpected error or that the service is unavailable.</p>
        capo_iot_managed_integrations.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot_managed_integrations.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot_managed_integrations.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot_managed_integrations.errors.validation_exception.ValidationException: <p>A validation error occurred when performing the API request.</p>
        capo_iot_managed_integrations.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot_managed_integrations.types.create_ota_task_request.CreateOtaTaskRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot_managed_integrations.types.create_ota_task_response.CreateOtaTaskResponse"
    ]:
        import capo_iot_managed_integrations._operations.iot_managed_integrations.create_ota_task

        (
            output,
            http_response,
        ) = await capo_iot_managed_integrations._operations.iot_managed_integrations.create_ota_task.async_create_ota_task(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_iot_managed_integrations.types.create_ota_task_request.CreateOtaTaskRequest",
    ) -> dict[str, Any]:
        import capo_iot_managed_integrations.types.create_ota_task_request

        return capo_iot_managed_integrations.types.create_ota_task_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateOtaTask", redact_input=_redact_input),
    )
    input_: capo_iot_managed_integrations.types.create_ota_task_request.CreateOtaTaskRequest = {
        "s3_url": s3_url,
        "ota_type": ota_type,
    }
    if description is not None:
        input_["description"] = description
    if protocol is not None:
        input_["protocol"] = protocol
    if target is not None:
        input_["target"] = target
    if task_configuration_id is not None:
        input_["task_configuration_id"] = task_configuration_id
    if ota_mechanism is not None:
        input_["ota_mechanism"] = ota_mechanism
    if ota_target_query_string is not None:
        input_["ota_target_query_string"] = ota_target_query_string
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if ota_scheduling_config is not None:
        input_["ota_scheduling_config"] = ota_scheduling_config
    if ota_task_execution_retry_config is not None:
        input_["ota_task_execution_retry_config"] = ota_task_execution_retry_config
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output