diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationClient.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationClient.cs new file mode 100644 index 0000000000000..6d553c1cae600 --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationClient.cs @@ -0,0 +1,231 @@ +// +// 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 Azure.Maps.Geolocation +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + + /// + /// Azure Maps Geolocation REST APIs + /// + public partial class GeolocationClient : ServiceClient, IGeolocationClient + { + /// + /// The base URI of the service. + /// + internal string BaseUri {get; set;} + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Version number of Azure Maps API. + /// + public string ApiVersion { get; set; } + + /// + /// Specifies which account is intended for usage in conjunction with the Azure + /// AD security model. It represents a unique ID for the Azure Maps account + /// and can be retrieved from the Azure Maps management plane Account API. To + /// use Azure AD security in Azure Maps see the following + /// [articles](https://aka.ms/amauthdetails) for guidance. + /// + public string XMsClientId { get; set; } + + /// + /// This parameter specifies where the Azure Maps Creator resource is located. + /// Valid values are us and eu. Possible values include: 'us', 'eu' + /// + public string Geography { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets the IGeolocationOperations. + /// + public virtual IGeolocationOperations Geolocation { get; private set; } + + /// + /// Initializes a new instance of the GeolocationClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling GeolocationClient.Dispose(). False: will not dispose provided httpClient + protected GeolocationClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the GeolocationClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected GeolocationClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the GeolocationClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected GeolocationClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the GeolocationClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public GeolocationClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the GeolocationClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling GeolocationClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public GeolocationClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the GeolocationClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public GeolocationClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Geolocation = new GeolocationOperations(this); + BaseUri = "https://{geography}.atlas.microsoft.com"; + ApiVersion = "1.0"; + Geography = "us"; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + } + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationOperations.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationOperations.cs new file mode 100644 index 0000000000000..a3e0d2180031d --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationOperations.cs @@ -0,0 +1,244 @@ +// +// 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 Azure.Maps.Geolocation +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GeolocationOperations operations. + /// + public partial class GeolocationOperations : IServiceOperations, IGeolocationOperations + { + /// + /// Initializes a new instance of the GeolocationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public GeolocationOperations(GeolocationClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the GeolocationClient + /// + public GeolocationClient Client { get; private set; } + + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This service will return the ISO country code for the provided IP address. + /// Developers can use this information to block or alter certain content + /// based on geographical locations where the application is being viewed from. + /// + /// + /// __Note:__ This service returns results from IANA and does not necessarily + /// reflect the views of Microsoft Corporation. + /// + /// + /// The IP address. Both IPv4 and IPv6 are allowed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetIPToLocationPreviewWithHttpMessagesAsync(string ip, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (ip == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ip"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("ip", ip); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetIPToLocationPreview", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "geolocation/ip/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (ip != null) + { + _queryParameters.Add(string.Format("ip={0}", System.Uri.EscapeDataString(ip))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationOperationsExtensions.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationOperationsExtensions.cs new file mode 100644 index 0000000000000..72c2d77822203 --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/GeolocationOperationsExtensions.cs @@ -0,0 +1,53 @@ +// +// 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 Azure.Maps.Geolocation +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GeolocationOperations. + /// + public static partial class GeolocationOperationsExtensions + { + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This service will return the ISO country code for the provided IP address. + /// Developers can use this information to block or alter certain content + /// based on geographical locations where the application is being viewed from. + /// + /// + /// __Note:__ This service returns results from IANA and does not necessarily + /// reflect the views of Microsoft Corporation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The IP address. Both IPv4 and IPv6 are allowed. + /// + /// + /// The cancellation token. + /// + public static async Task GetIPToLocationPreviewAsync(this IGeolocationOperations operations, string ip, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetIPToLocationPreviewWithHttpMessagesAsync(ip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/IGeolocationClient.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/IGeolocationClient.cs new file mode 100644 index 0000000000000..86d909ff91dac --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/IGeolocationClient.cs @@ -0,0 +1,71 @@ +// +// 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 Azure.Maps.Geolocation +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + + /// + /// Azure Maps Geolocation REST APIs + /// + public partial interface IGeolocationClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Version number of Azure Maps API. + /// + string ApiVersion { get; set; } + + /// + /// Specifies which account is intended for usage in conjunction with + /// the Azure AD security model. It represents a unique ID for the + /// Azure Maps account and can be retrieved from the Azure Maps + /// management plane Account API. To use Azure AD security in Azure + /// Maps see the following [articles](https://aka.ms/amauthdetails) for + /// guidance. + /// + string XMsClientId { get; set; } + + /// + /// This parameter specifies where the Azure Maps Creator resource is + /// located. Valid values are us and eu. Possible values include: + /// 'us', 'eu' + /// + string Geography { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// Gets the IGeolocationOperations. + /// + IGeolocationOperations Geolocation { get; } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/IGeolocationOperations.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/IGeolocationOperations.cs new file mode 100644 index 0000000000000..e6e131bd5aa07 --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/IGeolocationOperations.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 Azure.Maps.Geolocation +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GeolocationOperations operations. + /// + public partial interface IGeolocationOperations + { + /// + /// + /// **Applies to**: S0 and S1 pricing tiers. + /// + /// + /// This service will return the ISO country code for the provided IP + /// address. Developers can use this information to block or alter + /// certain content based on geographical locations where the + /// application is being viewed from. + /// + /// + /// __Note:__ This service returns results from IANA and does not + /// necessarily reflect the views of Microsoft Corporation. + /// + /// + /// The IP address. Both IPv4 and IPv6 are allowed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetIPToLocationPreviewWithHttpMessagesAsync(string ip, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/CountryRegion.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/CountryRegion.cs new file mode 100644 index 0000000000000..847572f1b701f --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/CountryRegion.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 Azure.Maps.Geolocation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object containing the country/region information. + /// + public partial class CountryRegion + { + /// + /// Initializes a new instance of the CountryRegion class. + /// + public CountryRegion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CountryRegion class. + /// + /// The IP Address's 2-character code [(ISO + /// 3166-1)](https://www.iso.org/iso-3166-country-codes.html) of the + /// country or region as assigned by IANA and regional internet + /// authorities. Please note, IP address in ranges reserved for special + /// purpose will return Null for country/region. + public CountryRegion(string isoCode = default(string)) + { + IsoCode = isoCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the IP Address's 2-character code [(ISO + /// 3166-1)](https://www.iso.org/iso-3166-country-codes.html) of the + /// country or region as assigned by IANA and regional internet + /// authorities. Please note, IP address in ranges reserved for special + /// purpose will return Null for country/region. + /// + [JsonProperty(PropertyName = "isoCode")] + public string IsoCode { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..47f4ff674800f --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorAdditionalInfo.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 Azure.Maps.Geolocation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorDetail.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 0000000000000..98d4b84a5cdfc --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// 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 Azure.Maps.Geolocation.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorResponse.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..75ac1dd9c4dab --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// 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 Azure.Maps.Geolocation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorResponseException.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..17c95bfb5c337 --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// 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 Azure.Maps.Geolocation.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/GeographicResourceLocation.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/GeographicResourceLocation.cs new file mode 100644 index 0000000000000..ced9f789ad48d --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/GeographicResourceLocation.cs @@ -0,0 +1,28 @@ +// +// 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 Azure.Maps.Geolocation.Models +{ + + /// + /// Defines values for GeographicResourceLocation. + /// + public static class GeographicResourceLocation + { + /// + /// Used to access an Azure Maps Creator resource in the United States + /// + public const string Us = "us"; + /// + /// Used to access an Azure Maps Creator resource in Europe + /// + public const string Eu = "eu"; + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/IpAddressToLocationResult.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/IpAddressToLocationResult.cs new file mode 100644 index 0000000000000..467339cf5e573 --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/Models/IpAddressToLocationResult.cs @@ -0,0 +1,58 @@ +// +// 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 Azure.Maps.Geolocation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This object is returned from a successful call to IP Address to + /// country/region API + /// + public partial class IpAddressToLocationResult + { + /// + /// Initializes a new instance of the IpAddressToLocationResult class. + /// + public IpAddressToLocationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpAddressToLocationResult class. + /// + /// The IP Address of the request. + public IpAddressToLocationResult(CountryRegion countryRegion = default(CountryRegion), string ipAddress = default(string)) + { + CountryRegion = countryRegion; + IpAddress = ipAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "countryRegion")] + public CountryRegion CountryRegion { get; set; } + + /// + /// Gets the IP Address of the request. + /// + [JsonProperty(PropertyName = "ipAddress")] + public string IpAddress { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Geolocation/src/Generated/SdkInfo_GeolocationClient.cs b/sdk/maps/Azure.Maps.Geolocation/src/Generated/SdkInfo_GeolocationClient.cs new file mode 100644 index 0000000000000..245bc078cf267 --- /dev/null +++ b/sdk/maps/Azure.Maps.Geolocation/src/Generated/SdkInfo_GeolocationClient.cs @@ -0,0 +1,27 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Geolocation +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_GeolocationClient + { + get + { + return new Tuple[] + { + new Tuple("GeolocationClient", "Geolocation", "1.0"), + }.AsEnumerable(); + } + } + } +}