与 AWS SDK或CheckDomainTransferability一起使用 CLI - AWS SDK代码示例

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

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

与 AWS SDK或CheckDomainTransferability一起使用 CLI

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

操作示例是大型程序的代码摘录,必须在上下文中运行。在以下代码示例中,您可以查看此操作的上下文:

.NET
AWS SDK for .NET
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

/// <summary> /// Check the transferability of a domain name. /// </summary> /// <param name="domain">The domain to check for transferability.</param> /// <returns>A transferability result string.</returns> public async Task<string> CheckDomainTransferability(string domain) { var result = await _amazonRoute53Domains.CheckDomainTransferabilityAsync( new CheckDomainTransferabilityRequest { DomainName = domain } ); return result.Transferability.Transferable.Value; }
CLI
AWS CLI

确定域是否可以转移到 Route 53

以下 check-domain-transferability 命令返回有关是否可以将域名 example.com 转移到 Route 53 的信息。

此命令仅在 us-east-1 区域运行。如果默认区域设置为 us-east-1,则可以忽略 region 参数。

aws route53domains check-domain-transferability \ --region us-east-1 \ --domain-name example.com

输出:

{ "Transferability": { "Transferable": "UNTRANSFERABLE" } }

有关更多信息,请参阅《Amazon Route 53 开发人员指南》中的将域的注册转移到 Amazon Route 53

Java
SDK适用于 Java 2.x
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

public static void checkDomainTransferability(Route53DomainsClient route53DomainsClient, String domainSuggestion) { try { CheckDomainTransferabilityRequest transferabilityRequest = CheckDomainTransferabilityRequest.builder() .domainName(domainSuggestion) .build(); CheckDomainTransferabilityResponse response = route53DomainsClient .checkDomainTransferability(transferabilityRequest); System.out.println("Transferability: " + response.transferability().transferable().toString()); } catch (Route53Exception e) { System.err.println(e.getMessage()); System.exit(1); } }
Kotlin
SDK对于 Kotlin 来说
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

suspend fun checkDomainTransferability(domainSuggestion: String?) { val transferabilityRequest = CheckDomainTransferabilityRequest { domainName = domainSuggestion } Route53DomainsClient { region = "us-east-1" }.use { route53DomainsClient -> val response = route53DomainsClient.checkDomainTransferability(transferabilityRequest) println("Transferability: ${response.transferability?.transferable}") } }