// 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 AddExadataInsightMembersExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var addExadataInsightMembersDetails = new Oci.OpsiService.Models.AddPeComanagedExadataInsightMembersDetails
			{
				MemberEntityDetails = new List<Oci.OpsiService.Models.CreatePeComanagedExadataVmclusterDetails>
				{
					new Oci.OpsiService.Models.CreatePeComanagedExadataVmclusterDetails
					{
						VmclusterId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vmclusterId-Value",
						OpsiPrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-opsiPrivateEndpointId-Value",
						DbmPrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbmPrivateEndpointId-Value",
						MemberDatabaseDetails = new List<Oci.OpsiService.Models.CreatePeComanagedDatabaseInsightDetails>
						{
							new Oci.OpsiService.Models.CreatePeComanagedDatabaseInsightDetails
							{
								DatabaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
								DatabaseResourceType = "EXAMPLE-databaseResourceType-Value",
								OpsiPrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-opsiPrivateEndpointId-Value",
								DbmPrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbmPrivateEndpointId-Value",
								ServiceName = "EXAMPLE-serviceName-Value",
								CredentialDetails = new Oci.OpsiService.Models.CredentialByNamedCredentials
								{
									NamedCredentialId = "ocid1.test.oc1..<unique_ID>EXAMPLE-namedCredentialId-Value",
									CredentialSourceName = "EXAMPLE-credentialSourceName-Value"
								},
								ConnectionDetails = new Oci.OpsiService.Models.PeComanagedDatabaseConnectionDetails
								{
									Hosts = new List<Oci.OpsiService.Models.PeComanagedDatabaseHostDetails>
									{
										new Oci.OpsiService.Models.PeComanagedDatabaseHostDetails
										{
											HostIp = "EXAMPLE-hostIp-Value",
											Port = 32281
										}
									},
									Protocol = Oci.OpsiService.Models.PeComanagedDatabaseConnectionDetails.ProtocolEnum.Tcp,
									ServiceName = "EXAMPLE-serviceName-Value"
								},
								DeploymentType = Oci.OpsiService.Models.CreatePeComanagedDatabaseInsightDetails.DeploymentTypeEnum.VirtualMachine,
								SystemTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_6tXYz", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_Wts9a", 
												"EXAMPLE--Value"
											}
										}
									}
								},
								CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
								FreeformTags = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_c16wM", 
										"EXAMPLE_VALUE_d11RbyZdR3V3QnU9y5rp"
									}
								},
								DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_llyYW", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_lk51i", 
												"EXAMPLE--Value"
											}
										}
									}
								}
							}
						},
						VmClusterType = Oci.OpsiService.Models.ExadataVmClusterType.VmCluster,
						MemberAutonomousDetails = new List<Oci.OpsiService.Models.CreateAutonomousDatabaseInsightDetails>
						{
							new Oci.OpsiService.Models.CreateAutonomousDatabaseInsightDetails
							{
								DatabaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
								DatabaseResourceType = "EXAMPLE-databaseResourceType-Value",
								IsAdvancedFeaturesEnabled = true,
								ConnectionDetails = new Oci.OpsiService.Models.ConnectionDetails
								{
									HostName = "EXAMPLE-hostName-Value",
									Protocol = Oci.OpsiService.Models.ConnectionDetails.ProtocolEnum.Tcps,
									Port = 26746,
									ServiceName = "EXAMPLE-serviceName-Value"
								},
								CredentialDetails = 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"
								},
								OpsiPrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-opsiPrivateEndpointId-Value",
								SystemTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_ZvLgd", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_r9wXm", 
												"EXAMPLE--Value"
											}
										}
									}
								},
								CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
								FreeformTags = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_Uzl41", 
										"EXAMPLE_VALUE_Fz8zpDtO9qX8m2FvkqDL"
									}
								},
								DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
								{
									{
										"EXAMPLE_KEY_kQvJb", 
										new Dictionary<string, Object>()
										{
											{
												"EXAMPLE_KEY_Bit1Y", 
												"EXAMPLE--Value"
											}
										}
									}
								}
							}
						},
						CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"
					}
				}
			};
			var addExadataInsightMembersRequest = new Oci.OpsiService.Requests.AddExadataInsightMembersRequest
			{
				AddExadataInsightMembersDetails = addExadataInsightMembersDetails,
				ExadataInsightId = "ocid1.test.oc1..<unique_ID>EXAMPLE-exadataInsightId-Value",
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "CQWPH45JYN6IA5SIB6BB<unique_ID>",
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
			};

            // 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.AddExadataInsightMembers(addExadataInsightMembersRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"AddExadataInsightMembers Failed with {e.Message}");
                throw e;
            }
        }

    }
}