createVariable method
Creates a variable.
May throw ValidationException. May throw InternalServerException. May throw ThrottlingException. May throw AccessDeniedException.
Parameter dataSource
:
The source of the data.
Parameter dataType
:
The data type.
Parameter defaultValue
:
The default value for the variable when no value is received.
Parameter name
:
The name of the variable.
Parameter description
:
The description.
Parameter tags
:
A collection of key and value pairs.
Parameter variableType
:
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
Implementation
Future<void> createVariable({
required DataSource dataSource,
required DataType dataType,
required String defaultValue,
required String name,
String? description,
List<Tag>? tags,
String? variableType,
}) async {
ArgumentError.checkNotNull(dataSource, 'dataSource');
ArgumentError.checkNotNull(dataType, 'dataType');
ArgumentError.checkNotNull(defaultValue, 'defaultValue');
ArgumentError.checkNotNull(name, 'name');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSHawksNestServiceFacade.CreateVariable'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'dataSource': dataSource.toValue(),
'dataType': dataType.toValue(),
'defaultValue': defaultValue,
'name': name,
if (description != null) 'description': description,
if (tags != null) 'tags': tags,
if (variableType != null) 'variableType': variableType,
},
);
}