Skip to content

create_variable async

create_variable(
    name: string,
    data_type: DataType,
    data_source: DataSource,
    default_value: string,
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    description: Optional[string] = None,
    variable_type: Optional[string] = None,
    tags: Optional[tagList] = None,
) -> CreateVariableResult

Creates a variable.

Parameters:

  • name (string) –

    The name of the variable.

  • data_type (DataType) –

    The data type of the variable.

  • data_source (DataSource) –

    The source of the data.

  • default_value (string) –

    The default value for the variable when no value is received.

  • description (Optional[string], default: None ) –

    The description.

  • variable_type (Optional[string], default: None ) –

    The variable type. For more information see Variable types.

    Valid Values: AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT

  • tags (Optional[tagList], default: None ) –

    A collection of key and value pairs.

Raises:

  • AccessDeniedException –

    An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as PutExternalModel, that specifies a role that is not in your account.

  • InternalServerException –

    An exception indicating an internal server error.

  • ThrottlingException –

    An exception indicating a throttling error.

  • ValidationException –

    An exception indicating a specified value is not allowed.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_frauddetector/_services/async_fraud_detector.py
async def create_variable(
    self,
    name: "capo_frauddetector.types.string.string",
    data_type: "capo_frauddetector.types.data_type.DataType",
    data_source: "capo_frauddetector.types.data_source.DataSource",
    default_value: "capo_frauddetector.types.string.string",
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    description: Optional["capo_frauddetector.types.string.string"] = None,
    variable_type: Optional["capo_frauddetector.types.string.string"] = None,
    tags: Optional["capo_frauddetector.types.tag_list.tagList"] = None,
) -> "capo_frauddetector.types.create_variable_result.CreateVariableResult":
    """<p>Creates a variable.</p>

    Args:
        name: <p>The name of the variable.</p>
        data_type: <p>The data type of the variable.</p>
        data_source: <p>The source of the data.</p>
        default_value: <p>The default value for the variable when no value is received.</p>
        description: <p>The description.</p>
        variable_type: <p>The variable type. For more information see <a href="https://docs.aws.amazon.com/frauddetector/latest/ug/create-a-variable.html#variable-types">Variable types</a>. </p> <p>Valid Values: <code>AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT</code> </p>
        tags: <p>A collection of key and value pairs.</p>

    Raises:
        capo_frauddetector.errors.access_denied_exception.AccessDeniedException: <p>An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as <code>PutExternalModel</code>, that specifies a role that is not in your account.</p>
        capo_frauddetector.errors.internal_server_exception.InternalServerException: <p>An exception indicating an internal server error.</p>
        capo_frauddetector.errors.throttling_exception.ThrottlingException: <p>An exception indicating a throttling error.</p>
        capo_frauddetector.errors.validation_exception.ValidationException: <p>An exception indicating a specified value is not allowed.</p>
        capo_frauddetector.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_frauddetector.types.create_variable_request.CreateVariableRequest]",
    ) -> AsyncOperationResponse[
        "capo_frauddetector.types.create_variable_result.CreateVariableResult"
    ]:
        import capo_frauddetector._operations.aws_hawks_nest_service_facade.create_variable

        (
            output,
            http_response,
        ) = await capo_frauddetector._operations.aws_hawks_nest_service_facade.create_variable.async_create_variable(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateVariable")
    )
    input_: capo_frauddetector.types.create_variable_request.CreateVariableRequest = {
        "name": name,
        "data_type": data_type,
        "data_source": data_source,
        "default_value": default_value,
    }
    if description is not None:
        input_["description"] = description
    if variable_type is not None:
        input_["variable_type"] = variable_type
    if tags is not None:
        input_["tags"] = tags

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