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

namespace Oci.Sdk.DotNet.Example.Containerengine
{
    public class CreateClusterExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createClusterDetails = new Oci.ContainerengineService.Models.CreateClusterDetails
			{
				Name = "EXAMPLE-name-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				EndpointConfig = new Oci.ContainerengineService.Models.CreateClusterEndpointConfigDetails
				{
					SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
					NsgIds = new List<string>
					{
						"EXAMPLE--Value"
					},
					IsPublicIpEnabled = false,
				},
				VcnId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value",
				KubernetesVersion = "EXAMPLE-kubernetesVersion-Value",
				KmsKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_MgZDD", 
						"EXAMPLE_VALUE_67867e4frl1M8p9Y3jKf"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_dGuFP", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_wHsVz", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				Options = new Oci.ContainerengineService.Models.ClusterCreateOptions
				{
					ServiceLbSubnetIds = new List<string>
					{
						"EXAMPLE--Value"
					},
					IpFamilies = new List<Oci.ContainerengineService.Models.ClusterCreateOptions.IpFamiliesEnum>
					{
						Oci.ContainerengineService.Models.ClusterCreateOptions.IpFamiliesEnum.IPv4
					},
					KubernetesNetworkConfig = new Oci.ContainerengineService.Models.KubernetesNetworkConfig
					{
						PodsCidr = "EXAMPLE-podsCidr-Value",
						ServicesCidr = "EXAMPLE-servicesCidr-Value"
					},
					AddOns = new Oci.ContainerengineService.Models.AddOnOptions
					{
						IsKubernetesDashboardEnabled = false,
						IsTillerEnabled = false
					},
					AdmissionControllerOptions = new Oci.ContainerengineService.Models.AdmissionControllerOptions
					{
						IsPodSecurityPolicyEnabled = true
					},
					PersistentVolumeConfig = new Oci.ContainerengineService.Models.PersistentVolumeConfigDetails
					{
						FreeformTags = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_ICfFa", 
								"EXAMPLE_VALUE_tsuqbyIJG2e9am5c1Pia"
							}
						},
						DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
						{
							{
								"EXAMPLE_KEY_ap5xW", 
								new Dictionary<string, Object>()
								{
									{
										"EXAMPLE_KEY_EQBEf", 
										"EXAMPLE--Value"
									}
								}
							}
						}
					},
					ServiceLbConfig = new Oci.ContainerengineService.Models.ServiceLbConfigDetails
					{
						FreeformTags = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_PZm6R", 
								"EXAMPLE_VALUE_KJjSdy6cx6xXdfuHWMeU"
							}
						},
						DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
						{
							{
								"EXAMPLE_KEY_aofkS", 
								new Dictionary<string, Object>()
								{
									{
										"EXAMPLE_KEY_VOhyK", 
										"EXAMPLE--Value"
									}
								}
							}
						},
						BackendNsgIds = new List<string>
						{
							"EXAMPLE--Value"
						}
					},
					OpenIdConnectTokenAuthenticationConfig = new Oci.ContainerengineService.Models.OpenIdConnectTokenAuthenticationConfig
					{
						IssuerUrl = "EXAMPLE-issuerUrl-Value",
						ClientId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value",
						UsernameClaim = "EXAMPLE-usernameClaim-Value",
						UsernamePrefix = "EXAMPLE-usernamePrefix-Value",
						GroupsClaim = "EXAMPLE-groupsClaim-Value",
						GroupsPrefix = "EXAMPLE-groupsPrefix-Value",
						RequiredClaims = new List<Oci.ContainerengineService.Models.KeyValue>
						{
							new Oci.ContainerengineService.Models.KeyValue
							{
								Key = "EXAMPLE-key-Value",
								Value = "EXAMPLE-value-Value"
							}
						},
						CaCertificate = "EXAMPLE-caCertificate-Value",
						SigningAlgorithms = new List<string>
						{
							"EXAMPLE--Value"
						},
						IsOpenIdConnectAuthEnabled = false,
						ConfigurationFile = "EXAMPLE-configurationFile-Value"
					},
					OpenIdConnectDiscovery = new Oci.ContainerengineService.Models.OpenIdConnectDiscovery
					{
						IsOpenIdConnectDiscoveryEnabled = true
					}
				},
				ImagePolicyConfig = new Oci.ContainerengineService.Models.CreateImagePolicyConfigDetails
				{
					IsPolicyEnabled = false,
					KeyDetails = new List<Oci.ContainerengineService.Models.KeyDetails>
					{
						new Oci.ContainerengineService.Models.KeyDetails
						{
							KmsKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"
						}
					}
				},
				ClusterPodNetworkOptions = new List<Oci.ContainerengineService.Models.ClusterPodNetworkOptionDetails>
				{
					new Oci.ContainerengineService.Models.OciVcnIpNativeClusterPodNetworkOptionDetails
					{
					}
				},
				Type = Oci.ContainerengineService.Models.ClusterType.BasicCluster
			};
			var createClusterRequest = new Oci.ContainerengineService.Requests.CreateClusterRequest
			{
				CreateClusterDetails = createClusterDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "4CDLUP9029YILCRURFRD<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 ContainerEngineClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateCluster(createClusterRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateCluster Failed with {e.Message}");
                throw e;
            }
        }

    }
}