Usar UpdateDomainConfig com um SDK da AWS - Exemplos de código do AWS SDK

Há mais exemplos do AWS SDK disponíveis no repositório do GitHub Documento de Exemplos do AWS SDK.

Usar UpdateDomainConfig com um SDK da AWS

Os exemplos de código a seguir mostram como usar o UpdateDomainConfig.

Exemplos de ações são trechos de código de programas maiores e devem ser executados em contexto. É possível ver essa ação em contexto no seguinte exemplo de código:

Java
SDK para Java 2.x
nota

Há mais no GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository.

/** * 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) }); }
  • Consulte detalhes da API em UpdateDomainConfig na Referência da API AWS SDK for Java 2.x.

Kotlin
SDK para Kotlin
nota

Há mais no GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository.

suspend fun updateSpecificDomain(domainNameVal: String?) { val clusterConfigOb = ClusterConfig { instanceCount = 3 } val request = UpdateDomainConfigRequest { domainName = domainNameVal clusterConfig = clusterConfigOb } println("Sending domain update request...") OpenSearchClient.fromEnvironment { region = "us-east-1" }.use { searchClient -> val updateResponse = searchClient.updateDomainConfig(request) println("Domain update response from Amazon OpenSearch Service:") println(updateResponse.toString()) } }
  • Consulte detalhes da API em UpdateDomainConfig na Referência da API AWS SDK para Kotlin.