将 DeleteLexicon 与 AWS SDK 或 CLI 配合使用 - AWS SDK 代码示例

AWS 文档 SDK 示例 GitHub 存储库中还有更多 AWS SDK 示例。

DeleteLexicon 与 AWS SDK 或 CLI 配合使用

以下代码示例演示如何使用 DeleteLexicon

.NET
适用于 .NET 的 SDK
注意

查看 GitHub,了解更多信息。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

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; } }
  • 有关 API 的详细信息,请参阅《适用于 .NET 的 AWS SDK API Reference》中的 DeleteLexicon

CLI
AWS CLI

删除词典

以下 delete-lexicon 示例删除指定的词典。

aws polly delete-lexicon \ --name w3c

此命令不生成任何输出。

有关更多信息,请参阅《Amazon Polly 开发人员指南》中的使用 DeleteLexicon 操作

  • 有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 DeleteLexicon