// 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.OpsiService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Opsi
{
    public class CreateExadataInsightExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createExadataInsightDetails = new Oci.OpsiService.Models.CreateMacsManagedCloudExadataInsightDetails
			{
				ExadataInfraId = "ocid1.test.oc1..<unique_ID>EXAMPLE-exadataInfraId-Value",
				MemberVmClusterDetails = new List<Oci.OpsiService.Models.CreateMacsManagedCloudExadataVmclusterDetails>
				{
					new Oci.OpsiService.Models.CreateMacsManagedCloudExadataVmclusterDetails
					{
						MemberDatabaseDetails = new List<Oci.OpsiService.Models.CreateMacsManagedCloudDatabaseInsightDetails>
						{
							new Oci.OpsiService.Models.CreateMacsManagedCloudDatabaseInsightDetails
							{
								DatabaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
								ManagementAgentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value",
								ConnectionDetails = new Oci.OpsiService.Models.ConnectionDetails
								{
									HostName = "EXAMPLE-hostName-Value",
									Protocol = Oci.OpsiService.Models.ConnectionDetails.ProtocolEnum.Tcps,
									Port = 55865,
									ServiceName = "EXAMPLE-serviceName-Value"
								},
								ConnectionCredentialDetails = new Oci.OpsiService.Models.CredentialByVault
								{
									UserName = "EXAMPLE-userName-Value",
									PasswordSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-passwordSecretId-Value",
									WalletSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-walletSecretId-Value",
									Role = Oci.OpsiService.Models.CredentialByVault.RoleEnum.Normal,
									CredentialSourceName = "EXAMPLE-credentialSourceName-Value"
								},
								DatabaseResourceType = "EXAMPLE-databaseResourceType-Value",
								DeploymentType = Oci.OpsiService.Models.CreateMacsManagedCloudDatabaseInsightDetails.DeploymentTypeEnum.BareMetal,
								SystemTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_XhBts", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_W1brF", 
												"EXAMPLE--Value"
											}
										}
									}
								},
								CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
								FreeformTags = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_6dA8t", 
										"EXAMPLE_VALUE_LFJLc2sHB4ZZOWrkUhHU"
									}
								},
								DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_dvYky", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_Z4Z4N", 
												"EXAMPLE--Value"
											}
										}
									}
								}
							}
						},
						MemberAutonomousDetails = new List<Oci.OpsiService.Models.CreateMacsManagedAutonomousDatabaseInsightDetails>
						{
							new Oci.OpsiService.Models.CreateMacsManagedAutonomousDatabaseInsightDetails
							{
								DatabaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
								ManagementAgentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value",
								ConnectionDetails = new Oci.OpsiService.Models.ConnectionDetails
								{
									HostName = "EXAMPLE-hostName-Value",
									Protocol = Oci.OpsiService.Models.ConnectionDetails.ProtocolEnum.Tcps,
									Port = 45591,
									ServiceName = "EXAMPLE-serviceName-Value"
								},
								ConnectionCredentialDetails = new Oci.OpsiService.Models.CredentialByNamedCredentials
								{
									NamedCredentialId = "ocid1.test.oc1..<unique_ID>EXAMPLE-namedCredentialId-Value",
									CredentialSourceName = "EXAMPLE-credentialSourceName-Value"
								},
								DatabaseResourceType = "EXAMPLE-databaseResourceType-Value",
								DeploymentType = Oci.OpsiService.Models.CreateMacsManagedAutonomousDatabaseInsightDetails.DeploymentTypeEnum.Exacc,
								SystemTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_0GEFG", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_R9XOt", 
												"EXAMPLE--Value"
											}
										}
									}
								},
								CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
								FreeformTags = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_l7QED", 
										"EXAMPLE_VALUE_1gulsykmShivU6dyYcer"
									}
								},
								DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_TTD11", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_TLLyE", 
												"EXAMPLE--Value"
											}
										}
									}
								}
							}
						},
						VmclusterId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vmclusterId-Value",
						CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"
					}
				},
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_cSKYw", 
						"EXAMPLE_VALUE_mq0kKpv912UOWW22y029"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_JTlIP", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_4d52C", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createExadataInsightRequest = new Oci.OpsiService.Requests.CreateExadataInsightRequest
			{
				CreateExadataInsightDetails = createExadataInsightDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "N8SMUNVJMUMUCYIRB8JG<unique_ID>"
			};

            // 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 OperationsInsightsClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateExadataInsight(createExadataInsightRequest);
					// Retrieve value from the response.
					var id = response.ExadataInsight.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateExadataInsight Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?