Skip to content

start_job async

start_job(
    app_id: AppId,
    branch_name: BranchName,
    job_type: JobType,
    *,
    config_overrides: Optional[AsyncAmplifyClientConfig] = None,
    job_id: Optional[JobId] = None,
    job_reason: Optional[JobReason] = None,
    commit_id: Optional[CommitId] = None,
    commit_message: Optional[CommitMessage] = None,
    commit_time: Optional[CommitTime] = None,
) -> StartJobResult

Starts a new job for a branch of an Amplify app.

Parameters:

  • app_id (AppId) –

    The unique ID for an Amplify app.

  • branch_name (BranchName) –

    The name of the branch to use for the job.

  • job_id (Optional[JobId], default: None ) –

    The unique ID for an existing job. This is required if the value of jobType is RETRY.

  • job_type (JobType) –

    Describes the type for the job. The job type RELEASE starts a new job with the latest change from the specified branch. This value is available only for apps that are connected to a repository.

    The job type RETRY retries an existing job. If the job type value is RETRY, the jobId is also required.

  • job_reason (Optional[JobReason], default: None ) –

    A descriptive reason for starting the job.

  • commit_id (Optional[CommitId], default: None ) –

    The commit ID from a third-party repository provider for the job.

  • commit_message (Optional[CommitMessage], default: None ) –

    The commit message from a third-party repository provider for the job.

  • commit_time (Optional[CommitTime], default: None ) –

    The commit date and time for the job.

Raises:

Source code in docs_src/capo_amplify/_services/async_amplify.py
async def start_job(
    self,
    app_id: "capo_amplify.types.app_id.AppId",
    branch_name: "capo_amplify.types.branch_name.BranchName",
    job_type: "capo_amplify.types.job_type.JobType",
    *,
    config_overrides: Optional[AsyncAmplifyClientConfig] = None,
    job_id: Optional["capo_amplify.types.job_id.JobId"] = None,
    job_reason: Optional["capo_amplify.types.job_reason.JobReason"] = None,
    commit_id: Optional["capo_amplify.types.commit_id.CommitId"] = None,
    commit_message: Optional[
        "capo_amplify.types.commit_message.CommitMessage"
    ] = None,
    commit_time: Optional["capo_amplify.types.commit_time.CommitTime"] = None,
) -> "capo_amplify.types.start_job_result.StartJobResult":
    """<p> Starts a new job for a branch of an Amplify app. </p>

    Args:
        app_id: <p>The unique ID for an Amplify app. </p>
        branch_name: <p>The name of the branch to use for the job. </p>
        job_id: <p>The unique ID for an existing job. This is required if the value of <code>jobType</code> is <code>RETRY</code>. </p>
        job_type: <p>Describes the type for the job. The job type <code>RELEASE</code> starts a new job with the latest change from the specified branch. This value is available only for apps that are connected to a repository. </p> <p>The job type <code>RETRY</code> retries an existing job. If the job type value is <code>RETRY</code>, the <code>jobId</code> is also required. </p>
        job_reason: <p>A descriptive reason for starting the job.</p>
        commit_id: <p> The commit ID from a third-party repository provider for the job. </p>
        commit_message: <p> The commit message from a third-party repository provider for the job. </p>
        commit_time: <p> The commit date and time for the job. </p>

    Raises:
        capo_amplify.errors.bad_request_exception.BadRequestException: <p>A request contains unexpected data. </p>
        capo_amplify.errors.internal_failure_exception.InternalFailureException: <p>The service failed to perform an operation due to an internal issue. </p>
        capo_amplify.errors.limit_exceeded_exception.LimitExceededException: <p>A resource could not be created because service quotas were exceeded. </p>
        capo_amplify.errors.not_found_exception.NotFoundException: <p>An entity was not found during an operation. </p>
        capo_amplify.errors.unauthorized_exception.UnauthorizedException: <p>An operation failed due to a lack of access. </p>
        capo_amplify.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_amplify.types.start_job_request.StartJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_amplify.types.start_job_result.StartJobResult"
    ]:
        import capo_amplify._operations.amplify.start_job

        (
            output,
            http_response,
        ) = await capo_amplify._operations.amplify.start_job.async_start_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartJob")
    )
    input_: capo_amplify.types.start_job_request.StartJobRequest = {
        "app_id": app_id,
        "branch_name": branch_name,
        "job_type": job_type,
    }
    if job_id is not None:
        input_["job_id"] = job_id
    if job_reason is not None:
        input_["job_reason"] = job_reason
    if commit_id is not None:
        input_["commit_id"] = commit_id
    if commit_message is not None:
        input_["commit_message"] = commit_message
    if commit_time is not None:
        input_["commit_time"] = commit_time

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