Skip to content

create_ota_update

create_ota_update(
    ota_update_id: OTAUpdateId,
    targets: Targets,
    files: OTAUpdateFiles,
    role_arn: RoleArn,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    description: Optional[OTAUpdateDescription] = None,
    protocols: Optional[Protocols] = None,
    target_selection: Optional[TargetSelection] = None,
    aws_job_executions_rollout_config: Optional[AwsJobExecutionsRolloutConfig] = None,
    aws_job_presigned_url_config: Optional[AwsJobPresignedUrlConfig] = None,
    aws_job_abort_config: Optional[AwsJobAbortConfig] = None,
    aws_job_timeout_config: Optional[AwsJobTimeoutConfig] = None,
    additional_parameters: Optional[AdditionalParameterMap] = None,
    tags: Optional[TagList] = None,
) -> CreateOTAUpdateResponse

Creates an IoT OTA update on a target group of things or groups.

Requires permission to access the CreateOTAUpdate action.

Parameters:

  • ota_update_id (OTAUpdateId) –

    The ID of the OTA update to be created.

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

    The description of the OTA update.

  • targets (Targets) –

    The devices targeted to receive OTA updates.

  • protocols (Optional[Protocols], default: None ) –

    The protocol used to transfer the OTA update image. Valid values are [HTTP], [MQTT], [HTTP, MQTT]. When both HTTP and MQTT are specified, the target device can choose the protocol.

  • target_selection (Optional[TargetSelection], default: None ) –

    Specifies whether the update will continue to run (CONTINUOUS), or will be complete after all the things specified as targets have completed the update (SNAPSHOT). If continuous, the update may also be run on a thing when a change is detected in a target. For example, an update will run on a thing when the thing is added to a target group, even after the update was completed by all things originally in the group. Valid values: CONTINUOUS | SNAPSHOT.

  • aws_job_executions_rollout_config (Optional[AwsJobExecutionsRolloutConfig], default: None ) –

    Configuration for the rollout of OTA updates.

  • aws_job_presigned_url_config (Optional[AwsJobPresignedUrlConfig], default: None ) –

    Configuration information for pre-signed URLs.

  • aws_job_abort_config (Optional[AwsJobAbortConfig], default: None ) –

    The criteria that determine when and how a job abort takes place.

  • aws_job_timeout_config (Optional[AwsJobTimeoutConfig], default: None ) –

    Specifies the amount of time each device has to finish its execution of the job. A timer is started when the job execution status is set to IN_PROGRESS. If the job execution status is not set to another terminal state before the timer expires, it will be automatically set to TIMED_OUT.

  • files (OTAUpdateFiles) –

    The files to be streamed by the OTA update.

  • role_arn (RoleArn) –

    The IAM role that grants Amazon Web Services IoT Core access to the Amazon S3, IoT jobs and Amazon Web Services Code Signing resources to create an OTA update job.

  • additional_parameters (Optional[AdditionalParameterMap], default: None ) –

    A list of additional OTA update parameters, which are name-value pairs. They won't be sent to devices as a part of the Job document.

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

    Metadata which can be used to manage updates.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def create_ota_update(
    self,
    ota_update_id: "capo_iot.types.ota_update_id.OTAUpdateId",
    targets: "capo_iot.types.targets.Targets",
    files: "capo_iot.types.ota_update_files.OTAUpdateFiles",
    role_arn: "capo_iot.types.role_arn.RoleArn",
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    description: Optional[
        "capo_iot.types.ota_update_description.OTAUpdateDescription"
    ] = None,
    protocols: Optional["capo_iot.types.protocols.Protocols"] = None,
    target_selection: Optional[
        "capo_iot.types.target_selection.TargetSelection"
    ] = None,
    aws_job_executions_rollout_config: Optional[
        "capo_iot.types.aws_job_executions_rollout_config.AwsJobExecutionsRolloutConfig"
    ] = None,
    aws_job_presigned_url_config: Optional[
        "capo_iot.types.aws_job_presigned_url_config.AwsJobPresignedUrlConfig"
    ] = None,
    aws_job_abort_config: Optional[
        "capo_iot.types.aws_job_abort_config.AwsJobAbortConfig"
    ] = None,
    aws_job_timeout_config: Optional[
        "capo_iot.types.aws_job_timeout_config.AwsJobTimeoutConfig"
    ] = None,
    additional_parameters: Optional[
        "capo_iot.types.additional_parameter_map.AdditionalParameterMap"
    ] = None,
    tags: Optional["capo_iot.types.tag_list.TagList"] = None,
) -> "capo_iot.types.create_ota_update_response.CreateOTAUpdateResponse":
    """<p>Creates an IoT OTA update on a target group of things or groups.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateOTAUpdate</a> action.</p>

    Args:
        ota_update_id: <p>The ID of the OTA update to be created.</p>
        description: <p>The description of the OTA update.</p>
        targets: <p>The devices targeted to receive OTA updates.</p>
        protocols: <p>The protocol used to transfer the OTA update image. Valid values are [HTTP], [MQTT], [HTTP, MQTT]. When both HTTP and MQTT are specified, the target device can choose the protocol.</p>
        target_selection: <p>Specifies whether the update will continue to run (CONTINUOUS), or will be complete after all the things specified as targets have completed the update (SNAPSHOT). If continuous, the update may also be run on a thing when a change is detected in a target. For example, an update will run on a thing when the thing is added to a target group, even after the update was completed by all things originally in the group. Valid values: CONTINUOUS | SNAPSHOT.</p>
        aws_job_executions_rollout_config: <p>Configuration for the rollout of OTA updates.</p>
        aws_job_presigned_url_config: <p>Configuration information for pre-signed URLs.</p>
        aws_job_abort_config: <p>The criteria that determine when and how a job abort takes place.</p>
        aws_job_timeout_config: <p>Specifies the amount of time each device has to finish its execution of the job. A timer is started when the job execution status is set to <code>IN_PROGRESS</code>. If the job execution status is not set to another terminal state before the timer expires, it will be automatically set to <code>TIMED_OUT</code>.</p>
        files: <p>The files to be streamed by the OTA update.</p>
        role_arn: <p>The IAM role that grants Amazon Web Services IoT Core access to the Amazon S3, IoT jobs and Amazon Web Services Code Signing resources to create an OTA update job.</p>
        additional_parameters: <p>A list of additional OTA update parameters, which are name-value pairs. They won't be sent to devices as a part of the Job document.</p>
        tags: <p>Metadata which can be used to manage updates.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.limit_exceeded_exception.LimitExceededException: <p>A limit has been exceeded.</p>
        capo_iot.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.create_ota_update_request.CreateOTAUpdateRequest]",
    ) -> OperationResponse[
        "capo_iot.types.create_ota_update_response.CreateOTAUpdateResponse"
    ]:
        import capo_iot._operations.aws_iot_service.create_ota_update

        output, http_response = (
            capo_iot._operations.aws_iot_service.create_ota_update.create_ota_update(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateOTAUpdate")
    )
    input_: capo_iot.types.create_ota_update_request.CreateOTAUpdateRequest = {
        "ota_update_id": ota_update_id,
        "targets": targets,
        "files": files,
        "role_arn": role_arn,
    }
    if description is not None:
        input_["description"] = description
    if protocols is not None:
        input_["protocols"] = protocols
    if target_selection is not None:
        input_["target_selection"] = target_selection
    if aws_job_executions_rollout_config is not None:
        input_["aws_job_executions_rollout_config"] = (
            aws_job_executions_rollout_config
        )
    if aws_job_presigned_url_config is not None:
        input_["aws_job_presigned_url_config"] = aws_job_presigned_url_config
    if aws_job_abort_config is not None:
        input_["aws_job_abort_config"] = aws_job_abort_config
    if aws_job_timeout_config is not None:
        input_["aws_job_timeout_config"] = aws_job_timeout_config
    if additional_parameters is not None:
        input_["additional_parameters"] = additional_parameters
    if tags is not None:
        input_["tags"] = tags

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