From 8affe750bdbd40c0adbf350976d26d58369db2e6 Mon Sep 17 00:00:00 2001 From: Yang Yuan Date: Mon, 1 Jun 2020 19:12:18 -0700 Subject: [PATCH] Support Sku capabilities. Bump to 7.3.0 (#12328) * Support Sku capabilities. Bump to 7.3.0 * Generate from AutoRest --- .../cognitiveservices_resource-manager.txt | 4 +- .../CognitiveServicesAccountProperties.cs | 14 +- .../src/Generated/Models/SkuCapability.cs | 59 +++++++ ...kInfo_CognitiveServicesManagementClient.cs | 2 +- ....Azure.Management.CognitiveServices.csproj | 4 +- .../src/Properties/AssemblyInfo.cs | 4 +- ...ognitiveServicesAccountCapabilityTest.json | 159 ++++++++++++++++++ ...ognitiveServicesAccountCapabilityTest.json | 159 ++++++++++++++++++ .../Tests/CognitiveServicesAccountTests.cs | 35 ++++ 9 files changed, 432 insertions(+), 8 deletions(-) create mode 100644 sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuCapability.cs create mode 100644 sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServices.Tests.CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json create mode 100644 sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json diff --git a/eng/mgmt/mgmtmetadata/cognitiveservices_resource-manager.txt b/eng/mgmt/mgmtmetadata/cognitiveservices_resource-manager.txt index b5ffd384dabc..7edf29d1660c 100644 --- a/eng/mgmt/mgmtmetadata/cognitiveservices_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/cognitiveservices_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/cognitiveservices/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\Repos\azure-sdk-for-net\sdk -2020-05-11 21:35:19 UTC +2020-05-27 19:37:47 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 3e8fb815e2e4f149fbfcdaab64efc4d45dcc0690 +Commit: aad8a360e27b1811a4ecbe64ee898d25b44693a6 AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs index 518ce952293a..e46d5ebeb421 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs @@ -39,6 +39,9 @@ public CognitiveServicesAccountProperties() /// 'Succeeded', 'Failed' /// Endpoint of the created account. /// The internal identifier. + /// Gets the capabilities of the cognitive + /// services account. Each item indicates the capability of a specific + /// feature. The values are read-only and for reference only. /// Optional subdomain name used for /// token-based authentication. /// A collection of rules governing the @@ -55,11 +58,12 @@ public CognitiveServicesAccountProperties() /// 'Enabled', 'Disabled' /// The api properties for special /// APIs. - public CognitiveServicesAccountProperties(string provisioningState = default(string), string endpoint = default(string), string internalId = default(string), string customSubDomainName = default(string), NetworkRuleSet networkAcls = default(NetworkRuleSet), Encryption encryption = default(Encryption), IList userOwnedStorage = default(IList), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), CognitiveServicesAccountApiProperties apiProperties = default(CognitiveServicesAccountApiProperties)) + public CognitiveServicesAccountProperties(string provisioningState = default(string), string endpoint = default(string), string internalId = default(string), IList capabilities = default(IList), string customSubDomainName = default(string), NetworkRuleSet networkAcls = default(NetworkRuleSet), Encryption encryption = default(Encryption), IList userOwnedStorage = default(IList), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), CognitiveServicesAccountApiProperties apiProperties = default(CognitiveServicesAccountApiProperties)) { ProvisioningState = provisioningState; Endpoint = endpoint; InternalId = internalId; + Capabilities = capabilities; CustomSubDomainName = customSubDomainName; NetworkAcls = networkAcls; Encryption = encryption; @@ -95,6 +99,14 @@ public CognitiveServicesAccountProperties() [JsonProperty(PropertyName = "internalId")] public string InternalId { get; private set; } + /// + /// Gets the capabilities of the cognitive services account. Each item + /// indicates the capability of a specific feature. The values are + /// read-only and for reference only. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + /// /// Gets or sets optional subdomain name used for token-based /// authentication. diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuCapability.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuCapability.cs new file mode 100644 index 000000000000..216c6ce8fadb --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuCapability.cs @@ -0,0 +1,59 @@ +// +// 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.CognitiveServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// SkuCapability indicates the capability of a certain feature. + /// + public partial class SkuCapability + { + /// + /// Initializes a new instance of the SkuCapability class. + /// + public SkuCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuCapability class. + /// + /// The name of the SkuCapability. + /// The value of the SkuCapability. + public SkuCapability(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the SkuCapability. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the SkuCapability. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs index 4a3159bab56c..325a6ab80be6 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs @@ -35,7 +35,7 @@ public static IEnumerable> ApiInfo_CognitiveServic public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Repos\\azure-sdk-for-net\\sdk"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "3e8fb815e2e4f149fbfcdaab64efc4d45dcc0690"; + public static readonly String GithubCommidId = "aad8a360e27b1811a4ecbe64ee898d25b44693a6"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Microsoft.Azure.Management.CognitiveServices.csproj b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Microsoft.Azure.Management.CognitiveServices.csproj index 734dfe8ed735..8e30289da7bc 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Microsoft.Azure.Management.CognitiveServices.csproj +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Microsoft.Azure.Management.CognitiveServices.csproj @@ -6,12 +6,12 @@ Microsoft.Azure.Management.CognitiveServices Microsoft Azure Management Cognitive Services Library - 7.2.0-preview + 7.3.0-preview Microsoft.Azure.Management.CognitiveServices Cognitive Services management;Cognitive Services; diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Properties/AssemblyInfo.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Properties/AssemblyInfo.cs index afc3e2e9db6a..620de909cb35 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Properties/AssemblyInfo.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ [assembly: AssemblyTitle("Microsoft Azure Cognitive Services Management Library")] [assembly: AssemblyDescription("Provides Microsoft Azure Cognitive Services management functions for managing Microsoft Azure Cognitive Services accounts.")] -[assembly: AssemblyVersion("7.2.0.0")] -[assembly: AssemblyFileVersion("7.2.0.0")] +[assembly: AssemblyVersion("7.3.0.0")] +[assembly: AssemblyFileVersion("7.3.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServices.Tests.CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServices.Tests.CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json new file mode 100644 index 000000000000..51e1aa850112 --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServices.Tests.CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json @@ -0,0 +1,159 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourcegroups/res5861?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjliOTZiMzYtMWY1ZS00MDIxLTg5NTktNTE1MjdlMjZlNmQzL3Jlc291cmNlZ3JvdXBzL3JlczU4NjE/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "33765bcc-218f-447f-ba7b-3574b17457fe" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "2677a76c-5b4b-4271-9413-549cd61b49a2" + ], + "x-ms-correlation-request-id": [ + "2677a76c-5b4b-4271-9413-549cd61b49a2" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200517T234504Z:2677a76c-5b4b-4271-9413-549cd61b49a2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sun, 17 May 2020 23:45:04 GMT" + ], + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/res5861\",\r\n \"name\": \"res5861\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/res5861/providers/Microsoft.CognitiveServices/accounts/csa2023?api-version=2017-04-18", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjliOTZiMzYtMWY1ZS00MDIxLTg5NTktNTE1MjdlMjZlNmQzL3Jlc291cmNlR3JvdXBzL3JlczU4NjEvcHJvdmlkZXJzL01pY3Jvc29mdC5Db2duaXRpdmVTZXJ2aWNlcy9hY2NvdW50cy9jc2EyMDIzP2FwaS12ZXJzaW9uPTIwMTctMDQtMTg=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"kind\": \"FormRecognizer\",\r\n \"location\": \"CENTRALUSEUAP\",\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"F0\"\r\n },\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b1093ae7-155c-439d-a645-dccc707fce75" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.CognitiveServices.CognitiveServicesManagementClient/7.3.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "185" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0400b7c8-0000-3300-0000-5ec1cc820000\"" + ], + "x-ms-request-id": [ + "e3e1061f-97bf-4640-8d5b-a94314d54ad3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "5735b7b1-ac87-4001-b5f2-cd523b770f8f" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200517T234506Z:5735b7b1-ac87-4001-b5f2-cd523b770f8f" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sun, 17 May 2020 23:45:06 GMT" + ], + "Content-Length": [ + "678" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/res5861/providers/Microsoft.CognitiveServices/accounts/csa2023\",\r\n \"name\": \"csa2023\",\r\n \"type\": \"Microsoft.CognitiveServices/accounts\",\r\n \"etag\": \"\\\"0400b7c8-0000-3300-0000-5ec1cc820000\\\"\",\r\n \"location\": \"CENTRALUSEUAP\",\r\n \"sku\": {\r\n \"name\": \"F0\"\r\n },\r\n \"kind\": \"FormRecognizer\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"properties\": {\r\n \"endpoint\": \"https://centraluseuap.api.cognitive.microsoft.com/\",\r\n \"internalId\": \"aea0dff547d04a6689db9701a2cabbc4\",\r\n \"dateCreated\": \"2020-05-17T23:45:06.1871048Z\",\r\n \"privateEndpointConnections\": [],\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"capabilities\": [\r\n {\r\n \"name\": \"CustomerManagedKey\"\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + } + ], + "Names": { + "CreateResourceGroup": [ + "res5861" + ], + "CognitiveServicesAccountCapabilityTest": [ + "csa2023" + ] + }, + "Variables": { + "SubscriptionId": "f9b96b36-1f5e-4021-8959-51527e26e6d3" + } +} \ No newline at end of file diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json new file mode 100644 index 000000000000..51e1aa850112 --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/SessionRecords/CognitiveServicesAccountTests/CognitiveServicesAccountCapabilityTest.json @@ -0,0 +1,159 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourcegroups/res5861?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjliOTZiMzYtMWY1ZS00MDIxLTg5NTktNTE1MjdlMjZlNmQzL3Jlc291cmNlZ3JvdXBzL3JlczU4NjE/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "33765bcc-218f-447f-ba7b-3574b17457fe" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "2677a76c-5b4b-4271-9413-549cd61b49a2" + ], + "x-ms-correlation-request-id": [ + "2677a76c-5b4b-4271-9413-549cd61b49a2" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200517T234504Z:2677a76c-5b4b-4271-9413-549cd61b49a2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sun, 17 May 2020 23:45:04 GMT" + ], + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/res5861\",\r\n \"name\": \"res5861\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/res5861/providers/Microsoft.CognitiveServices/accounts/csa2023?api-version=2017-04-18", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjliOTZiMzYtMWY1ZS00MDIxLTg5NTktNTE1MjdlMjZlNmQzL3Jlc291cmNlR3JvdXBzL3JlczU4NjEvcHJvdmlkZXJzL01pY3Jvc29mdC5Db2duaXRpdmVTZXJ2aWNlcy9hY2NvdW50cy9jc2EyMDIzP2FwaS12ZXJzaW9uPTIwMTctMDQtMTg=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"kind\": \"FormRecognizer\",\r\n \"location\": \"CENTRALUSEUAP\",\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"F0\"\r\n },\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b1093ae7-155c-439d-a645-dccc707fce75" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.CognitiveServices.CognitiveServicesManagementClient/7.3.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "185" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0400b7c8-0000-3300-0000-5ec1cc820000\"" + ], + "x-ms-request-id": [ + "e3e1061f-97bf-4640-8d5b-a94314d54ad3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "5735b7b1-ac87-4001-b5f2-cd523b770f8f" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200517T234506Z:5735b7b1-ac87-4001-b5f2-cd523b770f8f" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sun, 17 May 2020 23:45:06 GMT" + ], + "Content-Length": [ + "678" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/res5861/providers/Microsoft.CognitiveServices/accounts/csa2023\",\r\n \"name\": \"csa2023\",\r\n \"type\": \"Microsoft.CognitiveServices/accounts\",\r\n \"etag\": \"\\\"0400b7c8-0000-3300-0000-5ec1cc820000\\\"\",\r\n \"location\": \"CENTRALUSEUAP\",\r\n \"sku\": {\r\n \"name\": \"F0\"\r\n },\r\n \"kind\": \"FormRecognizer\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"properties\": {\r\n \"endpoint\": \"https://centraluseuap.api.cognitive.microsoft.com/\",\r\n \"internalId\": \"aea0dff547d04a6689db9701a2cabbc4\",\r\n \"dateCreated\": \"2020-05-17T23:45:06.1871048Z\",\r\n \"privateEndpointConnections\": [],\r\n \"publicNetworkAccess\": \"Enabled\",\r\n \"capabilities\": [\r\n {\r\n \"name\": \"CustomerManagedKey\"\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + } + ], + "Names": { + "CreateResourceGroup": [ + "res5861" + ], + "CognitiveServicesAccountCapabilityTest": [ + "csa2023" + ] + }, + "Variables": { + "SubscriptionId": "f9b96b36-1f5e-4021-8959-51527e26e6d3" + } +} \ No newline at end of file diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/Tests/CognitiveServicesAccountTests.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/Tests/CognitiveServicesAccountTests.cs index a399cc19a6cf..45bf0eb3d5dc 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/Tests/CognitiveServicesAccountTests.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/tests/Tests/CognitiveServicesAccountTests.cs @@ -967,5 +967,40 @@ public void CognitiveServicesAccountPrivateEndpointConnectionTest() } } } + + [Fact] + public void CognitiveServicesAccountCapabilityTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType())) + { + var resourcesClient = CognitiveServicesManagementTestUtilities.GetResourceManagementClient(context, handler); + var cognitiveServicesMgmtClient = CognitiveServicesManagementTestUtilities.GetCognitiveServicesManagementClient(context, handler); + + // Create resource group + var rgname = CognitiveServicesManagementTestUtilities.CreateResourceGroup(resourcesClient); + + { // create with Encryption + // prepare account properties + string accountName = TestUtilities.GenerateName("csa"); + CognitiveServicesAccount parameters = new CognitiveServicesAccount + { + Location = "CENTRALUSEUAP", + Tags = CognitiveServicesManagementTestUtilities.DefaultTags, + Sku = new Sku { Name = "F0" }, + Kind = "FormRecognizer", + Properties = new CognitiveServicesAccountProperties(), + }; + // Create cognitive services account + var account = cognitiveServicesMgmtClient.Accounts.Create(rgname, accountName, parameters); + + // verify + Assert.NotNull(account?.Properties?.Capabilities); + Assert.True(account?.Properties?.Capabilities.Count > 0); + Assert.True(account?.Properties?.Capabilities[0].Name.Length > 0); + } + } + } } } \ No newline at end of file