From 1e31b07dce08f8b2e705954116a9a6ed1f0fb319 Mon Sep 17 00:00:00 2001
From: Jingshu923 <52914166+Jingshu923@users.noreply.github.com>
Date: Wed, 16 Dec 2020 04:59:26 +0800
Subject: [PATCH] [DataFactory] Add Encryption To Factory object (#17399)
* [DataFactory] Add Encryption To Factory object
* fix the test
* fix the test
---
.../datafactory_resource-manager.txt | 4 +-
.../src/CHANGELOG.md | 4 +
.../Generated/Models/CMKIdentityDefinition.cs | 53 +++++++++
.../Models/EncryptionConfiguration.cs | 102 ++++++++++++++++++
.../src/Generated/Models/Factory.cs | 16 ++-
.../src/Generated/Models/FactoryIdentity.cs | 16 ++-
...rosoft.Azure.Management.DataFactory.csproj | 10 +-
.../src/Properties/AssemblyInfo.cs | 4 +-
.../ScenarioTests/DataFactoryScenarioTests.cs | 3 +-
.../DataFactoryCrud.json | 2 +-
10 files changed, 196 insertions(+), 18 deletions(-)
create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CMKIdentityDefinition.cs
create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/EncryptionConfiguration.cs
diff --git a/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt b/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt
index ee4baa4227e7..5db932fcbcc3 100644
--- a/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt
+++ b/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt
@@ -4,11 +4,11 @@ Commencing code generation
Generating CSharp code
Executing AutoRest command
cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/datafactory/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2018-06 --csharp-sdks-folder=D:\Projects\azure-sdk-for-net\sdk
-2020-11-18 07:45:56 UTC
+2020-12-08 07:19:34 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
-Commit: 146aefa430221f1dba5befb2d8dad17b8e4c88b7
+Commit: f3be4097a5590d778978d260739d9ca22d3e5cff
AutoRest information
Requested version: v2
Bootstrapper version: autorest@2.0.4413
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md
index 49055e53b72a..b072f1326a50 100644
--- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog for the Azure Data Factory V2 .NET SDK
+## Version 4.14.0
+### Feature Additions
+- Added encryption property for Customer Managed Key
+
## Version 4.13.0
### Feature Additions
- Added publicNetworkAccess property to datafactory
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CMKIdentityDefinition.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CMKIdentityDefinition.cs
new file mode 100644
index 000000000000..c9eabb262a4e
--- /dev/null
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CMKIdentityDefinition.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.DataFactory.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Managed Identity used for CMK.
+ ///
+ public partial class CMKIdentityDefinition
+ {
+ ///
+ /// Initializes a new instance of the CMKIdentityDefinition class.
+ ///
+ public CMKIdentityDefinition()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the CMKIdentityDefinition class.
+ ///
+ /// The resource id of the user
+ /// assigned identity to authenticate to customer's key vault.
+ public CMKIdentityDefinition(string userAssignedIdentity = default(string))
+ {
+ UserAssignedIdentity = userAssignedIdentity;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the resource id of the user assigned identity to
+ /// authenticate to customer's key vault.
+ ///
+ [JsonProperty(PropertyName = "userAssignedIdentity")]
+ public string UserAssignedIdentity { get; set; }
+
+ }
+}
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/EncryptionConfiguration.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/EncryptionConfiguration.cs
new file mode 100644
index 000000000000..7a9910e6bb19
--- /dev/null
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/EncryptionConfiguration.cs
@@ -0,0 +1,102 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.DataFactory.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Definition of CMK for the factory.
+ ///
+ public partial class EncryptionConfiguration
+ {
+ ///
+ /// Initializes a new instance of the EncryptionConfiguration class.
+ ///
+ public EncryptionConfiguration()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EncryptionConfiguration class.
+ ///
+ /// The name of the key in Azure Key Vault to use
+ /// as Customer Managed Key.
+ /// The url of the Azure Key Vault used for
+ /// CMK.
+ /// The version of the key used for CMK. If
+ /// not provided, latest version will be used.
+ /// User assigned identity to use to
+ /// authenticate to customer's key vault. If not provided Managed
+ /// Service Identity will be used.
+ public EncryptionConfiguration(string keyName, string vaultBaseUrl, string keyVersion = default(string), CMKIdentityDefinition identity = default(CMKIdentityDefinition))
+ {
+ KeyName = keyName;
+ VaultBaseUrl = vaultBaseUrl;
+ KeyVersion = keyVersion;
+ Identity = identity;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the name of the key in Azure Key Vault to use as
+ /// Customer Managed Key.
+ ///
+ [JsonProperty(PropertyName = "keyName")]
+ public string KeyName { get; set; }
+
+ ///
+ /// Gets or sets the url of the Azure Key Vault used for CMK.
+ ///
+ [JsonProperty(PropertyName = "vaultBaseUrl")]
+ public string VaultBaseUrl { get; set; }
+
+ ///
+ /// Gets or sets the version of the key used for CMK. If not provided,
+ /// latest version will be used.
+ ///
+ [JsonProperty(PropertyName = "keyVersion")]
+ public string KeyVersion { get; set; }
+
+ ///
+ /// Gets or sets user assigned identity to use to authenticate to
+ /// customer's key vault. If not provided Managed Service Identity will
+ /// be used.
+ ///
+ [JsonProperty(PropertyName = "identity")]
+ public CMKIdentityDefinition Identity { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (KeyName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "KeyName");
+ }
+ if (VaultBaseUrl == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "VaultBaseUrl");
+ }
+ }
+ }
+}
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Factory.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Factory.cs
index e0db13ba3602..d85ff38d01f8 100644
--- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Factory.cs
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Factory.cs
@@ -53,10 +53,12 @@ public Factory()
/// factory.
/// List of parameters for
/// factory.
+ /// Properties to enable Customer Managed Key
+ /// for the factory.
/// Whether or not public network
/// access is allowed for the data factory. Possible values include:
/// 'Enabled', 'Disabled'
- public Factory(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string eTag = default(string), IDictionary additionalProperties = default(IDictionary), FactoryIdentity identity = default(FactoryIdentity), string provisioningState = default(string), System.DateTime? createTime = default(System.DateTime?), string version = default(string), FactoryRepoConfiguration repoConfiguration = default(FactoryRepoConfiguration), IDictionary globalParameters = default(IDictionary), string publicNetworkAccess = default(string))
+ public Factory(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string eTag = default(string), IDictionary additionalProperties = default(IDictionary), FactoryIdentity identity = default(FactoryIdentity), string provisioningState = default(string), System.DateTime? createTime = default(System.DateTime?), string version = default(string), FactoryRepoConfiguration repoConfiguration = default(FactoryRepoConfiguration), IDictionary globalParameters = default(IDictionary), EncryptionConfiguration encryption = default(EncryptionConfiguration), string publicNetworkAccess = default(string))
: base(id, name, type, location, tags, eTag)
{
AdditionalProperties = additionalProperties;
@@ -66,6 +68,7 @@ public Factory()
Version = version;
RepoConfiguration = repoConfiguration;
GlobalParameters = globalParameters;
+ Encryption = encryption;
PublicNetworkAccess = publicNetworkAccess;
CustomInit();
}
@@ -118,6 +121,13 @@ public Factory()
[JsonProperty(PropertyName = "properties.globalParameters")]
public IDictionary GlobalParameters { get; set; }
+ ///
+ /// Gets or sets properties to enable Customer Managed Key for the
+ /// factory.
+ ///
+ [JsonProperty(PropertyName = "properties.encryption")]
+ public EncryptionConfiguration Encryption { get; set; }
+
///
/// Gets or sets whether or not public network access is allowed for
/// the data factory. Possible values include: 'Enabled', 'Disabled'
@@ -147,6 +157,10 @@ public virtual void Validate()
}
}
}
+ if (Encryption != null)
+ {
+ Encryption.Validate();
+ }
}
}
}
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FactoryIdentity.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FactoryIdentity.cs
index 7c8c93879118..40f4a1195d4e 100644
--- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FactoryIdentity.cs
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FactoryIdentity.cs
@@ -11,6 +11,8 @@
namespace Microsoft.Azure.Management.DataFactory.Models
{
using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
using System.Linq;
///
@@ -32,10 +34,13 @@ public FactoryIdentity()
/// The principal id of the identity.
/// The client tenant id of the
/// identity.
- public FactoryIdentity(System.Guid? principalId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?))
+ /// List of user assigned
+ /// identities for the factory.
+ public FactoryIdentity(System.Guid? principalId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), IDictionary userAssignedIdentities = default(IDictionary))
{
PrincipalId = principalId;
TenantId = tenantId;
+ UserAssignedIdentities = userAssignedIdentities;
CustomInit();
}
///
@@ -64,8 +69,13 @@ static FactoryIdentity()
public System.Guid? TenantId { get; private set; }
///
- /// The identity type. Currently the only supported type is
- /// 'SystemAssigned'.
+ /// Gets or sets list of user assigned identities for the factory.
+ ///
+ [JsonProperty(PropertyName = "userAssignedIdentities")]
+ public IDictionary UserAssignedIdentities { get; set; }
+
+ ///
+ /// The identity type.
///
[JsonProperty(PropertyName = "type")]
public static string Type { get; private set; }
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj
index e182795416f4..5cd87889c08d 100644
--- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj
@@ -5,18 +5,12 @@
Microsoft.Azure.Management.DataFactory
Azure Data Factory V2 is the data integration platform that goes beyond Azure Data Factory V1's orchestration and batch-processing of time-series data, with a general purpose app model supporting modern data warehousing patterns and scenarios, lift-and-shift SSIS, and data-driven SaaS applications. Compose and manage reliable and secure data integration workflows at scale. Use native ADF data connectors and Integration Runtimes to move and transform cloud and on-premises data that can be unstructured, semi-structured, and structured with Hadoop, Azure Data Lake, Spark, SQL Server, Cosmos DB and many other data platforms.
- 4.13.0
+ 4.14.0
Microsoft.Azure.Management.DataFactory
Microsoft Azure resource management;Data Factory;ADF;
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Properties/AssemblyInfo.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Properties/AssemblyInfo.cs
index bf155b9ab073..7ac7e98388ae 100644
--- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Properties/AssemblyInfo.cs
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Properties/AssemblyInfo.cs
@@ -6,8 +6,8 @@
[assembly: AssemblyTitle("Microsoft Azure Data Factory Management Library")]
[assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Data Factory Resources.")]
-[assembly: AssemblyVersion("4.13.0.0")]
-[assembly: AssemblyFileVersion("4.13.0.0")]
+[assembly: AssemblyVersion("4.14.0.0")]
+[assembly: AssemblyFileVersion("4.14.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/DataFactoryScenarioTests.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/DataFactoryScenarioTests.cs
index e9544976fc63..2a3de5af0be0 100644
--- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/DataFactoryScenarioTests.cs
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/DataFactoryScenarioTests.cs
@@ -17,7 +17,7 @@ namespace DataFactory.Tests.ScenarioTests
{
public class DataFactoryScenarioTests : ScenarioTestBase
{
- public Factory expectedFactory = new Factory(location: FactoryLocation, publicNetworkAccess: "true");
+ public Factory expectedFactory = new Factory(location: FactoryLocation, publicNetworkAccess: "true", encryption: new EncryptionConfiguration() { VaultBaseUrl = "dummyurl", KeyName = "dummyName" });
[Fact]
[Trait(TraitName.TestType, TestType.Scenario)]
@@ -42,6 +42,7 @@ internal static async Task Create(DataFactoryManagementClient client, string res
AzureOperationResponse createResponse = await client.Factories.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, dataFactoryName, expectedFactory);
ValidateFactory(createResponse.Body, dataFactoryName);
Assert.Equal(createResponse.Body.PublicNetworkAccess, expectedFactory.PublicNetworkAccess);
+ Assert.Equal(createResponse.Body?.Encryption?.VaultBaseUrl, expectedFactory.Encryption?.VaultBaseUrl);
Assert.Equal(HttpStatusCode.OK, createResponse.Response.StatusCode);
AzureOperationResponse getResponse = await client.Factories.GetWithHttpMessagesAsync(resourceGroupName, dataFactoryName);
diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/DataFactoryScenarioTests/DataFactoryCrud.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/DataFactoryScenarioTests/DataFactoryCrud.json
index 19590a2d8517..cf7cc8f70865 100644
--- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/DataFactoryScenarioTests/DataFactoryCrud.json
+++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/DataFactoryScenarioTests/DataFactoryCrud.json
@@ -87,7 +87,7 @@
"Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient/0.8.0.0"
]
},
- "ResponseBody": "{\r\n \"name\": \"sdktestingfactory9776\",\r\n \"id\": \"/subscriptions/c39dce18-cead-4065-8fb1-3af7683a5038/resourceGroups/sdktestingadfrg4712/providers/Microsoft.DataFactory/factories/sdktestingfactory9776\",\r\n \"type\": \"Microsoft.DataFactory/factories\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"createTime\": \"2018-06-22T03:42:16.6466913Z\",\r\n \"version\": \"2018-06-01\",\r\n \"defaults\": {},\r\n \"publicNetworkAccess\": \"true\" },\r\n \"eTag\": \"\\\"0000cd05-0000-0000-0000-5b2c70180000\\\"\",\r\n \"location\": \"West US\",\r\n \"tags\": {}\r\n}",
+ "ResponseBody": "{\r\n \"name\": \"sdktestingfactory9776\",\r\n \"id\": \"/subscriptions/c39dce18-cead-4065-8fb1-3af7683a5038/resourceGroups/sdktestingadfrg4712/providers/Microsoft.DataFactory/factories/sdktestingfactory9776\",\r\n \"type\": \"Microsoft.DataFactory/factories\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"createTime\": \"2018-06-22T03:42:16.6466913Z\",\r\n \"version\": \"2018-06-01\",\r\n \"defaults\": {},\r\n \"publicNetworkAccess\": \"true\",\r\n \"encryption\":{\"keyName\":\"dummyName\",\"vaultBaseUrl\":\"dummyurl\",\"keyVersion\":null,\"identity\":null} },\r\n \"eTag\": \"\\\"0000cd05-0000-0000-0000-5b2c70180000\\\"\",\r\n \"location\": \"West US\",\r\n \"tags\": {}\r\n}",
"ResponseHeaders": {
"Content-Type": [
"application/json; charset=utf-8"