mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-23 05:10:30 -04:00
Azure SQL Hybrid Cloud Toolkit Notebooks Extension Command (#13286)
* added extension folder incomplete * WIP extension progress * notebook finally opens in side panel * notebook now opens via notebook extension * html file spaces restored * package json fixed * fixed vscode import issue * more cleanup * remove git stuff * placeholder icon logos added * fixed gulpfile * cleanup changes * vscode import fixed * fixed main and yarn.lock * added provided notebooks view * formatting for package.json * removed first command as its not necessary * fixed notebook typo * readded spaces
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
using Microsoft.Azure.WebJobs;
|
||||
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
|
||||
using Microsoft.Azure.WebJobs.Extensions.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ADPControl
|
||||
{
|
||||
public static class HttpSurface
|
||||
{
|
||||
public class ExportRequest
|
||||
{
|
||||
public Guid SubscriptionId { get; set; }
|
||||
|
||||
public string ResourceGroupName { get; set; }
|
||||
|
||||
public string SourceSqlServerResourceGroupName { get; set; }
|
||||
|
||||
public string SourceSqlServerName { get; set; }
|
||||
|
||||
public string BatchAccountUrl { get; set; }
|
||||
|
||||
public string StorageAccountName { get; set; }
|
||||
|
||||
public string AccessToken { get; set; }
|
||||
|
||||
public string VNetSubnetId { get; set; }
|
||||
}
|
||||
|
||||
public class ImportRequest
|
||||
{
|
||||
public Guid SubscriptionId { get; set; }
|
||||
|
||||
public string ResourceGroupName { get; set; }
|
||||
|
||||
public string TargetSqlServerResourceGroupName { get; set; }
|
||||
|
||||
public string TargetSqlServerName { get; set; }
|
||||
|
||||
public string TargetAccessToken { get; set; }
|
||||
|
||||
public string BatchAccountUrl { get; set; }
|
||||
|
||||
public string StorageAccountName { get; set; }
|
||||
|
||||
public string ContainerName { get; set; }
|
||||
|
||||
public string SqlAdminPassword { get; set; }
|
||||
|
||||
public string VNetSubnetId { get; set; }
|
||||
}
|
||||
|
||||
[FunctionName("Export")]
|
||||
public static async Task<HttpResponseMessage> PostExport(
|
||||
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Export")]
|
||||
HttpRequestMessage req,
|
||||
[DurableClient] IDurableOrchestrationClient starter,
|
||||
ILogger log,
|
||||
Guid subscriptionId,
|
||||
string resourceGroupName)
|
||||
{
|
||||
log.LogInformation("C# HTTP trigger function processed an Export request.");
|
||||
ExportRequest request = await req.Content.ReadAsAsync<ExportRequest>();
|
||||
|
||||
request.SubscriptionId = subscriptionId;
|
||||
request.ResourceGroupName = resourceGroupName;
|
||||
|
||||
if (request.SourceSqlServerResourceGroupName == null)
|
||||
request.SourceSqlServerResourceGroupName = resourceGroupName;
|
||||
|
||||
string instanceId = await starter.StartNewAsync(nameof(Orchestrator.RunExportOrchestrator), request);
|
||||
|
||||
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
|
||||
return starter.CreateCheckStatusResponse(req, instanceId);
|
||||
}
|
||||
|
||||
[FunctionName("Import")]
|
||||
public static async Task<HttpResponseMessage> PostImport(
|
||||
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Import")]
|
||||
HttpRequestMessage req,
|
||||
[DurableClient] IDurableOrchestrationClient starter,
|
||||
ILogger log,
|
||||
Guid subscriptionId,
|
||||
string resourceGroupName)
|
||||
{
|
||||
log.LogInformation("C# HTTP trigger function processed an Import request.");
|
||||
ImportRequest request = await req.Content.ReadAsAsync<ImportRequest>();
|
||||
|
||||
request.SubscriptionId = subscriptionId;
|
||||
request.ResourceGroupName = resourceGroupName;
|
||||
|
||||
if (request.TargetSqlServerResourceGroupName == null)
|
||||
request.TargetSqlServerResourceGroupName = resourceGroupName;
|
||||
|
||||
string instanceId = await starter.StartNewAsync(nameof(Orchestrator.RunImportOrchestrator), request);
|
||||
|
||||
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
|
||||
return starter.CreateCheckStatusResponse(req, instanceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user