| | 1 | | // <auto-generated> |
| | 2 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 3 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 4 | | // regenerated. |
| | 5 | | // </auto-generated> |
| | 6 | |
|
| | 7 | | namespace Microsoft.Azure.CognitiveServices.Search.AutoSuggest.Models |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Newtonsoft.Json; |
| | 11 | | using System.Linq; |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Defines the error that occurred. |
| | 15 | | /// </summary> |
| | 16 | | public partial class Error |
| | 17 | | { |
| | 18 | | /// <summary> |
| | 19 | | /// Initializes a new instance of the Error class. |
| | 20 | | /// </summary> |
| 0 | 21 | | public Error() |
| | 22 | | { |
| | 23 | | CustomInit(); |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Initializes a new instance of the Error class. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name="code">The error code that identifies the category of |
| | 30 | | /// error. Possible values include: 'None', 'ServerError', |
| | 31 | | /// 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', |
| | 32 | | /// 'InsufficientAuthorization'</param> |
| | 33 | | /// <param name="message">A description of the error.</param> |
| | 34 | | /// <param name="moreDetails">A description that provides additional |
| | 35 | | /// information about the error.</param> |
| | 36 | | /// <param name="parameter">The parameter in the request that caused |
| | 37 | | /// the error.</param> |
| | 38 | | /// <param name="value">The parameter's value in the request that was |
| | 39 | | /// not valid.</param> |
| 0 | 40 | | public Error(string code, string message, string moreDetails = default(string), string parameter = default(strin |
| | 41 | | { |
| 0 | 42 | | Code = code; |
| 0 | 43 | | Message = message; |
| 0 | 44 | | MoreDetails = moreDetails; |
| 0 | 45 | | Parameter = parameter; |
| 0 | 46 | | Value = value; |
| | 47 | | CustomInit(); |
| 0 | 48 | | } |
| | 49 | |
|
| | 50 | | /// <summary> |
| | 51 | | /// An initialization method that performs custom operations like setting defaults |
| | 52 | | /// </summary> |
| | 53 | | partial void CustomInit(); |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// Gets or sets the error code that identifies the category of error. |
| | 57 | | /// Possible values include: 'None', 'ServerError', 'InvalidRequest', |
| | 58 | | /// 'RateLimitExceeded', 'InvalidAuthorization', |
| | 59 | | /// 'InsufficientAuthorization' |
| | 60 | | /// </summary> |
| | 61 | | [JsonProperty(PropertyName = "code")] |
| 0 | 62 | | public string Code { get; set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets or sets a description of the error. |
| | 66 | | /// </summary> |
| | 67 | | [JsonProperty(PropertyName = "message")] |
| 0 | 68 | | public string Message { get; set; } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets a description that provides additional information about the |
| | 72 | | /// error. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "moreDetails")] |
| 0 | 75 | | public string MoreDetails { get; private set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Gets the parameter in the request that caused the error. |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "parameter")] |
| 0 | 81 | | public string Parameter { get; private set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Gets the parameter's value in the request that was not valid. |
| | 85 | | /// </summary> |
| | 86 | | [JsonProperty(PropertyName = "value")] |
| 0 | 87 | | public string Value { get; private set; } |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Validate the object. |
| | 91 | | /// </summary> |
| | 92 | | /// <exception cref="ValidationException"> |
| | 93 | | /// Thrown if validation fails |
| | 94 | | /// </exception> |
| | 95 | | public virtual void Validate() |
| | 96 | | { |
| 0 | 97 | | if (Code == null) |
| | 98 | | { |
| 0 | 99 | | throw new ValidationException(ValidationRules.CannotBeNull, "Code"); |
| | 100 | | } |
| 0 | 101 | | if (Message == null) |
| | 102 | | { |
| 0 | 103 | | throw new ValidationException(ValidationRules.CannotBeNull, "Message"); |
| | 104 | | } |
| 0 | 105 | | } |
| | 106 | | } |
| | 107 | | } |