// 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).

import * as mysql from "oci-mysql";
import common = require("oci-common");

// 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.

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
    try {
     // Create a service client
     const client = new mysql.DbSystemClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  createDbSystemDetails = {
		displayName: "EXAMPLE-displayName-Value",
		description: "EXAMPLE-description-Value",
		compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
		rest: {
			configuration: mysql.models.RestConfigurationType.Disabled,
			port: 60802,

			}
,
		databaseConsole: {
			status: mysql.models.DatabaseConsoleStatus.Enabled,
			port: 22405,

			}
,
		isHighlyAvailable: false,
		availabilityDomain: "EXAMPLE-availabilityDomain-Value",
		faultDomain: "EXAMPLE-faultDomain-Value",
		configurationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value",
		shapeName: "EXAMPLE-shapeName-Value",
		mysqlVersion: "EXAMPLE-mysqlVersion-Value",
		subnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
		nsgIds: ["EXAMPLE--Value"				],
		securityAttributes: {
			EXAMPLE_KEY_xjYqL :{
				EXAMPLE_KEY_kj9sb :"EXAMPLE--Value"
				}
			},
		adminUsername: "EXAMPLE-adminUsername-Value",
		adminPassword: "EXAMPLE-adminPassword-Value",
		dataStorageSizeInGBs: 117550,
		dataStorage: {
			isAutoExpandStorageEnabled: false,
			maxStorageSizeInGBs: 62875,

			}
,
		hostnameLabel: "EXAMPLE-hostnameLabel-Value",
		ipAddress: "EXAMPLE-ipAddress-Value",
		port: 37469,
		portX: 5104,
		backupPolicy: {
			isEnabled: true,
			softDelete: mysql.models.SoftDelete.Enabled,
			copyPolicies: [{
					copyToRegion: "EXAMPLE-copyToRegion-Value",
					backupCopyRetentionInDays: 10,

					}
					],
			windowStartTime: "EXAMPLE-windowStartTime-Value",
			retentionInDays: 13,
			freeformTags: {
				EXAMPLE_KEY_O48Kv :"EXAMPLE_VALUE_XDhmgXXaaJcEBX5fcrea"
				},
			definedTags: {
				EXAMPLE_KEY_eSJNK :{
					EXAMPLE_KEY_g0mJE :"EXAMPLE--Value"
					}
				},
			pitrPolicy: {
				isEnabled: false,

				}
,

			}
,
		source: {
			sourceType: "PITR",			dbSystemId: "ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
			recoveryPoint: new Date("Mon Oct 01 18:35:30 UTC 2018")

			}
,
		maintenance: {
			windowStartTime: "EXAMPLE-windowStartTime-Value",
			versionPreference: mysql.models.VersionPreference.SecondNewest,
			versionTrackPreference: mysql.models.VersionTrackPreference.Innovation,
			maintenanceScheduleType: mysql.models.MaintenanceScheduleType.Regular,
			maintenanceDisabledWindows: [{
					timeStart: new Date("Sat Feb 05 21:49:22 UTC 2011"),
					timeEnd: new Date("Sat Sep 02 14:21:37 UTC 2017"),

					}
					],

			}
,
		freeformTags: {
			EXAMPLE_KEY_6JvM2 :"EXAMPLE_VALUE_o3Rc2kRG5elH6uE1U2FA"
			},
		definedTags: {
			EXAMPLE_KEY_fQlEW :{
				EXAMPLE_KEY_e70VM :"EXAMPLE--Value"
				}
			},
		deletionPolicy: {
			automaticBackupRetention: mysql.models.CreateDeletionPolicyDetails.AutomaticBackupRetention.Retain,
			finalBackup: mysql.models.CreateDeletionPolicyDetails.FinalBackup.RequireFinalBackup,
			isDeleteProtected: true,

			}
,
		crashRecovery: mysql.models.CrashRecoveryStatus.Disabled,
		databaseManagement: mysql.models.DatabaseManagementStatus.Disabled,
		secureConnections: {
			certificateId: "ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value",
			certificateGenerationType: mysql.models.CertificateGenerationType.System,

			}
,
		encryptData: {
			keyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
			keyGenerationType: mysql.models.KeyGenerationType.System,

			}
,
		databaseMode: mysql.models.DbSystem.DatabaseMode.ReadOnly,
		accessMode: mysql.models.DbSystem.AccessMode.Unrestricted,
		customerContacts: [{
				email: "EXAMPLE-email-Value",

				}
				],
		readEndpoint: {
			isEnabled: false,
			readEndpointIpAddress: "EXAMPLE-readEndpointIpAddress-Value",
			readEndpointHostnameLabel: "EXAMPLE-readEndpointHostnameLabel-Value",
			excludeIps: ["EXAMPLE--Value"					],

			}
,
		telemetryConfiguration: {
			logs: [{
					destination: mysql.models.LoggingDestinationConfiguration.Destination.OpenTelemetry,
					destinationConfigurations: [{
							key: "EXAMPLE-key-Value",
							value: "EXAMPLE-value-Value",

							}
							],
					logTypes: [mysql.models.LoggingDestinationConfiguration.LogTypes.AuditLog							],

					}
					],

			}
,

		}

	const createDbSystemRequest: mysql.requests.CreateDbSystemRequest = { 
	createDbSystemDetails: createDbSystemDetails,
	opcRequestId: "HRP0OEDMD8UPROQJGU0N<unique_ID>",
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",

		}; 


     // Send request to the Client.
     const createDbSystemResponse = await client.createDbSystem(createDbSystemRequest);
     }
     catch (error) {
         console.log("createDbSystem Failed with error  " + error);
     }
})();