Skip to content

start_command_execution async

start_command_execution(
    sandbox_id: NonEmptyString,
    command: SensitiveNonEmptyString,
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
    type: Optional[CommandType] = None,
) -> StartCommandExecutionOutput

Starts a command execution.

Parameters:

Raises:

Source code in docs_src/capo_codebuild/_services/async_code_build.py
async def start_command_execution(
    self,
    sandbox_id: "capo_codebuild.types.non_empty_string.NonEmptyString",
    command: "capo_codebuild.types.sensitive_non_empty_string.SensitiveNonEmptyString",
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
    type: Optional["capo_codebuild.types.command_type.CommandType"] = None,
) -> "capo_codebuild.types.start_command_execution_output.StartCommandExecutionOutput":
    """<p>Starts a command execution.</p>

    Args:
        sandbox_id: <p>A <code>sandboxId</code> or <code>sandboxArn</code>.</p>
        command: <p>The command that needs to be executed.</p>
        type: <p>The command type.</p>

    Raises:
        capo_codebuild.errors.invalid_input_exception.InvalidInputException: <p>The input value that was provided is not valid.</p>
        capo_codebuild.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified Amazon Web Services resource cannot be found.</p>
        capo_codebuild.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codebuild.types.start_command_execution_input.StartCommandExecutionInput]",
    ) -> AsyncOperationResponse[
        "capo_codebuild.types.start_command_execution_output.StartCommandExecutionOutput"
    ]:
        import capo_codebuild._operations.code_build_20161006.start_command_execution

        (
            output,
            http_response,
        ) = await capo_codebuild._operations.code_build_20161006.start_command_execution.async_start_command_execution(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_codebuild.types.start_command_execution_input.StartCommandExecutionInput",
    ) -> dict[str, Any]:
        import capo_codebuild.types.start_command_execution_input

        return capo_codebuild.types.start_command_execution_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_codebuild.types.start_command_execution_output.StartCommandExecutionOutput",
    ) -> dict[str, Any]:
        import capo_codebuild.types.start_command_execution_output

        return capo_codebuild.types.start_command_execution_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "StartCommandExecution",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_codebuild.types.start_command_execution_input.StartCommandExecutionInput = {
        "sandbox_id": sandbox_id,
        "command": command,
    }
    if type is not None:
        input_["type"] = type

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