use of com.azure.cosmos.models.CosmosDatabaseResponse in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class CosmosDiagnosticsQuickStartAsync method createDatabaseIfNotExists.
// Database Diagnostics
private void createDatabaseIfNotExists() throws Exception {
logger.info("Creating database {} if not exists", databaseName);
// Create database if not exists
Mono<CosmosDatabaseResponse> databaseResponseMono = client.createDatabaseIfNotExists(databaseName);
CosmosDatabaseResponse cosmosDatabaseResponse = databaseResponseMono.block();
CosmosDiagnostics diagnostics = cosmosDatabaseResponse.getDiagnostics();
logger.info("Create database diagnostics : {}", diagnostics);
database = client.getDatabase(cosmosDatabaseResponse.getProperties().getId());
logger.info("Done.");
}
use of com.azure.cosmos.models.CosmosDatabaseResponse in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class CosmosDiagnosticsQuickStartAsync method deleteDatabase.
// Database delete
private void deleteDatabase() throws Exception {
logger.info("Last step: delete database {} by ID", databaseName);
// Delete database
CosmosDatabaseResponse dbResp = client.getDatabase(databaseName).delete(new CosmosDatabaseRequestOptions()).block();
logger.info("Status code for database delete: {}", dbResp.getStatusCode());
logger.info("Done.");
}
use of com.azure.cosmos.models.CosmosDatabaseResponse in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class CosmosDiagnosticsQuickStart method deleteDatabase.
// Database delete
private void deleteDatabase() throws Exception {
logger.info("Last step: delete database {} by ID", databaseName);
// Delete database
CosmosDatabaseResponse dbResp = client.getDatabase(databaseName).delete(new CosmosDatabaseRequestOptions());
logger.info("Status code for database delete: {}", dbResp.getStatusCode());
logger.info("Done.");
}
use of com.azure.cosmos.models.CosmosDatabaseResponse in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class AnalyticalContainerCRUDQuickstart method createDatabaseIfNotExists.
// Database Create
private void createDatabaseIfNotExists() throws Exception {
logger.info("Create database " + databaseName + " if not exists...");
// Create database if not exists
CosmosDatabaseResponse databaseResponse = client.createDatabaseIfNotExists(databaseName);
database = client.getDatabase(databaseResponse.getProperties().getId());
logger.info("Done.");
}
use of com.azure.cosmos.models.CosmosDatabaseResponse in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class AutoscaleContainerCRUDQuickstart method deleteADatabase.
// Database delete
private void deleteADatabase() throws Exception {
logger.info("Last step: delete database " + databaseName + " by ID.");
// Delete database
CosmosDatabaseResponse dbResp = client.getDatabase(databaseName).delete(new CosmosDatabaseRequestOptions());
logger.info("Status code for database delete: {}", dbResp.getStatusCode());
logger.info("Done.");
}
Aggregations