public async Task LinkedServiceSample() { #region Snippet:CreateLinkedServiceClient // Replace the string below with your actual endpoint url. string endpoint = "<my-endpoint-url>"; /*@@*/ endpoint = TestEnvironment.EndpointUrl; LinkedServiceClient client = new LinkedServiceClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential()); #endregion #region Snippet:CreateLinkedService LinkedServiceResource serviceResource = new LinkedServiceResource(new AzureDataLakeStoreLinkedService("adl://test.azuredatalakestore.net/")); LinkedServiceCreateOrUpdateLinkedServiceOperation operation = client.StartCreateOrUpdateLinkedService("MyLinkedService", serviceResource); Response <LinkedServiceResource> createdService = await operation.WaitForCompletionAsync(); #endregion #region Snippet:RetrieveLinkedService LinkedServiceResource retrievedService = client.GetLinkedService("MyLinkedService"); #endregion #region Snippet:ListLinkedServices Pageable <LinkedServiceResource> linkedServices = client.GetLinkedServicesByWorkspace(); foreach (LinkedServiceResource linkedService in linkedServices) { System.Console.WriteLine(linkedService.Name); } #endregion #region Snippet:DeleteLinkedService client.StartDeleteLinkedService("MyLinkedService"); #endregion }
public void CreateLinkedService() { #region Snippet:CreateLinkedService LinkedServiceCreateOrUpdateLinkedServiceOperation operation = LinkedServiceClient.StartCreateOrUpdateLinkedService("MyLinkedService", new LinkedServiceResource(new AzureDataLakeStoreLinkedService("adl://test.azuredatalakestore.net/"))); LinkedServiceResource linkedService = operation.WaitForCompletionAsync().ConfigureAwait(true).GetAwaiter().GetResult(); #endregion }
public static async ValueTask <LinkedServiceResource> CreateResource(LinkedServiceClient client, TestRecording recording) { string linkedServiceName = recording.GenerateId("LinkedService", 16); LinkedServiceResource resource = new LinkedServiceResource(new AzureDataLakeStoreLinkedService("adl://test.azuredatalakestore.net/")); LinkedServiceCreateOrUpdateLinkedServiceOperation operation = await client.StartCreateOrUpdateLinkedServiceAsync(linkedServiceName, resource); return(await operation.WaitForCompletionAsync()); }
public async Task TestCreateLinkedService() { string linkedServiceName = Recording.GenerateName("LinkedSercive"); LinkedServiceCreateOrUpdateLinkedServiceOperation operation = await LinkedServiceClient.StartCreateOrUpdateLinkedServiceAsync(linkedServiceName, new LinkedServiceResource(new AzureDataLakeStoreLinkedService("adl://test.azuredatalakestore.net/"))); LinkedServiceResource linkedService = await operation.WaitForCompletionAsync(); Assert.AreEqual(linkedServiceName, linkedService.Name); }
public async Task TestDeleteLinkedService() { string linkedServiceName = Recording.GenerateName("LinkedSercive"); LinkedServiceCreateOrUpdateLinkedServiceOperation createOperation = await LinkedServiceClient.StartCreateOrUpdateLinkedServiceAsync(linkedServiceName, new LinkedServiceResource(new AzureDataLakeStoreLinkedService("adl://test.azuredatalakestore.net/"))); await createOperation.WaitForCompletionAsync(); LinkedServiceDeleteLinkedServiceOperation deleteOperation = await LinkedServiceClient.StartDeleteLinkedServiceAsync(linkedServiceName); Response response = await deleteOperation.WaitForCompletionAsync(); Assert.AreEqual(200, response.Status); }