AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Creates a custom slot type or replaces an existing custom slot type.
To create a custom slot type, specify a name for the slot type and a set of enumeration values, which are the values that a slot of this type can assume. For more information, see how-it-works.
If you specify the name of an existing slot type, the fields in the request replace
the existing values in the $LATEST
version of the slot type. Amazon Lex removes
the fields that you don't provide in the request. If you don't specify required fields,
Amazon Lex throws an exception. When you update the $LATEST
version of a slot
type, if a bot uses the $LATEST
version of an intent that contains the slot
type, the bot's status
field is set to NOT_BUILT
.
This operation requires permissions for the lex:PutSlotType
action.
For .NET Core this operation is only available in asynchronous form. Please refer to PutSlotTypeAsync.
Namespace: Amazon.LexModelBuildingService
Assembly: AWSSDK.LexModelBuildingService.dll
Version: 3.x.y.z
public abstract PutSlotTypeResponse PutSlotType( PutSlotTypeRequest request )
Container for the necessary parameters to execute the PutSlotType service method.
Exception | Condition |
---|---|
BadRequestException | The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and try again. |
ConflictException | There was a conflict processing the request. Try your request again. |
InternalFailureException | An internal Amazon Lex error occurred. Try your request again. |
LimitExceededException | The request exceeded a limit. Try your request again. |
PreconditionFailedException | The checksum of the resource that you are trying to change does not match the checksum in the request. Check the resource's checksum and try again. |
This example shows how to create a slot type that describes pizza sauces.
var client = new AmazonLexModelBuildingServiceClient(); var response = client.PutSlotType(new PutSlotTypeRequest { Name = "PizzaSauceType", Description = "Available pizza sauces", EnumerationValues = new List<EnumerationValue> { new EnumerationValue { Value = "red" }, new EnumerationValue { Value = "white" } } }); string version = response.Version; string name = response.Name; string checksum = response.Checksum; DateTime createdDate = response.CreatedDate; string description = response.Description; List<EnumerationValue> enumerationValues = response.EnumerationValues; DateTime lastUpdatedDate = response.LastUpdatedDate;
.NET Framework:
Supported in: 4.5, 4.0, 3.5