private Amazon.TimestreamWrite.Model.CreateDatabaseResponse CallAWSServiceOperation(IAmazonTimestreamWrite client, Amazon.TimestreamWrite.Model.CreateDatabaseRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Timestream Write", "CreateDatabase"); try { #if DESKTOP return(client.CreateDatabase(request)); #elif CORECLR return(client.CreateDatabaseAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
public async Task CreateDatabase(IAmazonTimestreamWrite writeClient, string databaseName) { Console.WriteLine($"Creating Database {databaseName}"); try { var createDatabaseRequest = new CreateDatabaseRequest { DatabaseName = databaseName }; await writeClient.CreateDatabaseAsync(createDatabaseRequest); Console.WriteLine($"Database {databaseName} created"); } catch (ConflictException) { Console.WriteLine("Database already exists."); } catch (Exception e) { Console.WriteLine($"Create database failed: {e}"); } }