| | 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.ImageSearch.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="subCode">The error code that further helps to identify |
| | 35 | | /// the error. Possible values include: 'UnexpectedError', |
| | 36 | | /// 'ResourceError', 'NotImplemented', 'ParameterMissing', |
| | 37 | | /// 'ParameterInvalidValue', 'HttpNotAllowed', 'Blocked', |
| | 38 | | /// 'AuthorizationMissing', 'AuthorizationRedundancy', |
| | 39 | | /// 'AuthorizationDisabled', 'AuthorizationExpired'</param> |
| | 40 | | /// <param name="moreDetails">A description that provides additional |
| | 41 | | /// information about the error.</param> |
| | 42 | | /// <param name="parameter">The parameter in the request that caused |
| | 43 | | /// the error.</param> |
| | 44 | | /// <param name="value">The parameter's value in the request that was |
| | 45 | | /// not valid.</param> |
| 0 | 46 | | public Error(string code, string message, string subCode = default(string), string moreDetails = default(string) |
| | 47 | | { |
| 0 | 48 | | Code = code; |
| 0 | 49 | | SubCode = subCode; |
| 0 | 50 | | Message = message; |
| 0 | 51 | | MoreDetails = moreDetails; |
| 0 | 52 | | Parameter = parameter; |
| 0 | 53 | | Value = value; |
| | 54 | | CustomInit(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// An initialization method that performs custom operations like setting defaults |
| | 59 | | /// </summary> |
| | 60 | | partial void CustomInit(); |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// Gets or sets the error code that identifies the category of error. |
| | 64 | | /// Possible values include: 'None', 'ServerError', 'InvalidRequest', |
| | 65 | | /// 'RateLimitExceeded', 'InvalidAuthorization', |
| | 66 | | /// 'InsufficientAuthorization' |
| | 67 | | /// </summary> |
| | 68 | | [JsonProperty(PropertyName = "code")] |
| 0 | 69 | | public string Code { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets the error code that further helps to identify the error. |
| | 73 | | /// Possible values include: 'UnexpectedError', 'ResourceError', |
| | 74 | | /// 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', |
| | 75 | | /// 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', |
| | 76 | | /// 'AuthorizationRedundancy', 'AuthorizationDisabled', |
| | 77 | | /// 'AuthorizationExpired' |
| | 78 | | /// </summary> |
| | 79 | | [JsonProperty(PropertyName = "subCode")] |
| 0 | 80 | | public string SubCode { get; private set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Gets or sets a description of the error. |
| | 84 | | /// </summary> |
| | 85 | | [JsonProperty(PropertyName = "message")] |
| 0 | 86 | | public string Message { get; set; } |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Gets a description that provides additional information about the |
| | 90 | | /// error. |
| | 91 | | /// </summary> |
| | 92 | | [JsonProperty(PropertyName = "moreDetails")] |
| 0 | 93 | | public string MoreDetails { get; private set; } |
| | 94 | |
|
| | 95 | | /// <summary> |
| | 96 | | /// Gets the parameter in the request that caused the error. |
| | 97 | | /// </summary> |
| | 98 | | [JsonProperty(PropertyName = "parameter")] |
| 0 | 99 | | public string Parameter { get; private set; } |
| | 100 | |
|
| | 101 | | /// <summary> |
| | 102 | | /// Gets the parameter's value in the request that was not valid. |
| | 103 | | /// </summary> |
| | 104 | | [JsonProperty(PropertyName = "value")] |
| 0 | 105 | | public string Value { get; private set; } |
| | 106 | |
|
| | 107 | | /// <summary> |
| | 108 | | /// Validate the object. |
| | 109 | | /// </summary> |
| | 110 | | /// <exception cref="ValidationException"> |
| | 111 | | /// Thrown if validation fails |
| | 112 | | /// </exception> |
| | 113 | | public virtual void Validate() |
| | 114 | | { |
| 0 | 115 | | if (Code == null) |
| | 116 | | { |
| 0 | 117 | | throw new ValidationException(ValidationRules.CannotBeNull, "Code"); |
| | 118 | | } |
| 0 | 119 | | if (Message == null) |
| | 120 | | { |
| 0 | 121 | | throw new ValidationException(ValidationRules.CannotBeNull, "Message"); |
| | 122 | | } |
| 0 | 123 | | } |
| | 124 | | } |
| | 125 | | } |