diff --git a/eng/mgmt/mgmtmetadata/storage_resource-manager.txt b/eng/mgmt/mgmtmetadata/storage_resource-manager.txt index ed425bc9d5a7..a7cb1cb7e98f 100644 --- a/eng/mgmt/mgmtmetadata/storage_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/storage_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/storage/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\code\srpsdk\sdk\storage\Microsoft.Azure.Management.Storage\src\Generated -2019-12-04 03:39:46 UTC +2020-01-09 05:20:18 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 0cf70260108cb40bc68d408674c187ed065f8c64 +Commit: ab39a9391daabde74622420b4cde8eda443f0084 AutoRest information Requested version: latest Bootstrapper version: autorest@2.0.4407 diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionService.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionService.cs index 2ad3e28c28df..6144adee6030 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionService.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionService.cs @@ -36,10 +36,16 @@ public EncryptionService() /// returned when encryption is enabled. There might be some /// unencrypted blobs which were written after this time, as it is just /// a rough estimate. - public EncryptionService(bool? enabled = default(bool?), System.DateTime? lastEnabledTime = default(System.DateTime?)) + /// Encryption key type to be used for the + /// encryption service. 'Account' key type implies that an + /// account-scoped encryption key will be used. 'Service' key type + /// implies that a default service key is used. Possible values + /// include: 'Service', 'Account' + public EncryptionService(bool? enabled = default(bool?), System.DateTime? lastEnabledTime = default(System.DateTime?), string keyType = default(string)) { Enabled = enabled; LastEnabledTime = lastEnabledTime; + KeyType = keyType; CustomInit(); } @@ -64,5 +70,15 @@ public EncryptionService() [JsonProperty(PropertyName = "lastEnabledTime")] public System.DateTime? LastEnabledTime { get; private set; } + /// + /// Gets or sets encryption key type to be used for the encryption + /// service. 'Account' key type implies that an account-scoped + /// encryption key will be used. 'Service' key type implies that a + /// default service key is used. Possible values include: 'Service', + /// 'Account' + /// + [JsonProperty(PropertyName = "keyType")] + public string KeyType { get; set; } + } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionServices.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionServices.cs index e4be12f6f978..fd7586a27f9e 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionServices.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/EncryptionServices.cs @@ -64,16 +64,16 @@ public EncryptionServices() public EncryptionService File { get; set; } /// - /// Gets the encryption function of the table storage service. + /// Gets or sets the encryption function of the table storage service. /// [JsonProperty(PropertyName = "table")] - public EncryptionService Table { get; private set; } + public EncryptionService Table { get; set; } /// - /// Gets the encryption function of the queue storage service. + /// Gets or sets the encryption function of the queue storage service. /// [JsonProperty(PropertyName = "queue")] - public EncryptionService Queue { get; private set; } + public EncryptionService Queue { get; set; } } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/KeyType.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/KeyType.cs new file mode 100644 index 000000000000..0ae2853331b9 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/KeyType.cs @@ -0,0 +1,22 @@ +// +// 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.Storage.Models +{ + + /// + /// Defines values for KeyType. + /// + public static class KeyType + { + public const string Service = "Service"; + public const string Account = "Account"; + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs index 48b57c1bea08..39d9250ccca6 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs @@ -39,7 +39,7 @@ public static IEnumerable> ApiInfo_StorageManageme public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\\code\\srpsdk\\sdk\\storage\\Microsoft.Azure.Management.Storage\\src\\Generated"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "0cf70260108cb40bc68d408674c187ed065f8c64"; + public static readonly String GithubCommidId = "ab39a9391daabde74622420b4cde8eda443f0084"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Microsoft.Azure.Management.Storage.csproj b/sdk/storage/Microsoft.Azure.Management.Storage/src/Microsoft.Azure.Management.Storage.csproj index 246e872edd78..f7dcfb746199 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Microsoft.Azure.Management.Storage.csproj +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Microsoft.Azure.Management.Storage.csproj @@ -7,7 +7,7 @@ Microsoft.Azure.Management.Storage Microsoft Azure Management Storage Library Microsoft.Azure.Management.Storage - 14.2.0 + 14.3.0 Microsoft Azure Storage management;Storage;Storage management; See https://aka.ms/asdotnetsdkchangelog for release notes. diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Properties/AssemblyInfo.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Properties/AssemblyInfo.cs index 63b2ca0cca73..9a5d25a95dc6 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Properties/AssemblyInfo.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ [assembly: AssemblyDescription("Provides Microsoft Azure Storage management functions for managing the Microsoft Azure Storage service.")] [assembly: AssemblyVersion("14.0.0.0")] -[assembly: AssemblyFileVersion("14.2.0.0")] +[assembly: AssemblyFileVersion("14.3.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/tests/SessionRecords/StorageAccountTests/StorageAccountCreateWithTableQueueEcryptionKeyTypeTest.json b/sdk/storage/Microsoft.Azure.Management.Storage/tests/SessionRecords/StorageAccountTests/StorageAccountCreateWithTableQueueEcryptionKeyTypeTest.json new file mode 100644 index 000000000000..8012befa43f2 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/tests/SessionRecords/StorageAccountTests/StorageAccountCreateWithTableQueueEcryptionKeyTypeTest.json @@ -0,0 +1,213 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/45b60d85-fd72-427a-a708-f994d26e593e/resourcegroups/res9107?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDViNjBkODUtZmQ3Mi00MjdhLWE3MDgtZjk5NGQyNmU1OTNlL3Jlc291cmNlZ3JvdXBzL3JlczkxMDc/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus2\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0b80d418-ddcb-4549-b86d-b3560005556e" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "29" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "532f68a9-7025-46b8-b03f-80cd5112bb4b" + ], + "x-ms-correlation-request-id": [ + "532f68a9-7025-46b8-b03f-80cd5112bb4b" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20200109T045143Z:532f68a9-7025-46b8-b03f-80cd5112bb4b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Thu, 09 Jan 2020 04:51:42 GMT" + ], + "Content-Length": [ + "168" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/45b60d85-fd72-427a-a708-f994d26e593e/resourceGroups/res9107\",\r\n \"name\": \"res9107\",\r\n \"location\": \"eastus2\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/45b60d85-fd72-427a-a708-f994d26e593e/resourceGroups/res9107/providers/Microsoft.Storage/storageAccounts/sto5715?api-version=2019-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDViNjBkODUtZmQ3Mi00MjdhLWE3MDgtZjk5NGQyNmU1OTNlL3Jlc291cmNlR3JvdXBzL3JlczkxMDcvcHJvdmlkZXJzL01pY3Jvc29mdC5TdG9yYWdlL3N0b3JhZ2VBY2NvdW50cy9zdG81NzE1P2FwaS12ZXJzaW9uPTIwMTktMDYtMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_GRS\"\r\n },\r\n \"kind\": \"StorageV2\",\r\n \"location\": \"East US 2 EUAP\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"properties\": {\r\n \"encryption\": {\r\n \"services\": {\r\n \"table\": {\r\n \"keyType\": \"Account\"\r\n },\r\n \"queue\": {\r\n \"keyType\": \"Account\"\r\n }\r\n },\r\n \"keySource\": \"Microsoft.Storage\"\r\n }\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6511d45a-d4d4-483b-9382-3e7de1003ea0" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Storage.StorageManagementClient/14.2.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "421" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/45b60d85-fd72-427a-a708-f994d26e593e/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/86e1bfe0-3b4c-4b88-9d30-aec4b59d38df?monitor=true&api-version=2019-06-01" + ], + "Retry-After": [ + "17" + ], + "x-ms-request-id": [ + "86e1bfe0-3b4c-4b88-9d30-aec4b59d38df" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "6ebf832e-b21c-48cc-b850-9f91205f04b2" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20200109T045150Z:6ebf832e-b21c-48cc-b850-9f91205f04b2" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Thu, 09 Jan 2020 04:51:49 GMT" + ], + "Content-Type": [ + "text/plain; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/45b60d85-fd72-427a-a708-f994d26e593e/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/86e1bfe0-3b4c-4b88-9d30-aec4b59d38df?monitor=true&api-version=2019-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDViNjBkODUtZmQ3Mi00MjdhLWE3MDgtZjk5NGQyNmU1OTNlL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvZWFzdHVzMmV1YXAvYXN5bmNvcGVyYXRpb25zLzg2ZTFiZmUwLTNiNGMtNGI4OC05ZDMwLWFlYzRiNTlkMzhkZj9tb25pdG9yPXRydWUmYXBpLXZlcnNpb249MjAxOS0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.27817.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Storage.StorageManagementClient/14.2.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "4f7eb573-7bd2-460c-9834-be62a5ebc353" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-correlation-request-id": [ + "f6051fb6-89b5-427c-9447-0bef6b067ef1" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20200109T045207Z:f6051fb6-89b5-427c-9447-0bef6b067ef1" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Thu, 09 Jan 2020 04:52:07 GMT" + ], + "Content-Length": [ + "1483" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_GRS\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"kind\": \"StorageV2\",\r\n \"id\": \"/subscriptions/45b60d85-fd72-427a-a708-f994d26e593e/resourceGroups/res9107/providers/Microsoft.Storage/storageAccounts/sto5715\",\r\n \"name\": \"sto5715\",\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"location\": \"eastus2euap\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"properties\": {\r\n \"privateEndpointConnections\": [],\r\n \"networkAcls\": {\r\n \"bypass\": \"AzureServices\",\r\n \"virtualNetworkRules\": [],\r\n \"ipRules\": [],\r\n \"defaultAction\": \"Allow\"\r\n },\r\n \"supportsHttpsTrafficOnly\": true,\r\n \"encryption\": {\r\n \"services\": {\r\n \"file\": {\r\n \"keyType\": \"Account\",\r\n \"enabled\": true,\r\n \"lastEnabledTime\": \"2020-01-09T04:51:49.4371023Z\"\r\n },\r\n \"table\": {\r\n \"keyType\": \"Account\",\r\n \"enabled\": true,\r\n \"lastEnabledTime\": \"2020-01-09T04:51:49.4371023Z\"\r\n },\r\n \"queue\": {\r\n \"keyType\": \"Account\",\r\n \"enabled\": true,\r\n \"lastEnabledTime\": \"2020-01-09T04:51:49.4371023Z\"\r\n },\r\n \"blob\": {\r\n \"keyType\": \"Account\",\r\n \"enabled\": true,\r\n \"lastEnabledTime\": \"2020-01-09T04:51:49.4371023Z\"\r\n }\r\n },\r\n \"keySource\": \"Microsoft.Storage\"\r\n },\r\n \"accessTier\": \"Hot\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"creationTime\": \"2020-01-09T04:51:49.374628Z\",\r\n \"primaryEndpoints\": {\r\n \"dfs\": \"https://sto5715.dfs.core.windows.net/\",\r\n \"web\": \"https://sto5715.z3.web.core.windows.net/\",\r\n \"blob\": \"https://sto5715.blob.core.windows.net/\",\r\n \"queue\": \"https://sto5715.queue.core.windows.net/\",\r\n \"table\": \"https://sto5715.table.core.windows.net/\",\r\n \"file\": \"https://sto5715.file.core.windows.net/\"\r\n },\r\n \"primaryLocation\": \"eastus2euap\",\r\n \"statusOfPrimary\": \"available\",\r\n \"secondaryLocation\": \"centraluseuap\",\r\n \"statusOfSecondary\": \"available\"\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "CreateResourceGroup": [ + "res9107" + ], + "StorageAccountCreateWithTableQueueEcryptionKeyTypeTest": [ + "sto5715" + ] + }, + "Variables": { + "SubscriptionId": "45b60d85-fd72-427a-a708-f994d26e593e" + } +} \ No newline at end of file diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/tests/Tests/StorageAccountTests.cs b/sdk/storage/Microsoft.Azure.Management.Storage/tests/Tests/StorageAccountTests.cs index f2c6b1c67945..ae27aca7c366 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/tests/Tests/StorageAccountTests.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/tests/Tests/StorageAccountTests.cs @@ -2148,5 +2148,57 @@ public void StorageAccountPrivateLinkTest() Assert.True(result.Value.Count > 0); } } + + [Fact] + public void StorageAccountCreateWithTableQueueEcryptionKeyTypeTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType())) + { + var resourcesClient = StorageManagementTestUtilities.GetResourceManagementClient(context, handler); + var storageMgmtClient = StorageManagementTestUtilities.GetStorageManagementClient(context, handler); + + // Create resource group + var rgname = StorageManagementTestUtilities.CreateResourceGroup(resourcesClient); + + // Create storage account + string accountName = TestUtilities.GenerateName("sto"); + var parameters = StorageManagementTestUtilities.GetDefaultStorageAccountParameters(); + parameters.Location = "East US 2 EUAP"; + parameters.Kind = Kind.StorageV2; + parameters.Encryption = new Encryption + { + Services = new EncryptionServices { + Queue = new EncryptionService { KeyType = KeyType.Account }, + Table = new EncryptionService { KeyType = KeyType.Account }, + }, + KeySource = KeySource.MicrosoftStorage + }; + var account = storageMgmtClient.StorageAccounts.Create(rgname, accountName, parameters); + + // Verify encryption settings + Assert.NotNull(account.Encryption); + Assert.NotNull(account.Encryption.Services.Blob); + Assert.True(account.Encryption.Services.Blob.Enabled); + Assert.Equal(KeyType.Account, account.Encryption.Services.Blob.KeyType); + Assert.NotNull(account.Encryption.Services.Blob.LastEnabledTime); + + Assert.NotNull(account.Encryption.Services.File); + Assert.True(account.Encryption.Services.File.Enabled); + Assert.Equal(KeyType.Account, account.Encryption.Services.Blob.KeyType); + Assert.NotNull(account.Encryption.Services.File.LastEnabledTime); + + Assert.NotNull(account.Encryption.Services.Queue); + Assert.Equal(KeyType.Account, account.Encryption.Services.Queue.KeyType); + Assert.True(account.Encryption.Services.Queue.Enabled); + Assert.NotNull(account.Encryption.Services.Queue.LastEnabledTime); + + Assert.NotNull(account.Encryption.Services.Table); + Assert.Equal(KeyType.Account, account.Encryption.Services.Table.KeyType); + Assert.True(account.Encryption.Services.Table.Enabled); + Assert.NotNull(account.Encryption.Services.Table.LastEnabledTime); + } + } } }