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

namespace Oci.Sdk.DotNet.Example.Datascience
{
    public class CreateNotebookSessionExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createNotebookSessionDetails = new Oci.DatascienceService.Models.CreateNotebookSessionDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				ProjectId = "ocid1.test.oc1..<unique_ID>EXAMPLE-projectId-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				NotebookSessionConfigurationDetails = new Oci.DatascienceService.Models.NotebookSessionConfigurationDetails
				{
					Shape = "EXAMPLE-shape-Value",
					BlockStorageSizeInGBs = 1851,
					SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
					PrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value",
					NotebookSessionShapeConfigDetails = new Oci.DatascienceService.Models.NotebookSessionShapeConfigDetails
					{
						Ocpus = (float)44.889362,
						MemoryInGBs = (float)943.496,
						CpuBaseline = Oci.DatascienceService.Models.NotebookSessionShapeConfigDetails.CpuBaselineEnum.Baseline12
					}
				},
				NotebookSessionConfigDetails = new Oci.DatascienceService.Models.NotebookSessionConfigDetails
				{
					Shape = "EXAMPLE-shape-Value",
					BlockStorageSizeInGBs = 8063,
					SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
					PrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value",
					NotebookSessionShapeConfigDetails = new Oci.DatascienceService.Models.NotebookSessionShapeConfigDetails
					{
						Ocpus = (float)32.117176,
						MemoryInGBs = (float)415.29492,
						CpuBaseline = Oci.DatascienceService.Models.NotebookSessionShapeConfigDetails.CpuBaselineEnum.Baseline11
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_kkYsg", 
						"EXAMPLE_VALUE_4qmbvYu1nP3ranRNgheF"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_6K4SL", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_cL5ol", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				NotebookSessionRuntimeConfigDetails = new Oci.DatascienceService.Models.NotebookSessionRuntimeConfigDetails
				{
					CustomEnvironmentVariables = new Dictionary<string, string>()
					{
						{
							"EXAMPLE_KEY_ymD4D", 
							"EXAMPLE_VALUE_bN2k74kOmckEq66wWKti"
						}
					},
					NotebookSessionGitConfigDetails = new Oci.DatascienceService.Models.NotebookSessionGitConfigDetails
					{
						NotebookSessionGitRepoConfigCollection = new List<Oci.DatascienceService.Models.NotebookSessionGitRepoConfigDetails>
						{
							new Oci.DatascienceService.Models.NotebookSessionGitRepoConfigDetails
							{
								Url = "EXAMPLE-url-Value"
							}
						}
					}
				},
				NotebookSessionStorageMountConfigurationDetailsList = new List<Oci.DatascienceService.Models.StorageMountConfigurationDetails>
				{
					new Oci.DatascienceService.Models.FileStorageMountConfigurationDetails
					{
						MountTargetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-mountTargetId-Value",
						ExportId = "ocid1.test.oc1..<unique_ID>EXAMPLE-exportId-Value",
						DestinationDirectoryName = "EXAMPLE-destinationDirectoryName-Value",
						DestinationPath = "EXAMPLE-destinationPath-Value"
					}
				}
			};
			var createNotebookSessionRequest = new Oci.DatascienceService.Requests.CreateNotebookSessionRequest
			{
				CreateNotebookSessionDetails = createNotebookSessionDetails,
				OpcRequestId = "XKSV3PJSG6KIWRFKT4AM<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 DataScienceClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateNotebookSession(createNotebookSessionRequest);
					// Retrieve value from the response.
					var id = response.NotebookSession.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateNotebookSession Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?