Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use DeleteLexicon
with an Amazon SDK or CLI
The following code examples show how to use DeleteLexicon
.
- .NET
-
- Amazon SDK for .NET
-
using System;
using System.Threading.Tasks;
using Amazon.Polly;
using Amazon.Polly.Model;
/// <summary>
/// Deletes an existing Amazon Polly lexicon using the AWS SDK for .NET.
/// </summary>
public class DeleteLexicon
{
public static async Task Main()
{
string lexiconName = "SampleLexicon";
var client = new AmazonPollyClient();
var success = await DeletePollyLexiconAsync(client, lexiconName);
if (success)
{
Console.WriteLine($"Successfully deleted {lexiconName}.");
}
else
{
Console.WriteLine($"Could not delete {lexiconName}.");
}
}
/// <summary>
/// Deletes the named Amazon Polly lexicon.
/// </summary>
/// <param name="client">The initialized Amazon Polly client object.</param>
/// <param name="lexiconName">The name of the Amazon Polly lexicon to
/// delete.</param>
/// <returns>A Boolean value indicating the success of the operation.</returns>
public static async Task<bool> DeletePollyLexiconAsync(
AmazonPollyClient client,
string lexiconName)
{
var deleteLexiconRequest = new DeleteLexiconRequest()
{
Name = lexiconName,
};
var response = await client.DeleteLexiconAsync(deleteLexiconRequest);
return response.HttpStatusCode == System.Net.HttpStatusCode.OK;
}
}
- CLI
-
- Amazon CLI
-
To delete a lexicon
The following delete-lexicon
example deletes the specified lexicon.
aws polly delete-lexicon \
--name w3c
This command produces no output.
For more information, see Using the DeleteLexicon operation in the Amazon Polly Developer Guide.
For a complete list of Amazon SDK developer guides and code examples, see
Using Amazon Polly with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.