Skip to content

create_job_template

create_job_template(
    name: ResourceNameString,
    client_token: ClientToken,
    job_template_data: JobTemplateData,
    *,
    config_overrides: Optional[EMRcontainersClientConfig] = None,
    tags: Optional[TagMap] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
) -> CreateJobTemplateResponse

Creates a job template. Job template stores values of StartJobRun API request in a template and can be used to start a job run. Job template allows two use cases: avoid repeating recurring StartJobRun API request values, enforcing certain values in StartJobRun API request.

Parameters:

  • name (ResourceNameString) –

    The specified name of the job template.

  • client_token (ClientToken) –

    The client token of the job template.

  • job_template_data (JobTemplateData) –

    The job template data which holds values of StartJobRun API request.

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

    The tags that are associated with the job template.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The KMS key ARN used to encrypt the job template.

Raises:

Source code in docs_src/capo_emr_containers/_services/em_rcontainers.py
def create_job_template(
    self,
    name: "capo_emr_containers.types.resource_name_string.ResourceNameString",
    client_token: "capo_emr_containers.types.client_token.ClientToken",
    job_template_data: "capo_emr_containers.types.job_template_data.JobTemplateData",
    *,
    config_overrides: Optional[EMRcontainersClientConfig] = None,
    tags: Optional["capo_emr_containers.types.tag_map.TagMap"] = None,
    kms_key_arn: Optional["capo_emr_containers.types.kms_key_arn.KmsKeyArn"] = None,
) -> "capo_emr_containers.types.create_job_template_response.CreateJobTemplateResponse":
    """<p>Creates a job template. Job template stores values of StartJobRun API request in a template and can be used to start a job run. Job template allows two use cases: avoid repeating recurring StartJobRun API request values, enforcing certain values in StartJobRun API request.</p>

    Args:
        name: <p>The specified name of the job template.</p>
        client_token: <p>The client token of the job template.</p>
        job_template_data: <p>The job template data which holds values of StartJobRun API request.</p>
        tags: <p>The tags that are associated with the job template.</p>
        kms_key_arn: <p>The KMS key ARN used to encrypt the job template.</p>

    Raises:
        capo_emr_containers.errors.internal_server_exception.InternalServerException: <p>This is an internal server exception.</p>
        capo_emr_containers.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_emr_containers.errors.validation_exception.ValidationException: <p>There are invalid parameters in the client request.</p>
        capo_emr_containers.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_emr_containers.types.create_job_template_request.CreateJobTemplateRequest]",
    ) -> OperationResponse[
        "capo_emr_containers.types.create_job_template_response.CreateJobTemplateResponse"
    ]:
        import capo_emr_containers._operations.aws_chicago_web_service.create_job_template

        output, http_response = (
            capo_emr_containers._operations.aws_chicago_web_service.create_job_template.create_job_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_emr_containers.types.create_job_template_request.CreateJobTemplateRequest",
    ) -> dict[str, Any]:
        import capo_emr_containers.types.create_job_template_request

        return (
            capo_emr_containers.types.create_job_template_request.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateJobTemplate", redact_input=_redact_input),
    )
    input_: capo_emr_containers.types.create_job_template_request.CreateJobTemplateRequest = {
        "name": name,
        "client_token": client_token,
        "job_template_data": job_template_data,
    }
    if tags is not None:
        input_["tags"] = tags
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn

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