Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cognitive Services Ver.2.0.0 #3597

Merged
merged 2 commits into from
Aug 28, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,8 @@ public void CognitiveServicesCheckSkuAvailabilityTest()
var resourcesClient = CognitiveServicesManagementTestUtilities.GetResourceManagementClient(context, handler);
var cognitiveServicesMgmtClient = CognitiveServicesManagementTestUtilities.GetCognitiveServicesManagementClient(context, handler);

cognitiveServicesMgmtClient.Location = "westus";

var skus = cognitiveServicesMgmtClient.CheckSkuAvailability.List(
location: "westus",
skus: new List<string>() { SkuName.S0 },
kind: Kind.Face,
type: $"{c_resourceNamespace}/{c_resourceType}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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
{
using Azure;
using Management;
using Rest;
using Rest.Azure;
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
using System.Collections;
Expand Down Expand Up @@ -118,9 +118,9 @@ internal AccountsOperations(CognitiveServicesManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
Expand Down Expand Up @@ -291,9 +291,9 @@ internal AccountsOperations(CognitiveServicesManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
Expand Down Expand Up @@ -460,9 +460,9 @@ internal AccountsOperations(CognitiveServicesManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
Expand Down Expand Up @@ -628,9 +628,9 @@ internal AccountsOperations(CognitiveServicesManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
Expand Down Expand Up @@ -745,4 +745,3 @@ internal AccountsOperations(CognitiveServicesManagementClient client)

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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
{
using Azure;
using Management;
using Rest;
using Rest.Azure;
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -157,4 +157,3 @@ public static IPage<CognitiveServicesAccount> ListNext(this IAccountsOperations

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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
{
using Azure;
using Management;
using Rest;
using Rest.Azure;
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
using System.Collections;
Expand Down Expand Up @@ -53,6 +53,9 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client
/// <summary>
/// Check available SKUs.
/// </summary>
/// <param name='location'>
/// Resource location.
/// </param>
/// <param name='skus'>
/// The SKU of the resource.
/// </param>
Expand Down Expand Up @@ -87,7 +90,7 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<CheckSkuAvailabilityResultList>> ListWithHttpMessagesAsync(IList<string> skus, string kind, string type, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<CheckSkuAvailabilityResultList>> ListWithHttpMessagesAsync(string location, IList<string> skus, string kind, string type, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
Expand All @@ -97,9 +100,9 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
if (Client.Location == null)
if (location == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Location");
throw new ValidationException(ValidationRules.CannotBeNull, "location");
}
if (skus == null)
{
Expand Down Expand Up @@ -127,6 +130,7 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("location", location);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
Expand All @@ -135,7 +139,7 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{location}", System.Uri.EscapeDataString(Client.Location));
_url = _url.Replace("{location}", System.Uri.EscapeDataString(location));
List<string> _queryParameters = new List<string>();
if (Client.ApiVersion != null)
{
Expand All @@ -146,9 +150,9 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
Expand Down Expand Up @@ -182,7 +186,7 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
_httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
Expand Down Expand Up @@ -274,4 +278,3 @@ internal CheckSkuAvailabilityOperations(CognitiveServicesManagementClient client

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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
{
using Azure;
using Management;
using Rest;
using Rest.Azure;
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using System.Collections;
using System.Collections.Generic;
Expand All @@ -29,6 +29,9 @@ public static partial class CheckSkuAvailabilityOperationsExtensions
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='location'>
/// Resource location.
/// </param>
/// <param name='skus'>
/// The SKU of the resource.
/// </param>
Expand All @@ -42,9 +45,9 @@ public static partial class CheckSkuAvailabilityOperationsExtensions
/// <param name='type'>
/// The Type of the resource.
/// </param>
public static CheckSkuAvailabilityResultList List(this ICheckSkuAvailabilityOperations operations, IList<string> skus, string kind, string type)
public static CheckSkuAvailabilityResultList List(this ICheckSkuAvailabilityOperations operations, string location, IList<string> skus, string kind, string type)
{
return operations.ListAsync(skus, kind, type).GetAwaiter().GetResult();
return operations.ListAsync(location, skus, kind, type).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -53,6 +56,9 @@ public static CheckSkuAvailabilityResultList List(this ICheckSkuAvailabilityOper
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='location'>
/// Resource location.
/// </param>
/// <param name='skus'>
/// The SKU of the resource.
/// </param>
Expand All @@ -69,14 +75,13 @@ public static CheckSkuAvailabilityResultList List(this ICheckSkuAvailabilityOper
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<CheckSkuAvailabilityResultList> ListAsync(this ICheckSkuAvailabilityOperations operations, IList<string> skus, string kind, string type, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<CheckSkuAvailabilityResultList> ListAsync(this ICheckSkuAvailabilityOperations operations, string location, IList<string> skus, string kind, string type, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListWithHttpMessagesAsync(skus, kind, type, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.ListWithHttpMessagesAsync(location, skus, kind, type, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

}
}

Loading