public void ListNotebooks() { #region Snippet:ListNotebooks Pageable <NotebookResource> notebooks = notebookClient.GetNotebooksByWorkspace(); foreach (NotebookResource notebook in notebooks) { System.Console.WriteLine(notebook.Name); } #endregion }
public async Task CreateAndUploadNotebook() { #region Snippet:CreateNotebookClient #if SNIPPET // Replace the string below with your actual endpoint url. string endpoint = "<my-endpoint-url>"; #else string endpoint = TestEnvironment.EndpointUrl; #endif var client = new NotebookClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential()); #endregion #region Snippet:ConfigureNotebookResource string notebookName = "Test-Notebook"; var cell = new NotebookCell("code", new NotebookMetadata(), new string[] { "from azureml.opendatasets import NycTlcYellow\n", "\n", "data = NycTlcYellow()\n", "df = data.to_spark_dataframe()\n", "# Display 10 rows\n", "display(df.limit(10))" }); var newNotebook = new Notebook(new NotebookMetadata(), 4, 2, new NotebookCell[] { cell }); var notebookResource = new NotebookResource(notebookName, newNotebook); #endregion #region Snippet:CreateNotebook NotebookCreateOrUpdateNotebookOperation operation = await client.StartCreateOrUpdateNotebookAsync(notebookName, notebookResource); await operation.WaitForCompletionAsync(); Console.WriteLine("The notebook is created"); #endregion #region Snippet:RetrieveNotebook NotebookResource retrievedNotebook = client.GetNotebook(notebookName); #endregion #region Snippet:ListNotebooks Pageable <NotebookResource> notebooks = client.GetNotebooksByWorkspace(); foreach (NotebookResource notebook in notebooks) { Console.WriteLine(notebook.Name); } #endregion #region Snippet:DeleteNotebook NotebookDeleteNotebookOperation deleteNotebookOperation = client.StartDeleteNotebook(notebookName); await deleteNotebookOperation.WaitForCompletionResponseAsync(); #endregion }
public async Task NotebookSample() { #region Snippet:CreateNotebookClient // Replace the string below with your actual endpoint url. string endpoint = "<my-endpoint-url>"; /*@@*/ endpoint = TestEnvironment.EndpointUrl; NotebookClient client = new NotebookClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential()); #endregion #region Snippet:CreateNotebook Notebook newNotebook = new Notebook( new NotebookMetadata { LanguageInfo = new NotebookLanguageInfo(name: "Python") }, nbformat: 4, nbformatMinor: 2, new List <NotebookCell>() ); string notebookName = "MyNotebook"; NotebookCreateOrUpdateNotebookOperation operation = client.StartCreateOrUpdateNotebook(notebookName, new NotebookResource(notebookName, newNotebook)); Response <NotebookResource> createdNotebook = await operation.WaitForCompletionAsync(); #endregion #region Snippet:RetrieveNotebook NotebookResource retrievedNotebook = client.GetNotebook("MyNotebook"); #endregion #region Snippet:ListNotebooks Pageable <NotebookResource> notebooks = client.GetNotebooksByWorkspace(); foreach (NotebookResource notebook in notebooks) { System.Console.WriteLine(notebook.Name); } #endregion #region Snippet:DeleteNotebook client.StartDeleteNotebook("MyNotebook"); #endregion }
public Pageable <NotebookResource> GetNotebooksByWorkspace() { return(_notebookClient.GetNotebooksByWorkspace()); }