Skip to content

create_job_template async

create_job_template(
    job_template_id: JobTemplateId,
    description: JobDescription,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    job_arn: Optional[JobArn] = None,
    document_source: Optional[JobDocumentSource] = None,
    document: Optional[JobDocument] = None,
    presigned_url_config: Optional[PresignedUrlConfig] = None,
    job_executions_rollout_config: Optional[JobExecutionsRolloutConfig] = None,
    abort_config: Optional[AbortConfig] = None,
    timeout_config: Optional[TimeoutConfig] = None,
    tags: Optional[TagList] = None,
    job_executions_retry_config: Optional[JobExecutionsRetryConfig] = None,
    maintenance_windows: Optional[MaintenanceWindows] = None,
    destination_package_versions: Optional[DestinationPackageVersions] = None,
) -> CreateJobTemplateResponse

Creates a job template.

Requires permission to access the CreateJobTemplate action.

Parameters:

  • job_template_id (JobTemplateId) –

    A unique identifier for the job template. We recommend using a UUID. Alpha-numeric characters, "-", and "_" are valid for use here.

  • job_arn (Optional[JobArn], default: None ) –

    The ARN of the job to use as the basis for the job template.

  • document_source (Optional[JobDocumentSource], default: None ) –

    An S3 link, or S3 object URL, to the job document. The link is an Amazon S3 object URL and is required if you don't specify a value for document.

    For example, --document-source https://s3.region-code.amazonaws.com/example-firmware/device-firmware.1.0

    For more information, see Methods for accessing a bucket.

  • document (Optional[JobDocument], default: None ) –

    The job document. Required if you don't specify a value for documentSource.

  • description (JobDescription) –

    A description of the job document.

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

    Metadata that can be used to manage the job template.

  • job_executions_retry_config (Optional[JobExecutionsRetryConfig], default: None ) –

    Allows you to create the criteria to retry a job.

  • maintenance_windows (Optional[MaintenanceWindows], default: None ) –

    Allows you to configure an optional maintenance window for the rollout of a job document to all devices in the target group for a job.

  • destination_package_versions (Optional[DestinationPackageVersions], default: None ) –

    The package version Amazon Resource Names (ARNs) that are installed on the device when the job successfully completes. The package version must be in either the Published or Deprecated state when the job deploys. For more information, see Package version lifecycle.

    Note:The following Length Constraints relates to a single ARN. Up to 25 package version ARNs are allowed.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def create_job_template(
    self,
    job_template_id: "capo_iot.types.job_template_id.JobTemplateId",
    description: "capo_iot.types.job_description.JobDescription",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    job_arn: Optional["capo_iot.types.job_arn.JobArn"] = None,
    document_source: Optional[
        "capo_iot.types.job_document_source.JobDocumentSource"
    ] = None,
    document: Optional["capo_iot.types.job_document.JobDocument"] = None,
    presigned_url_config: Optional[
        "capo_iot.types.presigned_url_config.PresignedUrlConfig"
    ] = None,
    job_executions_rollout_config: Optional[
        "capo_iot.types.job_executions_rollout_config.JobExecutionsRolloutConfig"
    ] = None,
    abort_config: Optional["capo_iot.types.abort_config.AbortConfig"] = None,
    timeout_config: Optional["capo_iot.types.timeout_config.TimeoutConfig"] = None,
    tags: Optional["capo_iot.types.tag_list.TagList"] = None,
    job_executions_retry_config: Optional[
        "capo_iot.types.job_executions_retry_config.JobExecutionsRetryConfig"
    ] = None,
    maintenance_windows: Optional[
        "capo_iot.types.maintenance_windows.MaintenanceWindows"
    ] = None,
    destination_package_versions: Optional[
        "capo_iot.types.destination_package_versions.DestinationPackageVersions"
    ] = None,
) -> "capo_iot.types.create_job_template_response.CreateJobTemplateResponse":
    """<p>Creates a job template.</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">CreateJobTemplate</a> action.</p>

    Args:
        job_template_id: <p>A unique identifier for the job template. We recommend using a UUID. Alpha-numeric characters, "-", and "_" are valid for use here.</p>
        job_arn: <p>The ARN of the job to use as the basis for the job template.</p>
        document_source: <p>An S3 link, or S3 object URL, to the job document. The link is an Amazon S3 object URL and is required if you don't specify a value for <code>document</code>.</p> <p>For example, <code>--document-source https://s3.<i>region-code</i>.amazonaws.com/example-firmware/device-firmware.1.0</code> </p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html">Methods for accessing a bucket</a>.</p>
        document: <p>The job document. Required if you don't specify a value for <code>documentSource</code>.</p>
        description: <p>A description of the job document.</p>
        tags: <p>Metadata that can be used to manage the job template.</p>
        job_executions_retry_config: <p>Allows you to create the criteria to retry a job.</p>
        maintenance_windows: <p>Allows you to configure an optional maintenance window for the rollout of a job document to all devices in the target group for a job.</p>
        destination_package_versions: <p>The package version Amazon Resource Names (ARNs) that are installed on the device when the job successfully completes. The package version must be in either the Published or Deprecated state when the job deploys. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/preparing-to-use-software-package-catalog.html#package-version-lifecycle">Package version lifecycle</a>.</p> <p> <b>Note:</b>The following Length Constraints relates to a single ARN. Up to 25 package version ARNs are allowed.</p>

    Raises:
        capo_iot.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        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_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.create_job_template_request.CreateJobTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.create_job_template_response.CreateJobTemplateResponse"
    ]:
        import capo_iot._operations.aws_iot_service.create_job_template

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.create_job_template.async_create_job_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateJobTemplate")
    )
    input_: capo_iot.types.create_job_template_request.CreateJobTemplateRequest = {
        "job_template_id": job_template_id,
        "description": description,
    }
    if job_arn is not None:
        input_["job_arn"] = job_arn
    if document_source is not None:
        input_["document_source"] = document_source
    if document is not None:
        input_["document"] = document
    if presigned_url_config is not None:
        input_["presigned_url_config"] = presigned_url_config
    if job_executions_rollout_config is not None:
        input_["job_executions_rollout_config"] = job_executions_rollout_config
    if abort_config is not None:
        input_["abort_config"] = abort_config
    if timeout_config is not None:
        input_["timeout_config"] = timeout_config
    if tags is not None:
        input_["tags"] = tags
    if job_executions_retry_config is not None:
        input_["job_executions_retry_config"] = job_executions_retry_config
    if maintenance_windows is not None:
        input_["maintenance_windows"] = maintenance_windows
    if destination_package_versions is not None:
        input_["destination_package_versions"] = destination_package_versions

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