Skip to content

create_upload_url async

create_upload_url(
    scan_name: ScanName,
    *,
    config_overrides: Optional[AsyncCodeGuruSecurityClientConfig] = None,
) -> CreateUploadUrlResponse

Generates a pre-signed URL, request headers used to upload a code resource, and code artifact identifier for the uploaded resource.

You can upload your code resource to the URL with the request headers using any HTTP client.

Parameters:

  • scan_name (ScanName) –

    The name of the scan that will use the uploaded resource. CodeGuru Security uses the unique scan name to track revisions across multiple scans of the same resource. Use this scanName when you call CreateScan on the code resource you upload to this URL.

Raises:

Source code in docs_src/capo_codeguru_security/_services/async_code_guru_security.py
async def create_upload_url(
    self,
    scan_name: "capo_codeguru_security.types.scan_name.ScanName",
    *,
    config_overrides: Optional[AsyncCodeGuruSecurityClientConfig] = None,
) -> "capo_codeguru_security.types.create_upload_url_response.CreateUploadUrlResponse":
    """<p>Generates a pre-signed URL, request headers used to upload a code resource, and code artifact identifier for the uploaded resource.</p> <p>You can upload your code resource to the URL with the request headers using any HTTP client.</p>

    Args:
        scan_name: <p>The name of the scan that will use the uploaded resource. CodeGuru Security uses the unique scan name to track revisions across multiple scans of the same resource. Use this <code>scanName</code> when you call <code>CreateScan</code> on the code resource you upload to this URL.</p>

    Raises:
        capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
        capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
        capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codeguru_security.types.create_upload_url_request.CreateUploadUrlRequest]",
    ) -> AsyncOperationResponse[
        "capo_codeguru_security.types.create_upload_url_response.CreateUploadUrlResponse"
    ]:
        import capo_codeguru_security._operations.aws_code_guru_security.create_upload_url

        (
            output,
            http_response,
        ) = await capo_codeguru_security._operations.aws_code_guru_security.create_upload_url.async_create_upload_url(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_codeguru_security.types.create_upload_url_response.CreateUploadUrlResponse",
    ) -> dict[str, Any]:
        import capo_codeguru_security.types.create_upload_url_response

        return capo_codeguru_security.types.create_upload_url_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateUploadUrl", redact_output=_redact_output),
    )
    input_: capo_codeguru_security.types.create_upload_url_request.CreateUploadUrlRequest = {
        "scan_name": scan_name
    }

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