// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DatabaseService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Database
{
public class LaunchDbSystemExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var launchDbSystemBase = new Oci.DatabaseService.Models.LaunchDbSystemFromDbSystemDetails
{
SourceDbSystemId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceDbSystemId-Value",
DbHome = new Oci.DatabaseService.Models.CreateDbHomeFromDbSystemDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Database = new Oci.DatabaseService.Models.CreateDatabaseFromDbSystemDetails
{
AdminPassword = "EXAMPLE-adminPassword-Value",
DbName = "EXAMPLE-dbName-Value",
DbDomain = "EXAMPLE-dbDomain-Value",
DbUniqueName = "EXAMPLE-dbUniqueName-Value",
DbBackupConfig = new Oci.DatabaseService.Models.DbBackupConfig
{
AutoBackupEnabled = false,
RecoveryWindowInDays = 29,
AutoBackupWindow = Oci.DatabaseService.Models.DbBackupConfig.AutoBackupWindowEnum.SlotFour,
AutoFullBackupWindow = Oci.DatabaseService.Models.DbBackupConfig.AutoFullBackupWindowEnum.SlotOne,
AutoFullBackupDay = Oci.DatabaseService.Models.DbBackupConfig.AutoFullBackupDayEnum.Tuesday,
RunImmediateFullBackup = true,
BackupDestinationDetails = new List<Oci.DatabaseService.Models.BackupDestinationDetails>
{
new Oci.DatabaseService.Models.BackupDestinationDetails
{
Type = Oci.DatabaseService.Models.BackupDestinationDetails.TypeEnum.AwsS3,
Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
VpcUser = "EXAMPLE-vpcUser-Value",
VpcPassword = "EXAMPLE-vpcPassword-Value",
IsZeroDataLossEnabled = true,
InternetProxy = "EXAMPLE-internetProxy-Value",
DbrsPolicyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbrsPolicyId-Value",
IsRetentionLockEnabled = false,
BackupRetentionPolicyOnTerminate = Oci.DatabaseService.Models.BackupDestinationDetails.BackupRetentionPolicyOnTerminateEnum.RetainFor72Hours,
IsRemote = true,
RemoteRegion = "EXAMPLE-remoteRegion-Value",
TdeWalletBackupDestination = new Oci.DatabaseService.Models.TdeWalletBackupDestination
{
BackupDestinationType = Oci.DatabaseService.Models.TdeWalletBackupDestination.BackupDestinationTypeEnum.Nfs,
BackupDestinationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-backupDestinationId-Value"
}
}
},
BackupDeletionPolicy = Oci.DatabaseService.Models.DbBackupConfig.BackupDeletionPolicyEnum.DeleteAfterRetentionPeriod
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_Zrmyw",
"EXAMPLE_VALUE_EIpo730j7OInjBDWr6AF"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_iVvUf",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_KA4rf",
"EXAMPLE--Value"
}
}
}
}
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_SEuFV",
"EXAMPLE_VALUE_DDdv8dmnZWK6tD97qxID"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_kdMIM",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_OSVBy",
"EXAMPLE--Value"
}
}
}
}
},
LicenseModel = Oci.DatabaseService.Models.LaunchDbSystemFromDbSystemDetails.LicenseModelEnum.LicenseIncluded,
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
FaultDomains = new List<string>
{
"EXAMPLE--Value"
},
DisplayName = "EXAMPLE-displayName-Value",
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
BackupSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value",
NsgIds = new List<string>
{
"EXAMPLE--Value"
},
BackupNetworkNsgIds = new List<string>
{
"EXAMPLE--Value"
},
Shape = "EXAMPLE-shape-Value",
TimeZone = "EXAMPLE-timeZone-Value",
DbSystemOptions = new Oci.DatabaseService.Models.DbSystemOptions
{
StorageManagement = Oci.DatabaseService.Models.DbSystemOptions.StorageManagementEnum.Asm
},
StorageVolumePerformanceMode = Oci.DatabaseService.Models.LaunchDbSystemBase.StorageVolumePerformanceModeEnum.Balanced,
SparseDiskgroup = false,
SshPublicKeys = new List<string>
{
"EXAMPLE--Value"
},
Hostname = "EXAMPLE-hostname-Value",
Domain = "EXAMPLE-domain-Value",
CpuCoreCount = 104,
ClusterName = "EXAMPLE-clusterName-Value",
DataStoragePercentage = 734,
InitialDataStorageSizeInGB = 855,
KmsKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
KmsKeyVersionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value",
NodeCount = 744,
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_UU3WW",
"EXAMPLE_VALUE_PFQoF4MzB17X3m0dVDi3"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_KmASL",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_KyYth",
"EXAMPLE--Value"
}
}
}
},
SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_S9obI",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_kiv4O",
"EXAMPLE--Value"
}
}
}
},
PrivateIp = "EXAMPLE-privateIp-Value",
PrivateIpV6 = "EXAMPLE-privateIpV6-Value",
ClusterPlacementGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value",
SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value",
DataCollectionOptions = new Oci.DatabaseService.Models.DataCollectionOptions
{
IsDiagnosticsEventsEnabled = true,
IsHealthMonitoringEnabled = true,
IsIncidentLogsEnabled = true
},
ComputeModel = Oci.DatabaseService.Models.LaunchDbSystemBase.ComputeModelEnum.Ocpu,
ComputeCount = 156,
IsOlderVersionAcknowledged = false
};
var launchDbSystemRequest = new Oci.DatabaseService.Requests.LaunchDbSystemRequest
{
LaunchDbSystemDetails = launchDbSystemBase,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcDryRun = false
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new DatabaseClient(provider, new ClientConfiguration()))
{
var response = await client.LaunchDbSystem(launchDbSystemRequest);
// Retrieve value from the response.
var id = response.DbSystem.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"LaunchDbSystem Failed with {e.Message}");
throw e;
}
}
}
}