public async Task GetDataFlows() { DataFlowClient client = CreateClient(); await using DisposableDataFlow flow = await DisposableDataFlow.Create(client, this.Recording); AsyncPageable <DataFlowResource> dataFlows = client.GetDataFlowsByWorkspaceAsync(); Assert.GreaterOrEqual((await dataFlows.ToListAsync()).Count, 1); }
public async Task DeleteDataFlow() { DataFlowClient client = CreateClient(); DataFlowResource resource = await DisposableDataFlow.CreateResource(client, this.Recording); DataFlowDeleteDataFlowOperation operation = await client.StartDeleteDataFlowAsync(resource.Name); await operation.WaitAndAssertSuccessfulCompletion(); }
public async Task GetDataFlow() { DataFlowClient client = CreateClient(); await using DisposableDataFlow flow = await DisposableDataFlow.Create(client, this.Recording); DataFlowResource dataFlow = await client.GetDataFlowAsync(flow.Name); Assert.AreEqual(flow.Name, dataFlow.Name); }
public override void StartTestRecording() { base.StartTestRecording(); PipelineClient = CreatePipelineClient(); NotebookClient = CreateNotebookClient(); TriggerClient = CreateTriggerClient(); LinkedServiceClient = CreateLinkedServiceClient(); DatasetClient = CreateDatasetClient(); DataFlowClient = CreateDataFlowClient(); }
public void CreateClient() { // Environment variable with the Synapse workspace endpoint. string workspaceUrl = TestEnvironment.WorkspaceUrl; #region Snippet:CreateDataFlowClient // Create a new DataFlow client using the default credential from Azure.Identity using environment variables previously set, // including AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID. DataFlowClient client = new DataFlowClient(endpoint: new Uri(workspaceUrl), credential: new DefaultAzureCredential()); #endregion this.DataFlowClient = client; }
public async Task QuerySessions() { DataFlowClient flowClient = CreateFlowClient(); DataFlowDebugSessionClient debugClient = CreateDebugClient(); await using DisposableDataFlow flow = await DisposableDataFlow.Create(flowClient, this.Recording); await using DisposableDataFlowDebugSession debugSession = await DisposableDataFlowDebugSession.Create(debugClient, this.Recording); AsyncPageable <DataFlowDebugSessionInfo> sessions = debugClient.QueryDataFlowDebugSessionsByWorkspaceAsync(); Assert.GreaterOrEqual((await sessions.ToListAsync()).Count, 1); }
public async Task TestDeleteDataFlow() { string dataFlowName = Recording.GenerateName("DataFlow"); DataFlowCreateOrUpdateDataFlowOperation createOperation = await DataFlowClient.StartCreateOrUpdateDataFlowAsync(dataFlowName, new DataFlowResource(new DataFlow())); await createOperation.WaitForCompletionAsync(); DataFlowDeleteDataFlowOperation deleteOperation = await DataFlowClient.StartDeleteDataFlowAsync(dataFlowName); Response response = await deleteOperation.WaitForCompletionAsync(); Assert.AreEqual(200, response.Status); }
public async Task ExecuteCommand() { DataFlowClient flowClient = CreateFlowClient(); DataFlowDebugSessionClient debugClient = CreateDebugClient(); await using DisposableDataFlow flow = await DisposableDataFlow.Create(flowClient, this.Recording); await using DisposableDataFlowDebugSession debugSession = await DisposableDataFlowDebugSession.Create(debugClient, this.Recording); // SYNAPSE_API_ISSUE - What payload do we need here? DataFlowDebugSessionExecuteCommandOperation executeOperation = await debugClient.StartExecuteCommandAsync(new DataFlowDebugCommandRequest { SessionId = debugSession.SessionId }); DataFlowDebugCommandResponse response = await executeOperation.WaitForCompletionAsync(); Assert.AreEqual(200, response.Status); }
public async Task AddDataFlow() { DataFlowClient flowClient = CreateFlowClient(); DataFlowDebugSessionClient debugClient = CreateDebugClient(); await using DisposableDataFlow flow = await DisposableDataFlow.Create(flowClient, this.Recording); await using DisposableDataFlowDebugSession debugSession = await DisposableDataFlowDebugSession.Create(debugClient, this.Recording); // SYNAPSE_API_ISSUE - Why do we need to pass in SessionId here? DataFlowDebugPackage debugPackage = new DataFlowDebugPackage() { DataFlow = new DataFlowDebugResource(flow.Resource.Properties), SessionId = debugSession.SessionId }; AddDataFlowToDebugSessionResponse response = await debugClient.AddDataFlowAsync(debugPackage); Assert.NotNull(response.JobVersion); }
public SynapseAnalyticsArtifactsClient(string workspaceName, IAzureContext context) { if (context == null) { throw new SynapseException(Resources.InvalidDefaultSubscription); } string suffix = context.Environment.GetEndpoint(AzureEnvironment.ExtendedEndpoint.AzureSynapseAnalyticsEndpointSuffix); Uri uri = new Uri("https://" + workspaceName + "." + suffix); _pipelineClient = new PipelineClient(uri, new AzureSessionCredential(context)); _pipelineRunClient = new PipelineRunClient(uri, new AzureSessionCredential(context)); _linkedServiceClient = new LinkedServiceClient(uri, new AzureSessionCredential(context)); _notebookClient = new NotebookClient(uri, new AzureSessionCredential(context)); _triggerClient = new TriggerClient(uri, new AzureSessionCredential(context)); _triggerRunClient = new TriggerRunClient(uri, new AzureSessionCredential(context)); _datasetClient = new DatasetClient(uri, new AzureSessionCredential(context)); _dataFlowClient = new DataFlowClient(uri, new AzureSessionCredential(context)); }
public async Task DeleteDataFlow() { DataFlowClient client = CreateClient(); DataFlowResource resource = await DisposableDataFlow.CreateResource(client, this.Recording); DataFlowDeleteDataFlowOperation operation = await client.StartDeleteDataFlowAsync(resource.Name); Response response = await operation.WaitForCompletionAsync(); switch (response.Status) { case 200: case 204: break; default: Assert.Fail($"Unexpected status ${response.Status} returned"); break; } }
public async Task DataFlowSample() { #region Snippet:CreateDataFlowClientPrep #if SNIPPET // Replace the string below with your actual endpoint url. string endpoint = "<my-endpoint-url>"; #else string endpoint = TestEnvironment.EndpointUrl; #endif string dataFlowName = "Test-DataFlow"; #endregion #region Snippet:CreateDataFlowClient DataFlowClient client = new DataFlowClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential()); #endregion #region Snippet:CreateDataFlow DataFlowCreateOrUpdateDataFlowOperation operation = client.StartCreateOrUpdateDataFlow(dataFlowName, new DataFlowResource(new DataFlow())); Response <DataFlowResource> createdDataflow = await operation.WaitForCompletionAsync(); #endregion #region Snippet:RetrieveDataFlow DataFlowResource retrievedDataflow = client.GetDataFlow(dataFlowName); #endregion #region Snippet:ListDataFlows Pageable <DataFlowResource> dataFlows = client.GetDataFlowsByWorkspace(); foreach (DataFlowResource dataflow in dataFlows) { System.Console.WriteLine(dataflow.Name); } #endregion #region Snippet:DeleteDataFlow DataFlowDeleteDataFlowOperation deleteOperation = client.StartDeleteDataFlow(dataFlowName); await deleteOperation.WaitForCompletionResponseAsync(); #endregion }
public SynapseAnalyticsArtifactsClient(string workspaceName, IAzureContext context) { if (context == null) { throw new SynapseException(Resources.InvalidDefaultSubscription); } Settings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; Settings.Converters.Add(new TransformationJsonConverter()); Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSActivity>("type")); Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSLinkedService>("type")); Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSTrigger>("type")); Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSDataset>("type")); Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSDataFlow>("type")); string suffix = context.Environment.GetEndpoint(AzureEnvironment.ExtendedEndpoint.AzureSynapseAnalyticsEndpointSuffix); Uri uri = new Uri("https://" + workspaceName + "." + suffix); _pipelineClient = new PipelineClient(uri, new AzureSessionCredential(context)); _pipelineRunClient = new PipelineRunClient(uri, new AzureSessionCredential(context)); _linkedServiceClient = new LinkedServiceClient(uri, new AzureSessionCredential(context)); _notebookClient = new NotebookClient(uri, new AzureSessionCredential(context)); _triggerClient = new TriggerClient(uri, new AzureSessionCredential(context)); _triggerRunClient = new TriggerRunClient(uri, new AzureSessionCredential(context)); _datasetClient = new DatasetClient(uri, new AzureSessionCredential(context)); _dataFlowClient = new DataFlowClient(uri, new AzureSessionCredential(context)); }
public async Task RenameDataFlow() { DataFlowClient client = CreateClient(); DataFlowResource resource = await DisposableDataFlow.CreateResource(client, this.Recording); string newFlowName = Recording.GenerateAssetName("DataFlow2"); DataFlowRenameDataFlowOperation renameOperation = await client.StartRenameDataFlowAsync(resource.Name, new ArtifactRenameRequest() { NewName = newFlowName }); await renameOperation.WaitForCompletionResponseAsync(); DataFlowResource dataFlow = await client.GetDataFlowAsync(newFlowName); Assert.AreEqual(newFlowName, dataFlow.Name); DataFlowDeleteDataFlowOperation operation = await client.StartDeleteDataFlowAsync(newFlowName); await operation.WaitForCompletionResponseAsync(); }
public static async ValueTask <DisposableDataFlow> Create(DataFlowClient client, TestRecording recording) => new DisposableDataFlow(client, await CreateResource(client, recording));
private DisposableDataFlow(DataFlowClient client, DataFlowResource resource) { _client = client; Resource = resource; }