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

require 'oci'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
distributed_database_client =
  OCI::DistributedDatabase::DistributedDbServiceClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
create_distributed_database_response =
  distributed_database_client.create_distributed_database(
    OCI::DistributedDatabase::Models::CreateDistributedDatabaseDetails.new(
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      display_name: 'EXAMPLE-displayName-Value',
      database_version: 'EXAMPLE-databaseVersion-Value',
      prefix: 'hle',
      private_endpoint_ids: %w[EXAMPLE--Value],
      sharding_method: 'USER',
      character_set: 'EXAMPLE-characterSet-Value',
      ncharacter_set: 'EXAMPLE-ncharacterSet-Value',
      listener_port: 52_079,
      ons_port_local: 41_863,
      ons_port_remote: 15_625,
      db_deployment_type: 'EXADB_XS',
      shard_details: [
        OCI::DistributedDatabase::Models::CreateDistributedDatabaseShardWithExadbXsNewVaultAndClusterDetails
          .new(
          source: 'NEW_VAULT_AND_CLUSTER',
          admin_password: 'EXAMPLE-adminPassword-Value',
          availability_domain: 'EXAMPLE-availabilityDomain-Value',
          db_storage_vault_details:
            OCI::DistributedDatabase::Models::DbStorageVaultDetails.new(
              high_capacity_database_storage: 701,
              additional_flash_cache_in_percent: 248
            ),
          vm_cluster_details:
            OCI::DistributedDatabase::Models::VmClusterDetails.new(
              subnet_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value',
              backup_subnet_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value',
              enabled_e_cpu_count: 599,
              ssh_public_keys: %w[EXAMPLE--Value],
              total_e_cpu_count: 8,
              vm_file_system_storage_size: 909,
              license_model: 'BRING_YOUR_OWN_LICENSE',
              domain: 'EXAMPLE-domain-Value',
              private_zone_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-privateZoneId-Value',
              is_diagnostics_events_enabled: true,
              is_health_monitoring_enabled: false,
              is_incident_logs_enabled: true,
              nsg_ids: %w[EXAMPLE--Value],
              backup_network_nsg_ids: %w[EXAMPLE--Value]
            ),
          peer_details: [
            OCI::DistributedDatabase::Models::CreateShardPeerWithExadbXsNewVaultAndClusterDetails
              .new(
              availability_domain: 'EXAMPLE-availabilityDomain-Value',
              protection_mode: 'MAXIMUM_PERFORMANCE',
              transport_type: 'ASYNC'
            )
          ],
          shard_space: 'EXAMPLE-shardSpace-Value',
          vault_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value',
          kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value',
          kms_key_version_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value'
        )
      ],
      catalog_details: [
        OCI::DistributedDatabase::Models::CreateDistributedDatabaseCatalogWithExadbXsDetails
          .new(
          source: 'EXADB_XS',
          vm_cluster_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vmClusterId-Value',
          admin_password: 'EXAMPLE-adminPassword-Value',
          peer_vm_cluster_ids: %w[EXAMPLE--Value],
          peer_details: [
            OCI::DistributedDatabase::Models::CreateCatalogPeerWithExadbXsDetails
              .new(
              vm_cluster_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-vmClusterId-Value',
              protection_mode: 'MAXIMUM_PROTECTION',
              transport_type: 'ASYNC'
            )
          ],
          shard_space: 'EXAMPLE-shardSpace-Value',
          vault_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value',
          kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value',
          kms_key_version_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value'
        )
      ],
      chunks: 361,
      listener_port_tls: 54_701,
      scan_listener_port: 29_401,
      replication_method: 'RAFT',
      replication_factor: 3,
      replication_unit: 288,
      gsm_ssh_public_key: 'EXAMPLE-gsmSshPublicKey-Value',
      db_backup_config:
        OCI::DistributedDatabase::Models::DistributedDbBackupConfig.new(
          is_auto_backup_enabled: false,
          recovery_window_in_days: 39,
          auto_backup_window: 'SLOT_SEVEN',
          auto_full_backup_window: 'SLOT_FIVE',
          auto_full_backup_day: 'WEDNESDAY',
          can_run_immediate_full_backup: false,
          is_remote_backup_enabled: false,
          remote_region: 'EXAMPLE-remoteRegion-Value',
          backup_destination_details: [
            OCI::DistributedDatabase::Models::DistributedDbBackupDestination
              .new(
              type: 'OBJECT_STORE',
              id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value',
              vpc_user: 'EXAMPLE-vpcUser-Value',
              vpc_password: 'EXAMPLE-vpcPassword-Value',
              is_zero_data_loss_enabled: false,
              internet_proxy: 'EXAMPLE-internetProxy-Value',
              dbrs_policy_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-dbrsPolicyId-Value',
              is_remote: true,
              remote_region: 'EXAMPLE-remoteRegion-Value'
            )
          ],
          backup_deletion_policy: 'DELETE_AFTER_RETENTION_PERIOD'
        ),
      freeform_tags: {
        'EXAMPLE_KEY_v8a4G' => 'EXAMPLE_VALUE_nWFzrcPj5tpmElIHi92Y'
      },
      defined_tags: {
        'EXAMPLE_KEY_D1sDa' => { 'EXAMPLE_KEY_FjSSS' => 'EXAMPLE--Value' }
      }
    )
  )

# Get the data from response
puts "#{create_distributed_database_response.data}"