文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
DescribeDomain
搭配 AWS SDK 使用
下列程式碼範例示範如何使用 DescribeDomain
。
動作範例是大型程式的程式碼摘錄,必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作:
- Java
-
- SDK for Java 2.x
-
/**
* Updates the configuration of a specific domain asynchronously.
* @param domainName the name of the domain to update
* @return a {@link CompletableFuture} that represents the asynchronous operation of updating the domain configuration
*/
public CompletableFuture<UpdateDomainConfigResponse> updateSpecificDomainAsync(String domainName) {
ClusterConfig clusterConfig = ClusterConfig.builder()
.instanceCount(3)
.build();
UpdateDomainConfigRequest updateDomainConfigRequest = UpdateDomainConfigRequest.builder()
.domainName(domainName)
.clusterConfig(clusterConfig)
.build();
return getAsyncClient().updateDomainConfig(updateDomainConfigRequest)
.whenComplete((response, exception) -> {
if (exception != null) {
throw new RuntimeException("Failed to update the domain configuration", exception);
}
// Handle success if needed (e.g., logging or additional actions)
});
}