# 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
opsi_client = OCI::Opsi::OperationsInsightsClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
create_exadata_insight_response =
  opsi_client.create_exadata_insight(
    OCI::Opsi::Models::CreateMacsManagedCloudExadataInsightDetails.new(
      entity_source: 'MACS_MANAGED_CLOUD_EXADATA',
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      exadata_infra_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-exadataInfraId-Value',
      freeform_tags: {
        'EXAMPLE_KEY_OcoCa' => 'EXAMPLE_VALUE_E3wW4GNLTduhvD0Kafkk'
      },
      defined_tags: {
        'EXAMPLE_KEY_McoTj' => { 'EXAMPLE_KEY_vJhlW' => 'EXAMPLE--Value' }
      },
      member_vm_cluster_details: [
        OCI::Opsi::Models::CreateMacsManagedCloudExadataVmclusterDetails.new(
          vm_cluster_type: 'vmCluster',
          vmcluster_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vmclusterId-Value',
          compartment_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
          member_database_details: [
            OCI::Opsi::Models::CreateMacsManagedCloudDatabaseInsightDetails.new(
              entity_source: 'MACS_MANAGED_CLOUD_DATABASE',
              compartment_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
              database_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value',
              management_agent_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value',
              connection_details:
                OCI::Opsi::Models::ConnectionDetails.new(
                  host_name: 'EXAMPLE-hostName-Value',
                  protocol: 'TCPS',
                  port: 2975,
                  service_name: 'EXAMPLE-serviceName-Value'
                ),
              connection_credential_details:
                OCI::Opsi::Models::CredentialByNamedCredentials.new(
                  credential_type: 'CREDENTIALS_BY_NAMED_CREDS',
                  credential_source_name: 'EXAMPLE-credentialSourceName-Value',
                  named_credential_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-namedCredentialId-Value'
                ),
              database_resource_type: 'EXAMPLE-databaseResourceType-Value',
              deployment_type: 'BARE_METAL',
              freeform_tags: {
                'EXAMPLE_KEY_ipRj0' => 'EXAMPLE_VALUE_Jjn5QVqKapeu0gI7mNeH'
              },
              defined_tags: {
                'EXAMPLE_KEY_vlvLK' => {
                  'EXAMPLE_KEY_UGPov' => 'EXAMPLE--Value'
                }
              },
              system_tags: {
                'EXAMPLE_KEY_gXcg3' => {
                  'EXAMPLE_KEY_PSPWw' => 'EXAMPLE--Value'
                }
              }
            )
          ],
          member_autonomous_details: [
            OCI::Opsi::Models::CreateMacsManagedAutonomousDatabaseInsightDetails
              .new(
              entity_source: 'MACS_MANAGED_AUTONOMOUS_DATABASE',
              compartment_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
              database_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value',
              management_agent_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value',
              connection_details:
                OCI::Opsi::Models::ConnectionDetails.new(
                  host_name: 'EXAMPLE-hostName-Value',
                  protocol: 'TCP',
                  port: 51_223,
                  service_name: 'EXAMPLE-serviceName-Value'
                ),
              connection_credential_details:
                OCI::Opsi::Models::CredentialByNamedCredentials.new(
                  credential_type: 'CREDENTIALS_BY_NAMED_CREDS',
                  credential_source_name: 'EXAMPLE-credentialSourceName-Value',
                  named_credential_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-namedCredentialId-Value'
                ),
              database_resource_type: 'EXAMPLE-databaseResourceType-Value',
              deployment_type: 'EXACC',
              freeform_tags: {
                'EXAMPLE_KEY_uiCDI' => 'EXAMPLE_VALUE_ziUecrwp5Cc1CYNI1r5K'
              },
              defined_tags: {
                'EXAMPLE_KEY_NHf7r' => {
                  'EXAMPLE_KEY_HQCS5' => 'EXAMPLE--Value'
                }
              },
              system_tags: {
                'EXAMPLE_KEY_ZB28g' => {
                  'EXAMPLE_KEY_v7Kcg' => 'EXAMPLE--Value'
                }
              }
            )
          ]
        )
      ]
    )
  )

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