Use DeleteLexicon with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeleteLexicon with an AWS SDK or CLI

The following code examples show how to use DeleteLexicon.

.NET
AWS SDK for .NET
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

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; } }
  • For API details, see DeleteLexicon in AWS SDK for .NET API Reference.

CLI
AWS 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 API details, see DeleteLexicon in AWS CLI Command Reference.