diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Azure.ResourceManager.DataFactory.Samples.csproj b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Azure.ResourceManager.DataFactory.Samples.csproj index 3334980d88bf..1f205f1ede74 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Azure.ResourceManager.DataFactory.Samples.csproj +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Azure.ResourceManager.DataFactory.Samples.csproj @@ -1,8 +1,9 @@  - - - + + + + diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs index 328bc977d32c..ecf9011d9929 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs @@ -7,10 +7,13 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; namespace Azure.ResourceManager.DataFactory.Samples { @@ -53,6 +56,101 @@ public async Task GetAll_DatasetsListByFactory() Console.WriteLine($"Succeeded"); } + // Datasets_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_DatasetsCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Datasets_Create.json + // this example is just showing the usage of "Datasets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryDatasetResource + DataFactoryDatasetCollection collection = dataFactory.GetDataFactoryDatasets(); + + // invoke the operation + string datasetName = "exampleDataset"; + DataFactoryDatasetData data = new DataFactoryDatasetData(new AzureBlobDataset(new DataFactoryLinkedServiceReference("LinkedServiceReference", "exampleLinkedService")) + { + FolderPath = DataFactoryElement.FromExpression("@dataset().MyFolderPath"), + FileName = DataFactoryElement.FromExpression("@dataset().MyFileName"), + Format = new DatasetTextFormat(), + Parameters = +{ +["MyFileName"] = new EntityParameterSpecification(EntityParameterType.String), +["MyFolderPath"] = new EntityParameterSpecification(EntityParameterType.String), +}, + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, datasetName, data); + DataFactoryDatasetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryDatasetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Datasets_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_DatasetsUpdate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Datasets_Update.json + // this example is just showing the usage of "Datasets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryDatasetResource + DataFactoryDatasetCollection collection = dataFactory.GetDataFactoryDatasets(); + + // invoke the operation + string datasetName = "exampleDataset"; + DataFactoryDatasetData data = new DataFactoryDatasetData(new AzureBlobDataset(new DataFactoryLinkedServiceReference("LinkedServiceReference", "exampleLinkedService")) + { + FolderPath = DataFactoryElement.FromExpression("@dataset().MyFolderPath"), + FileName = DataFactoryElement.FromExpression("@dataset().MyFileName"), + Format = new DatasetTextFormat(), + Description = "Example description", + Parameters = +{ +["MyFileName"] = new EntityParameterSpecification(EntityParameterType.String), +["MyFolderPath"] = new EntityParameterSpecification(EntityParameterType.String), +}, + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, datasetName, data); + DataFactoryDatasetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryDatasetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Datasets_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetResource.cs index 622cd5935c1a..fbf0fea19b5a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetResource.cs @@ -9,14 +9,105 @@ using System.Threading.Tasks; using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; namespace Azure.ResourceManager.DataFactory.Samples { public partial class Sample_DataFactoryDatasetResource { + // Datasets_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_DatasetsCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Datasets_Create.json + // this example is just showing the usage of "Datasets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryDatasetResource created on azure + // for more information of creating DataFactoryDatasetResource, please refer to the document of DataFactoryDatasetResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string datasetName = "exampleDataset"; + ResourceIdentifier dataFactoryDatasetResourceId = DataFactoryDatasetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, datasetName); + DataFactoryDatasetResource dataFactoryDataset = client.GetDataFactoryDatasetResource(dataFactoryDatasetResourceId); + + // invoke the operation + DataFactoryDatasetData data = new DataFactoryDatasetData(new AzureBlobDataset(new DataFactoryLinkedServiceReference("LinkedServiceReference", "exampleLinkedService")) + { + FolderPath = DataFactoryElement.FromExpression("@dataset().MyFolderPath"), + FileName = DataFactoryElement.FromExpression("@dataset().MyFileName"), + Format = new DatasetTextFormat(), + Parameters = +{ +["MyFileName"] = new EntityParameterSpecification(EntityParameterType.String), +["MyFolderPath"] = new EntityParameterSpecification(EntityParameterType.String), +}, + }); + ArmOperation lro = await dataFactoryDataset.UpdateAsync(WaitUntil.Completed, data); + DataFactoryDatasetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryDatasetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Datasets_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_DatasetsUpdate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Datasets_Update.json + // this example is just showing the usage of "Datasets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryDatasetResource created on azure + // for more information of creating DataFactoryDatasetResource, please refer to the document of DataFactoryDatasetResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string datasetName = "exampleDataset"; + ResourceIdentifier dataFactoryDatasetResourceId = DataFactoryDatasetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, datasetName); + DataFactoryDatasetResource dataFactoryDataset = client.GetDataFactoryDatasetResource(dataFactoryDatasetResourceId); + + // invoke the operation + DataFactoryDatasetData data = new DataFactoryDatasetData(new AzureBlobDataset(new DataFactoryLinkedServiceReference("LinkedServiceReference", "exampleLinkedService")) + { + FolderPath = DataFactoryElement.FromExpression("@dataset().MyFolderPath"), + FileName = DataFactoryElement.FromExpression("@dataset().MyFileName"), + Format = new DatasetTextFormat(), + Description = "Example description", + Parameters = +{ +["MyFileName"] = new EntityParameterSpecification(EntityParameterType.String), +["MyFolderPath"] = new EntityParameterSpecification(EntityParameterType.String), +}, + }); + ArmOperation lro = await dataFactoryDataset.UpdateAsync(WaitUntil.Completed, data); + DataFactoryDatasetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryDatasetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Datasets_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs index 14a687b439d6..9d45e54bb0a6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs @@ -7,10 +7,13 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; namespace Azure.ResourceManager.DataFactory.Samples { @@ -53,6 +56,87 @@ public async Task GetAll_LinkedServicesListByFactory() Console.WriteLine($"Succeeded"); } + // LinkedServices_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_LinkedServicesCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/LinkedServices_Create.json + // this example is just showing the usage of "LinkedServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryLinkedServiceResource + DataFactoryLinkedServiceCollection collection = dataFactory.GetDataFactoryLinkedServices(); + + // invoke the operation + string linkedServiceName = "exampleLinkedService"; + DataFactoryLinkedServiceData data = new DataFactoryLinkedServiceData(new AzureStorageLinkedService() + { + ConnectionString = DataFactoryElement.FromSecretString("DefaultEndpointsProtocol=https;AccountName=examplestorageaccount;AccountKey="), + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkedServiceName, data); + DataFactoryLinkedServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryLinkedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // LinkedServices_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_LinkedServicesUpdate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/LinkedServices_Update.json + // this example is just showing the usage of "LinkedServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryLinkedServiceResource + DataFactoryLinkedServiceCollection collection = dataFactory.GetDataFactoryLinkedServices(); + + // invoke the operation + string linkedServiceName = "exampleLinkedService"; + DataFactoryLinkedServiceData data = new DataFactoryLinkedServiceData(new AzureStorageLinkedService() + { + ConnectionString = DataFactoryElement.FromSecretString("DefaultEndpointsProtocol=https;AccountName=examplestorageaccount;AccountKey="), + Description = "Example description", + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkedServiceName, data); + DataFactoryLinkedServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryLinkedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // LinkedServices_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceResource.cs index 504f2d2f8f1f..50011d9e17ca 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceResource.cs @@ -9,14 +9,91 @@ using System.Threading.Tasks; using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; namespace Azure.ResourceManager.DataFactory.Samples { public partial class Sample_DataFactoryLinkedServiceResource { + // LinkedServices_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_LinkedServicesCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/LinkedServices_Create.json + // this example is just showing the usage of "LinkedServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryLinkedServiceResource created on azure + // for more information of creating DataFactoryLinkedServiceResource, please refer to the document of DataFactoryLinkedServiceResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string linkedServiceName = "exampleLinkedService"; + ResourceIdentifier dataFactoryLinkedServiceResourceId = DataFactoryLinkedServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, linkedServiceName); + DataFactoryLinkedServiceResource dataFactoryLinkedService = client.GetDataFactoryLinkedServiceResource(dataFactoryLinkedServiceResourceId); + + // invoke the operation + DataFactoryLinkedServiceData data = new DataFactoryLinkedServiceData(new AzureStorageLinkedService() + { + ConnectionString = DataFactoryElement.FromSecretString("DefaultEndpointsProtocol=https;AccountName=examplestorageaccount;AccountKey="), + }); + ArmOperation lro = await dataFactoryLinkedService.UpdateAsync(WaitUntil.Completed, data); + DataFactoryLinkedServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryLinkedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // LinkedServices_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_LinkedServicesUpdate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/LinkedServices_Update.json + // this example is just showing the usage of "LinkedServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryLinkedServiceResource created on azure + // for more information of creating DataFactoryLinkedServiceResource, please refer to the document of DataFactoryLinkedServiceResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string linkedServiceName = "exampleLinkedService"; + ResourceIdentifier dataFactoryLinkedServiceResourceId = DataFactoryLinkedServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, linkedServiceName); + DataFactoryLinkedServiceResource dataFactoryLinkedService = client.GetDataFactoryLinkedServiceResource(dataFactoryLinkedServiceResourceId); + + // invoke the operation + DataFactoryLinkedServiceData data = new DataFactoryLinkedServiceData(new AzureStorageLinkedService() + { + ConnectionString = DataFactoryElement.FromSecretString("DefaultEndpointsProtocol=https;AccountName=examplestorageaccount;AccountKey="), + Description = "Example description", + }); + ArmOperation lro = await dataFactoryLinkedService.UpdateAsync(WaitUntil.Completed, data); + DataFactoryLinkedServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryLinkedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // LinkedServices_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs index 06f8d93133e8..8cf731acea67 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs @@ -7,10 +7,12 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; namespace Azure.ResourceManager.DataFactory.Samples { @@ -53,6 +55,46 @@ public async Task GetAll_CredentialsListByFactory() Console.WriteLine($"Succeeded"); } + // Credentials_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CredentialsCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Credentials_Create.json + // this example is just showing the usage of "CredentialOperations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryManagedIdentityCredentialResource + DataFactoryManagedIdentityCredentialCollection collection = dataFactory.GetDataFactoryManagedIdentityCredentials(); + + // invoke the operation + string credentialName = "exampleCredential"; + DataFactoryManagedIdentityCredentialData data = new DataFactoryManagedIdentityCredentialData(new DataFactoryManagedIdentityCredentialDefinition() + { + ResourceId = "/subscriptions/12345678-1234-1234-1234-12345678abc/resourcegroups/exampleResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleUami", + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, credentialName, data); + DataFactoryManagedIdentityCredentialResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryManagedIdentityCredentialData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Credentials_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialResource.cs index 5926fa9a31a8..c0ce2cc59b3e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialResource.cs @@ -12,11 +12,49 @@ using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; namespace Azure.ResourceManager.DataFactory.Samples { public partial class Sample_DataFactoryManagedIdentityCredentialResource { + // Credentials_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CredentialsCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Credentials_Create.json + // this example is just showing the usage of "CredentialOperations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryManagedIdentityCredentialResource created on azure + // for more information of creating DataFactoryManagedIdentityCredentialResource, please refer to the document of DataFactoryManagedIdentityCredentialResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string credentialName = "exampleCredential"; + ResourceIdentifier dataFactoryManagedIdentityCredentialResourceId = DataFactoryManagedIdentityCredentialResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, credentialName); + DataFactoryManagedIdentityCredentialResource dataFactoryManagedIdentityCredential = client.GetDataFactoryManagedIdentityCredentialResource(dataFactoryManagedIdentityCredentialResourceId); + + // invoke the operation + DataFactoryManagedIdentityCredentialData data = new DataFactoryManagedIdentityCredentialData(new DataFactoryManagedIdentityCredentialDefinition() + { + ResourceId = "/subscriptions/12345678-1234-1234-1234-12345678abc/resourcegroups/exampleResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleUami", + }); + ArmOperation lro = await dataFactoryManagedIdentityCredential.UpdateAsync(WaitUntil.Completed, data); + DataFactoryManagedIdentityCredentialResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryManagedIdentityCredentialData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Credentials_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs index e558f3728ee1..0253aef3bd44 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs @@ -6,11 +6,14 @@ #nullable disable using System; +using System.Collections.Generic; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; namespace Azure.ResourceManager.DataFactory.Samples { @@ -53,6 +56,183 @@ public async Task GetAll_PipelinesListByFactory() Console.WriteLine($"Succeeded"); } + // Pipelines_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PipelinesCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Pipelines_Create.json + // this example is just showing the usage of "Pipelines_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryPipelineResource + DataFactoryPipelineCollection collection = dataFactory.GetDataFactoryPipelines(); + + // invoke the operation + string pipelineName = "examplePipeline"; + DataFactoryPipelineData data = new DataFactoryPipelineData() + { + Activities = +{ +new ForEachActivity("ExampleForeachActivity",new DataFactoryExpressionDefinition(DataFactoryExpressionType.Expression,"@pipeline().parameters.OutputBlobNameList"),new DataFactoryActivity[] +{ +new CopyActivity("ExampleCopyActivity",new DataFactoryBlobSource(),new DataFactoryBlobSink()) +{ +Inputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromString("examplecontainer.csv"), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +Outputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["type"] = "Expression", +["value"] = "@item()"}), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +DataIntegrationUnits = 32, +} +}) +{ +IsSequential = true, +} +}, + Parameters = +{ +["JobId"] = new EntityParameterSpecification(EntityParameterType.String), +["OutputBlobNameList"] = new EntityParameterSpecification(EntityParameterType.Array), +}, + Variables = +{ +["TestVariableArray"] = new PipelineVariableSpecification(PipelineVariableType.Array), +}, + RunDimensions = +{ +["JobId"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["type"] = "Expression", +["value"] = "@pipeline().parameters.JobId"}), +}, + ElapsedTimeMetricDuration = BinaryData.FromString("0.00:10:00"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, pipelineName, data); + DataFactoryPipelineResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryPipelineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Pipelines_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PipelinesUpdate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Pipelines_Update.json + // this example is just showing the usage of "Pipelines_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryPipelineResource + DataFactoryPipelineCollection collection = dataFactory.GetDataFactoryPipelines(); + + // invoke the operation + string pipelineName = "examplePipeline"; + DataFactoryPipelineData data = new DataFactoryPipelineData() + { + Description = "Example description", + Activities = +{ +new ForEachActivity("ExampleForeachActivity",new DataFactoryExpressionDefinition(DataFactoryExpressionType.Expression,"@pipeline().parameters.OutputBlobNameList"),new DataFactoryActivity[] +{ +new CopyActivity("ExampleCopyActivity",new DataFactoryBlobSource(),new DataFactoryBlobSink()) +{ +Inputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromString("examplecontainer.csv"), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +Outputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["type"] = "Expression", +["value"] = "@item()"}), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +DataIntegrationUnits = 32, +} +}) +{ +IsSequential = true, +} +}, + Parameters = +{ +["OutputBlobNameList"] = new EntityParameterSpecification(EntityParameterType.Array), +}, + ElapsedTimeMetricDuration = BinaryData.FromString("0.00:10:00"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, pipelineName, data); + DataFactoryPipelineResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryPipelineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Pipelines_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineResource.cs index eb5d5cbb7a63..51464076b998 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineResource.cs @@ -19,6 +19,177 @@ namespace Azure.ResourceManager.DataFactory.Samples { public partial class Sample_DataFactoryPipelineResource { + // Pipelines_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PipelinesCreate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Pipelines_Create.json + // this example is just showing the usage of "Pipelines_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryPipelineResource created on azure + // for more information of creating DataFactoryPipelineResource, please refer to the document of DataFactoryPipelineResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string pipelineName = "examplePipeline"; + ResourceIdentifier dataFactoryPipelineResourceId = DataFactoryPipelineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, pipelineName); + DataFactoryPipelineResource dataFactoryPipeline = client.GetDataFactoryPipelineResource(dataFactoryPipelineResourceId); + + // invoke the operation + DataFactoryPipelineData data = new DataFactoryPipelineData() + { + Activities = +{ +new ForEachActivity("ExampleForeachActivity",new DataFactoryExpressionDefinition(DataFactoryExpressionType.Expression,"@pipeline().parameters.OutputBlobNameList"),new DataFactoryActivity[] +{ +new CopyActivity("ExampleCopyActivity",new DataFactoryBlobSource(),new DataFactoryBlobSink()) +{ +Inputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromString("examplecontainer.csv"), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +Outputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["type"] = "Expression", +["value"] = "@item()"}), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +DataIntegrationUnits = 32, +} +}) +{ +IsSequential = true, +} +}, + Parameters = +{ +["JobId"] = new EntityParameterSpecification(EntityParameterType.String), +["OutputBlobNameList"] = new EntityParameterSpecification(EntityParameterType.Array), +}, + Variables = +{ +["TestVariableArray"] = new PipelineVariableSpecification(PipelineVariableType.Array), +}, + RunDimensions = +{ +["JobId"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["type"] = "Expression", +["value"] = "@pipeline().parameters.JobId"}), +}, + ElapsedTimeMetricDuration = BinaryData.FromString("0.00:10:00"), + }; + ArmOperation lro = await dataFactoryPipeline.UpdateAsync(WaitUntil.Completed, data); + DataFactoryPipelineResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryPipelineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Pipelines_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PipelinesUpdate() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Pipelines_Update.json + // this example is just showing the usage of "Pipelines_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryPipelineResource created on azure + // for more information of creating DataFactoryPipelineResource, please refer to the document of DataFactoryPipelineResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string pipelineName = "examplePipeline"; + ResourceIdentifier dataFactoryPipelineResourceId = DataFactoryPipelineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, pipelineName); + DataFactoryPipelineResource dataFactoryPipeline = client.GetDataFactoryPipelineResource(dataFactoryPipelineResourceId); + + // invoke the operation + DataFactoryPipelineData data = new DataFactoryPipelineData() + { + Description = "Example description", + Activities = +{ +new ForEachActivity("ExampleForeachActivity",new DataFactoryExpressionDefinition(DataFactoryExpressionType.Expression,"@pipeline().parameters.OutputBlobNameList"),new DataFactoryActivity[] +{ +new CopyActivity("ExampleCopyActivity",new DataFactoryBlobSource(),new DataFactoryBlobSink()) +{ +Inputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromString("examplecontainer.csv"), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +Outputs = +{ +new DatasetReference(DatasetReferenceType.DatasetReference,"exampleDataset") +{ +Parameters = +{ +["MyFileName"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["type"] = "Expression", +["value"] = "@item()"}), +["MyFolderPath"] = BinaryData.FromString("examplecontainer"), +}, +} +}, +DataIntegrationUnits = 32, +} +}) +{ +IsSequential = true, +} +}, + Parameters = +{ +["OutputBlobNameList"] = new EntityParameterSpecification(EntityParameterType.Array), +}, + ElapsedTimeMetricDuration = BinaryData.FromString("0.00:10:00"), + }; + ArmOperation lro = await dataFactoryPipeline.UpdateAsync(WaitUntil.Completed, data); + DataFactoryPipelineResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataFactoryPipelineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Pipelines_Get [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryResource.cs index b8b4b4300844..c3c7f3f711ca 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryResource.cs @@ -6,9 +6,11 @@ #nullable disable using System; +using System.Collections.Generic; using System.Threading.Tasks; using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.DataFactory; @@ -607,6 +609,129 @@ public async Task GetDataFlowDebugSessions_DataFlowDebugSessionQueryByFactory() Console.WriteLine($"Succeeded"); } + // DataFlowDebugSession_AddDataFlow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task AddDataFlowToDebugSession_DataFlowDebugSessionAddDataFlow() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/DataFlowDebugSession_AddDataFlow.json + // this example is just showing the usage of "DataFlowDebugSession_AddDataFlow" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // invoke the operation + DataFactoryDataFlowDebugPackageContent content = new DataFactoryDataFlowDebugPackageContent() + { + SessionId = Guid.Parse("f06ed247-9d07-49b2-b05e-2cb4a2fc871e"), + DataFlow = new DataFactoryDataFlowDebugInfo(new DataFactoryMappingDataFlowDefinition() + { + Sources = +{ +new DataFlowSource("source1") +{ +Dataset = new DatasetReference(DatasetReferenceType.DatasetReference,"DelimitedText2"), +} +}, + Sinks = +{ +}, + Transformations = +{ +}, + Script = "\n\nsource(output(\n\t\tColumn_1 as string\n\t),\n\tallowSchemaDrift: true,\n\tvalidateSchema: false) ~> source1", + }) + { + Name = "dataflow1", + }, + Datasets = +{ +new DataFactoryDatasetDebugInfo(new DelimitedTextDataset(new DataFactoryLinkedServiceReference("LinkedServiceReference","linkedService5")) +{ +DataLocation = new AzureBlobStorageLocation() +{ +Container = "dataflow-sample-data", +FileName = "Ansiencoding.csv", +}, +ColumnDelimiter = ",", +QuoteChar = "\"", +EscapeChar = "\\", +FirstRowAsHeader = true, +Schema = new DatasetSchemaDataElement[] +{ +new DatasetSchemaDataElement() +{ +SchemaColumnType = "String", +} +}, +Annotations = +{ +}, +}) +{ +Name = "dataset1", +} +}, + LinkedServices = +{ +new DataFactoryLinkedServiceDebugInfo(new AzureBlobStorageLinkedService() +{ +ConnectionString = "DefaultEndpointsProtocol=https;AccountName=;EndpointSuffix=core.windows.net;", +EncryptedCredential = BinaryData.FromString(""), +Annotations = +{ +}, +}) +{ +Name = "linkedService1", +} +}, + DebugSettings = new DataFlowDebugPackageDebugSettings() + { + SourceSettings = +{ +new DataFlowSourceSetting() +{ +SourceName = "source1", +RowLimit = 1000, +},new DataFlowSourceSetting() +{ +SourceName = "source2", +RowLimit = 222, +} +}, + Parameters = +{ +["sourcePath"] = BinaryData.FromString("Toy"), +}, + DatasetParameters = BinaryData.FromObjectAsJson(new Dictionary() + { + ["Movies"] = new Dictionary() + { + ["path"] = "abc" + }, + ["Output"] = new Dictionary() + { + ["time"] = "def" + } + }), + }, + }; + DataFactoryDataFlowStartDebugSessionResult result = await dataFactory.AddDataFlowToDebugSessionAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + // DataFlowDebugSession_Delete [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/autorest.tests.md b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/autorest.tests.md index 249f7b27d258..f26fdc2eb48f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/autorest.tests.md +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/autorest.tests.md @@ -10,11 +10,4 @@ require: ../src/autorest.md include-x-ms-examples-original-file: true testgen: sample: true - skipped-operations: - - DataFlowDebugSession_AddDataFlow - - Datasets_CreateOrUpdate - - LinkedServices_CreateOrUpdate - - Pipelines_CreateOrUpdate - - CredentialOperations_CreateOrUpdate - - DataFlowDebugSession_AddDataFlow ```