Crea un cliente con transporte HTTP/JSON

Inicializa un cliente de administrador configurado para usar el protocolo de transporte HTTP/JSON en lugar del gRPC predeterminado. Esto es útil para entornos en los que gRPC no es compatible o está bloqueado, como ciertos proxies web o firewalls.

Muestra de código

Java

Para autenticarte en AlloyDB, configura las credenciales predeterminadas de la aplicación. Para obtener más información, consulta Configura la autenticación para un entorno de desarrollo local.

import com.google.cloud.alloydb.v1.AlloyDBCSQLAdminClient;
import com.google.cloud.alloydb.v1.AlloyDBCSQLAdminSettings;

public class SyncCreateUseHttpJsonTransport {

  public static void main(String[] args) throws Exception {
    syncCreateUseHttpJsonTransport();
  }

  public static void syncCreateUseHttpJsonTransport() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    AlloyDBCSQLAdminSettings alloyDBCSQLAdminSettings =
        AlloyDBCSQLAdminSettings.newHttpJsonBuilder().build();
    AlloyDBCSQLAdminClient alloyDBCSQLAdminClient =
        AlloyDBCSQLAdminClient.create(alloyDBCSQLAdminSettings);
  }
}

¿Qué sigue?

Si quieres buscar y filtrar muestras de código para otros productos de Google Cloud , consulta el navegador de muestras deGoogle Cloud .