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

namespace Oci.Sdk.DotNet.Example.Datacc
{
    public class CreateInfrastructureExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createInfrastructureDetails = new Oci.DataccService.Models.CreateInfrastructureDetails
			{
				Description = "EXAMPLE-description-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				DisplayName = "EXAMPLE-displayName-Value",
				SystemModel = Oci.DataccService.Models.SystemModelEnum.X10Ha512,
				Shape = Oci.DataccService.Models.ShapeEnum.TwelveSsds,
				CloudControlPlaneServer1 = "EXAMPLE-cloudControlPlaneServer1-Value",
				CloudControlPlaneServer2 = "EXAMPLE-cloudControlPlaneServer2-Value",
				Netmask = "EXAMPLE-netmask-Value",
				Gateway = "EXAMPLE-gateway-Value",
				AdminNetworkcidr = "EXAMPLE-adminNetworkcidr-Value",
				DataDiskPercentage = 37,
				Contacts = new List<Oci.DataccService.Models.InfrastructureContact>
				{
					new Oci.DataccService.Models.InfrastructureContact
					{
						Name = "EXAMPLE-name-Value",
						PhoneNumber = "EXAMPLE-phoneNumber-Value",
						Email = "EXAMPLE-email-Value",
						IsPrimary = false,
						IsContactMosValidated = true
					}
				},
				DnsServers = new List<string>
				{
					"EXAMPLE--Value"
				},
				NtpServers = new List<string>
				{
					"EXAMPLE--Value"
				},
				ClientNetworkBondingMode = Oci.DataccService.Models.NetworkBondingMode.Lacp,
				BackupNetworkBondingMode = Oci.DataccService.Models.NetworkBondingMode.Lacp,
				CpsNetworkBondingMode = Oci.DataccService.Models.NetworkBondingMode.Lacp,
				ClientNetworkBondingInterface = Oci.DataccService.Models.NetworkBondingInterfaceEnum.Btbond1,
				BackupNetworkBondingInterface = Oci.DataccService.Models.NetworkBondingInterfaceEnum.Btbond6,
				CpsNetworkBondingInterface = Oci.DataccService.Models.NetworkBondingInterfaceEnum.Btbond2,
				AcfsFileSystemStorageInGbs = 2911.327,
				CorporateProxy = "EXAMPLE-corporateProxy-Value",
				VlanId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value",
				MaintenanceWindow = new Oci.DataccService.Models.MaintenanceWindow
				{
					Preference = Oci.DataccService.Models.MaintenancePreference.NoPreference,
					PatchingMode = Oci.DataccService.Models.BasePatchingMode.Rolling,
					IsCustomActionTimeoutEnabled = true,
					CustomActionTimeoutInMins = 651,
					IsMonthlyPatchingEnabled = false,
					Months = new List<Oci.DataccService.Models.MaintenanceWindow.MonthsEnum>
					{
						Oci.DataccService.Models.MaintenanceWindow.MonthsEnum.October
					},
					WeeksOfMonth = new List<Int32>
					{
						2
					},
					DaysOfWeek = new List<Oci.DataccService.Models.MaintenanceWindow.DaysOfWeekEnum>
					{
						Oci.DataccService.Models.MaintenanceWindow.DaysOfWeekEnum.Wednesday
					},
					HoursOfDay = new List<Int32>
					{
						10
					},
					LeadTimeInWeeks = 3
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_MnWMb", 
						"EXAMPLE_VALUE_4UB3nE6jctj4CLs9pHjk"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_B1qKJ", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_JCBjo", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createInfrastructureRequest = new Oci.DataccService.Requests.CreateInfrastructureRequest
			{
				CreateInfrastructureDetails = createInfrastructureDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "IJW6DCQFW9RPUSBZUQLI<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 BaseinfraClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateInfrastructure(createInfrastructureRequest);
					// Retrieve value from the response.
					var id = response.Infrastructure.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateInfrastructure Failed with {e.Message}");
                throw e;
            }
        }

    }
}