Skip to content

get_case_attachment_upload_url async

get_case_attachment_upload_url(
    case_id: CaseId,
    file_name: FileName,
    content_length: ContentLength,
    *,
    config_overrides: Optional[AsyncSecurityIRClientConfig] = None,
    client_token: Optional[str] = None,
) -> GetCaseAttachmentUploadUrlResponse

Uploads an attachment to a case.

Parameters:

  • case_id (CaseId) –

    Required element for GetCaseAttachmentUploadUrl to identify the case ID for uploading an attachment.

  • file_name (FileName) –

    Required element for GetCaseAttachmentUploadUrl to identify the file name of the attachment to upload.

  • content_length (ContentLength) –

    Required element for GetCaseAttachmentUploadUrl to identify the size of the file attachment.

  • client_token (Optional[str], default: None ) –

    The clientToken field is an idempotency key used to ensure that repeated attempts for a single action will be ignored by the server during retries. A caller supplied unique ID (typically a UUID) should be provided.

Raises:

Examples:

Invoke GetCaseAttachmentUploadUrl

>>> await client.get_case_attachment_upload_url(case_id='8403556009', file_name='TestFileName', content_length=1500)
Source code in docs_src/capo_security_ir/_services/async_security_ir.py
async def get_case_attachment_upload_url(
    self,
    case_id: "capo_security_ir.types.case_id.CaseId",
    file_name: "capo_security_ir.types.file_name.FileName",
    content_length: "capo_security_ir.types.content_length.ContentLength",
    *,
    config_overrides: Optional[AsyncSecurityIRClientConfig] = None,
    client_token: Optional[str] = None,
) -> "capo_security_ir.types.get_case_attachment_upload_url_response.GetCaseAttachmentUploadUrlResponse":
    """<p>Uploads an attachment to a case.</p>

    Args:
        case_id: <p>Required element for GetCaseAttachmentUploadUrl to identify the case ID for uploading an attachment. </p>
        file_name: <p>Required element for GetCaseAttachmentUploadUrl to identify the file name of the attachment to upload. </p>
        content_length: <p>Required element for GetCaseAttachmentUploadUrl to identify the size of the file attachment.</p>
        client_token: <note> <p>The <code>clientToken</code> field is an idempotency key used to ensure that repeated attempts for a single action will be ignored by the server during retries. A caller supplied unique ID (typically a UUID) should be provided. </p> </note>

    Raises:
        capo_security_ir.errors.access_denied_exception.AccessDeniedException: <p/>
        capo_security_ir.errors.conflict_exception.ConflictException: <p/>
        capo_security_ir.errors.internal_server_exception.InternalServerException: <p/>
        capo_security_ir.errors.invalid_token_exception.InvalidTokenException: <p/>
        capo_security_ir.errors.resource_not_found_exception.ResourceNotFoundException: <p/>
        capo_security_ir.errors.security_incident_response_not_active_exception.SecurityIncidentResponseNotActiveException: <p/>
        capo_security_ir.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p/>
        capo_security_ir.errors.throttling_exception.ThrottlingException: <p/>
        capo_security_ir.errors.validation_exception.ValidationException: <p/>
        capo_security_ir.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Invoke GetCaseAttachmentUploadUrl

        >>> await client.get_case_attachment_upload_url(case_id='8403556009', file_name='TestFileName', content_length=1500)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_security_ir.types.get_case_attachment_upload_url_request.GetCaseAttachmentUploadUrlRequest]",
    ) -> AsyncOperationResponse[
        "capo_security_ir.types.get_case_attachment_upload_url_response.GetCaseAttachmentUploadUrlResponse"
    ]:
        import capo_security_ir._operations.security_incident_response.get_case_attachment_upload_url

        (
            output,
            http_response,
        ) = await capo_security_ir._operations.security_incident_response.get_case_attachment_upload_url.async_get_case_attachment_upload_url(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_security_ir.types.get_case_attachment_upload_url_request.GetCaseAttachmentUploadUrlRequest",
    ) -> dict[str, Any]:
        import capo_security_ir.types.get_case_attachment_upload_url_request

        return capo_security_ir.types.get_case_attachment_upload_url_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_security_ir.types.get_case_attachment_upload_url_response.GetCaseAttachmentUploadUrlResponse",
    ) -> dict[str, Any]:
        import capo_security_ir.types.get_case_attachment_upload_url_response

        return capo_security_ir.types.get_case_attachment_upload_url_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "GetCaseAttachmentUploadUrl",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_security_ir.types.get_case_attachment_upload_url_request.GetCaseAttachmentUploadUrlRequest = {
        "case_id": case_id,
        "file_name": file_name,
        "content_length": content_length,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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