Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Storage] support Queue/Table Encyrtpion Keytype
  • Loading branch information
blueww committed Jan 9, 2020
commit 9e56191574876d6287060d7f5ee813ed452cf3a6
4 changes: 2 additions & 2 deletions eng/mgmt/mgmtmetadata/storage_resource-manager.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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.</param>
public EncryptionService(bool? enabled = default(bool?), System.DateTime? lastEnabledTime = default(System.DateTime?))
/// <param name="keyType">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'</param>
public EncryptionService(bool? enabled = default(bool?), System.DateTime? lastEnabledTime = default(System.DateTime?), string keyType = default(string))
{
Enabled = enabled;
LastEnabledTime = lastEnabledTime;
KeyType = keyType;
CustomInit();
}

Expand All @@ -64,5 +70,15 @@ public EncryptionService()
[JsonProperty(PropertyName = "lastEnabledTime")]
public System.DateTime? LastEnabledTime { get; private set; }

/// <summary>
/// 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'
/// </summary>
[JsonProperty(PropertyName = "keyType")]
public string KeyType { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ public EncryptionServices()
public EncryptionService File { get; set; }

/// <summary>
/// Gets the encryption function of the table storage service.
/// Gets or sets the encryption function of the table storage service.
/// </summary>
[JsonProperty(PropertyName = "table")]
public EncryptionService Table { get; private set; }
public EncryptionService Table { get; set; }

/// <summary>
/// Gets the encryption function of the queue storage service.
/// Gets or sets the encryption function of the queue storage service.
/// </summary>
[JsonProperty(PropertyName = "queue")]
public EncryptionService Queue { get; private set; }
public EncryptionService Queue { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Storage.Models
{

/// <summary>
/// Defines values for KeyType.
/// </summary>
public static class KeyType
{
public const string Service = "Service";
public const string Account = "Account";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static IEnumerable<Tuple<string, string, string>> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageId>Microsoft.Azure.Management.Storage</PackageId>
<Description>Microsoft Azure Management Storage Library</Description>
<AssemblyName>Microsoft.Azure.Management.Storage</AssemblyName>
<Version>14.2.0</Version>
<Version>14.3.0</Version>
<PackageTags>Microsoft Azure Storage management;Storage;Storage management;</PackageTags>
<PackageReleaseNotes>See https://aka.ms/asdotnetsdkchangelog for release notes.</PackageReleaseNotes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}