diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs index 98ee3c0d7806..038fe0890b02 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs @@ -32,12 +32,6 @@ public partial interface ILUISRuntimeClient : System.IDisposable /// JsonSerializerSettings DeserializationSettings { get; } - /// - /// Supported Cognitive Services endpoints (protocol and hostname, for - /// example: https://westus.api.cognitive.microsoft.com). - /// - string Endpoint { get; set; } - /// /// Subscription credentials which uniquely identify client /// subscription. diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs index fdf67142ddeb..f046b4882fdc 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs @@ -26,6 +26,17 @@ public partial interface IPrediction /// Gets predictions for a given utterance, in the form of intents and /// entities. The current maximum query size is 500 characters. /// + /// + /// Supported Azure regions for Cognitive Services endpoints. Possible + /// values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', + /// 'westcentralus', 'westus2', 'eastus', 'southcentralus', + /// 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth', + /// 'virginia' + /// + /// + /// Supported Azure Clouds for Cognitive Services endpoints. Possible + /// values include: 'com', 'us' + /// /// /// The LUIS application ID (Guid). /// @@ -45,7 +56,7 @@ public partial interface IPrediction /// Enable spell checking. /// /// - /// The subscription key to use when enabling bing spell check + /// The subscription key to use when enabling Bing spell check /// /// /// Log query (default is true) @@ -65,6 +76,6 @@ public partial interface IPrediction /// /// Thrown when a required parameter is null /// - Task> ResolveWithHttpMessagesAsync(string appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ResolveWithHttpMessagesAsync(AzureRegions azureRegion, AzureClouds azureCloud, System.Guid appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs index ba6c82eacffd..6f44eae9844f 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs @@ -36,12 +36,6 @@ public partial class LUISRuntimeClient : ServiceClient, ILUIS /// public JsonSerializerSettings DeserializationSettings { get; private set; } - /// - /// Supported Cognitive Services endpoints (protocol and hostname, for example: - /// https://westus.api.cognitive.microsoft.com). - /// - public string Endpoint { get; set; } - /// /// Subscription credentials which uniquely identify client subscription. /// @@ -180,7 +174,7 @@ public LUISRuntimeClient(ServiceClientCredentials credentials, HttpClientHandler private void Initialize() { Prediction = new Prediction(this); - BaseUri = "{Endpoint}/luis/v2.0"; + BaseUri = "http://{AzureRegion}.api.cognitive.microsoft.{AzureCloud}/luis/v2.0"; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/AzureClouds.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/AzureClouds.cs new file mode 100644 index 000000000000..7bd1effa056f --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/AzureClouds.cs @@ -0,0 +1,60 @@ +// +// 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.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AzureClouds. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AzureClouds + { + [EnumMember(Value = "com")] + Com, + [EnumMember(Value = "us")] + Us + } + internal static class AzureCloudsEnumExtension + { + internal static string ToSerializedValue(this AzureClouds? value) + { + return value == null ? null : ((AzureClouds)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AzureClouds value) + { + switch( value ) + { + case AzureClouds.Com: + return "com"; + case AzureClouds.Us: + return "us"; + } + return null; + } + + internal static AzureClouds? ParseAzureClouds(this string value) + { + switch( value ) + { + case "com": + return AzureClouds.Com; + case "us": + return AzureClouds.Us; + } + return null; + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/AzureRegions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/AzureRegions.cs new file mode 100644 index 000000000000..28e842b60d80 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/AzureRegions.cs @@ -0,0 +1,126 @@ +// +// 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.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AzureRegions. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AzureRegions + { + [EnumMember(Value = "westus")] + Westus, + [EnumMember(Value = "westeurope")] + Westeurope, + [EnumMember(Value = "southeastasia")] + Southeastasia, + [EnumMember(Value = "eastus2")] + Eastus2, + [EnumMember(Value = "westcentralus")] + Westcentralus, + [EnumMember(Value = "westus2")] + Westus2, + [EnumMember(Value = "eastus")] + Eastus, + [EnumMember(Value = "southcentralus")] + Southcentralus, + [EnumMember(Value = "northeurope")] + Northeurope, + [EnumMember(Value = "eastasia")] + Eastasia, + [EnumMember(Value = "australiaeast")] + Australiaeast, + [EnumMember(Value = "brazilsouth")] + Brazilsouth, + [EnumMember(Value = "virginia")] + Virginia + } + internal static class AzureRegionsEnumExtension + { + internal static string ToSerializedValue(this AzureRegions? value) + { + return value == null ? null : ((AzureRegions)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AzureRegions value) + { + switch( value ) + { + case AzureRegions.Westus: + return "westus"; + case AzureRegions.Westeurope: + return "westeurope"; + case AzureRegions.Southeastasia: + return "southeastasia"; + case AzureRegions.Eastus2: + return "eastus2"; + case AzureRegions.Westcentralus: + return "westcentralus"; + case AzureRegions.Westus2: + return "westus2"; + case AzureRegions.Eastus: + return "eastus"; + case AzureRegions.Southcentralus: + return "southcentralus"; + case AzureRegions.Northeurope: + return "northeurope"; + case AzureRegions.Eastasia: + return "eastasia"; + case AzureRegions.Australiaeast: + return "australiaeast"; + case AzureRegions.Brazilsouth: + return "brazilsouth"; + case AzureRegions.Virginia: + return "virginia"; + } + return null; + } + + internal static AzureRegions? ParseAzureRegions(this string value) + { + switch( value ) + { + case "westus": + return AzureRegions.Westus; + case "westeurope": + return AzureRegions.Westeurope; + case "southeastasia": + return AzureRegions.Southeastasia; + case "eastus2": + return AzureRegions.Eastus2; + case "westcentralus": + return AzureRegions.Westcentralus; + case "westus2": + return AzureRegions.Westus2; + case "eastus": + return AzureRegions.Eastus; + case "southcentralus": + return AzureRegions.Southcentralus; + case "northeurope": + return AzureRegions.Northeurope; + case "eastasia": + return AzureRegions.Eastasia; + case "australiaeast": + return AzureRegions.Australiaeast; + case "brazilsouth": + return AzureRegions.Brazilsouth; + case "virginia": + return AzureRegions.Virginia; + } + return null; + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs index ea64dcdf7d2e..5d006e4aef43 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs @@ -54,6 +54,16 @@ public Prediction(LUISRuntimeClient client) /// Gets predictions for a given utterance, in the form of intents and /// entities. The current maximum query size is 500 characters. /// + /// + /// Supported Azure regions for Cognitive Services endpoints. Possible values + /// include: 'westus', 'westeurope', 'southeastasia', 'eastus2', + /// 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', + /// 'eastasia', 'australiaeast', 'brazilsouth', 'virginia' + /// + /// + /// Supported Azure Clouds for Cognitive Services endpoints. Possible values + /// include: 'com', 'us' + /// /// /// The LUIS application ID (Guid). /// @@ -73,7 +83,7 @@ public Prediction(LUISRuntimeClient client) /// Enable spell checking. /// /// - /// The subscription key to use when enabling bing spell check + /// The subscription key to use when enabling Bing spell check /// /// /// Log query (default is true) @@ -99,16 +109,8 @@ public Prediction(LUISRuntimeClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ResolveWithHttpMessagesAsync(string appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ResolveWithHttpMessagesAsync(AzureRegions azureRegion, AzureClouds azureCloud, System.Guid appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (appId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); - } if (query == null) { throw new ValidationException(ValidationRules.CannotBeNull, "query"); @@ -127,6 +129,8 @@ public Prediction(LUISRuntimeClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("azureRegion", azureRegion); + tracingParameters.Add("azureCloud", azureCloud); tracingParameters.Add("appId", appId); tracingParameters.Add("query", query); tracingParameters.Add("timezoneOffset", timezoneOffset); @@ -141,8 +145,9 @@ public Prediction(LUISRuntimeClient client) // Construct URL var _baseUrl = Client.BaseUri; var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "apps/{appId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + _url = _url.Replace("{AzureRegion}", Rest.Serialization.SafeJsonConvert.SerializeObject(azureRegion, Client.SerializationSettings).Trim('"')); + _url = _url.Replace("{AzureCloud}", Rest.Serialization.SafeJsonConvert.SerializeObject(azureCloud, Client.SerializationSettings).Trim('"')); + _url = _url.Replace("{appId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(appId, Client.SerializationSettings).Trim('"'))); List _queryParameters = new List(); if (timezoneOffset != null) { diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs index c87e31afedd0..283f701fb869 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs @@ -26,6 +26,16 @@ public static partial class PredictionExtensions /// /// The operations group for this extension method. /// + /// + /// Supported Azure regions for Cognitive Services endpoints. Possible values + /// include: 'westus', 'westeurope', 'southeastasia', 'eastus2', + /// 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', + /// 'eastasia', 'australiaeast', 'brazilsouth', 'virginia' + /// + /// + /// Supported Azure Clouds for Cognitive Services endpoints. Possible values + /// include: 'com', 'us' + /// /// /// The LUIS application ID (Guid). /// @@ -45,7 +55,7 @@ public static partial class PredictionExtensions /// Enable spell checking. /// /// - /// The subscription key to use when enabling bing spell check + /// The subscription key to use when enabling Bing spell check /// /// /// Log query (default is true) @@ -53,9 +63,9 @@ public static partial class PredictionExtensions /// /// The cancellation token. /// - public static async Task ResolveAsync(this IPrediction operations, string appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ResolveAsync(this IPrediction operations, AzureRegions azureRegion, AzureClouds azureCloud, System.Guid appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ResolveWithHttpMessagesAsync(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ResolveWithHttpMessagesAsync(azureRegion, azureCloud, appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs index 968c56dccd28..53b934b8c443 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs @@ -23,16 +23,5 @@ public static IEnumerable> ApiInfo_LUISRuntimeClie }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\Work\\azure-sdk-for-net-fork\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "9da47072c2a912065239412c13125e3242d7a8f7"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -