Skip to content

create_segment_estimate async

create_segment_estimate(
    domain_name: name,
    *,
    config_overrides: Optional[AsyncCustomerProfilesClientConfig] = None,
    segment_query: Optional[SegmentGroupStructure] = None,
    segment_sql_query: Optional[sensitiveString1To50000] = None,
) -> CreateSegmentEstimateResponse

Creates a segment estimate query.

Parameters:

Raises:

Source code in docs_src/capo_customer_profiles/_services/async_customer_profiles.py
async def create_segment_estimate(
    self,
    domain_name: "capo_customer_profiles.types.name.name",
    *,
    config_overrides: Optional[AsyncCustomerProfilesClientConfig] = None,
    segment_query: Optional[
        "capo_customer_profiles.types.segment_group_structure.SegmentGroupStructure"
    ] = None,
    segment_sql_query: Optional[
        "capo_customer_profiles.types.sensitive_string1_to50000.sensitiveString1To50000"
    ] = None,
) -> "capo_customer_profiles.types.create_segment_estimate_response.CreateSegmentEstimateResponse":
    """<p>Creates a segment estimate query.</p>

    Args:
        domain_name: <p>The unique name of the domain.</p>
        segment_query: <p>The segment query for calculating a segment estimate.</p>
        segment_sql_query: <p>The segment SQL query.</p>

    Raises:
        capo_customer_profiles.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_customer_profiles.errors.bad_request_exception.BadRequestException: <p>The input you provided is invalid.</p>
        capo_customer_profiles.errors.internal_server_exception.InternalServerException: <p>An internal service error occurred.</p>
        capo_customer_profiles.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource does not exist, or access was denied.</p>
        capo_customer_profiles.errors.throttling_exception.ThrottlingException: <p>You exceeded the maximum number of requests.</p>
        capo_customer_profiles.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_customer_profiles.types.create_segment_estimate_request.CreateSegmentEstimateRequest]",
    ) -> AsyncOperationResponse[
        "capo_customer_profiles.types.create_segment_estimate_response.CreateSegmentEstimateResponse"
    ]:
        import capo_customer_profiles._operations.customer_profiles_20200815.create_segment_estimate

        (
            output,
            http_response,
        ) = await capo_customer_profiles._operations.customer_profiles_20200815.create_segment_estimate.async_create_segment_estimate(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_customer_profiles.types.create_segment_estimate_request.CreateSegmentEstimateRequest",
    ) -> dict[str, Any]:
        import capo_customer_profiles.types.create_segment_estimate_request

        return capo_customer_profiles.types.create_segment_estimate_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateSegmentEstimate", redact_input=_redact_input),
    )
    input_: capo_customer_profiles.types.create_segment_estimate_request.CreateSegmentEstimateRequest = {
        "domain_name": domain_name
    }
    if segment_query is not None:
        input_["segment_query"] = segment_query
    if segment_sql_query is not None:
        input_["segment_sql_query"] = segment_sql_query

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