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

namespace Oci.Sdk.DotNet.Example.Dif
{
    public class CreateStackExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createStackDetails = new Oci.DifService.Models.CreateStackDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				NotificationEmail = "EXAMPLE-notificationEmail-Value",
				StackTemplates = new List<Oci.DifService.Models.StackTemplate>
				{
					Oci.DifService.Models.StackTemplate.Aiservices
				},
				Services = new List<Oci.DifService.Models.Service>
				{
					Oci.DifService.Models.Service.Adb
				},
				Adb = new List<Oci.DifService.Models.AdbDetail>
				{
					new Oci.DifService.Models.AdbDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						DbWorkload = Oci.DifService.Models.DbWorkload.Oltp,
						Ecpu = 326,
						DataStorageSizeInTBs = 46,
						AdminPasswordId = "ocid1.test.oc1..<unique_ID>EXAMPLE-adminPasswordId-Value",
						IsMtlsConnectionRequired = false,
						SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
						DbVersion = "EXAMPLE-dbVersion-Value",
						ToolsPublicAccess = "EXAMPLE-toolsPublicAccess-Value",
						IsPublic = true
					}
				},
				Ggcs = new List<Oci.DifService.Models.GgcsDetail>
				{
					new Oci.DifService.Models.GgcsDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						Ocpu = 551,
						SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
						PublicSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-publicSubnetId-Value",
						PasswordSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-passwordSecretId-Value",
						OggVersion = "EXAMPLE-oggVersion-Value",
						Connections = new List<Oci.DifService.Models.GgcsConnectionDetails>
						{
							new Oci.DifService.Models.GgcsConnectionDetails
							{
								ConnectionName = "EXAMPLE-connectionName-Value",
								DifDependencies = new List<Oci.DifService.Models.DifDependencyDetails>
								{
									new Oci.DifService.Models.DifDependencyDetails
									{
										ServiceType = "EXAMPLE-serviceType-Value",
										ServiceInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"
									}
								},
								GgAdminSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-ggAdminSecretId-Value",
								ConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-connectionId-Value"
							}
						}
					}
				},
				Dataflow = new List<Oci.DifService.Models.DataflowDetail>
				{
					new Oci.DifService.Models.DataflowDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						SparkVersion = "EXAMPLE-sparkVersion-Value",
						DriverShape = "EXAMPLE-driverShape-Value",
						ExecutorShape = "EXAMPLE-executorShape-Value",
						DriverShapeConfig = new Oci.DifService.Models.ShapeConfig
						{
							MemoryInGBs = 941,
							Ocpus = 683
						},
						ExecutorShapeConfig = new Oci.DifService.Models.ShapeConfig
						{
							MemoryInGBs = 621,
							Ocpus = 14
						},
						NumExecutors = 858,
						PrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value",
						Connections = new Oci.DifService.Models.DataflowConnections
						{
							SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
							ConnectionDetails = new Oci.DifService.Models.DataflowConnectionDetails
							{
								DifDependencies = new List<Oci.DifService.Models.DifDependencyDetails>
								{
									new Oci.DifService.Models.DifDependencyDetails
									{
										ServiceType = "EXAMPLE-serviceType-Value",
										ServiceInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"
									}
								},
								DomainNames = new List<string>
								{
									"EXAMPLE--Value"
								}
							}
						},
						LogBucketInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logBucketInstanceId-Value",
						WarehouseBucketInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-warehouseBucketInstanceId-Value"
					}
				},
				Objectstorage = new List<Oci.DifService.Models.ObjectStorageDetail>
				{
					new Oci.DifService.Models.ObjectStorageDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						ObjectVersioning = Oci.DifService.Models.ObjectVersioning.Enabled,
						StorageTier = Oci.DifService.Models.StorageTier.Standard,
						AutoTiering = Oci.DifService.Models.AutoTiering.Infrequentaccess
					}
				},
				Genai = new List<Oci.DifService.Models.GenAiDetail>
				{
					new Oci.DifService.Models.GenAiDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						ClusterType = Oci.DifService.Models.ClusterType.Hosting,
						BaseModel = "EXAMPLE-baseModel-Value",
						OciRegion = "EXAMPLE-ociRegion-Value",
						UnitCount = 586,
						Endpoints = new List<Oci.DifService.Models.EndpointDetails>
						{
							new Oci.DifService.Models.EndpointDetails
							{
								EndpointName = "EXAMPLE-endpointName-Value",
								IsContentModerationEnabled = true
							}
						}
					}
				},
				Aidataplatform = new List<Oci.DifService.Models.AiDataPlatformDetail>
				{
					new Oci.DifService.Models.AiDataPlatformDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						DefaultWorkspaceName = "EXAMPLE-defaultWorkspaceName-Value"
					}
				},
				Omk = new List<Oci.DifService.Models.OmkDetail>
				{
					new Oci.DifService.Models.OmkDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						ClusterNamespaceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterNamespaceId-Value",
						ClusterId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterId-Value",
						NamespaceName = "EXAMPLE-namespaceName-Value"
					}
				},
				Oke = new List<Oci.DifService.Models.OkeDetail>
				{
					new Oci.DifService.Models.OkeDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						ClusterId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterId-Value",
						NamespaceName = "EXAMPLE-namespaceName-Value"
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_ZL2gU", 
						"EXAMPLE_VALUE_RQcKY2CnENW9hw6BMJDp"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_n6BNR", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_UoQAe", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createStackRequest = new Oci.DifService.Requests.CreateStackRequest
			{
				CreateStackDetails = createStackDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "RBZXLTYZCMFRRINKDMYL<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 StackClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateStack(createStackRequest);
					// Retrieve value from the response.
					var id = response.Stack.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateStack Failed with {e.Message}");
                throw e;
            }
        }

    }
}