| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.Personalizer.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// The error object. |
| | 21 | | /// </summary> |
| | 22 | | public partial class PersonalizerError |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the PersonalizerError class. |
| | 26 | | /// </summary> |
| 0 | 27 | | public PersonalizerError() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 0 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the PersonalizerError class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="code">High level error code. Possible values include: |
| | 36 | | /// 'BadRequest', 'ResourceNotFound', 'InternalServerError', |
| | 37 | | /// 'InvalidServiceConfiguration', 'InvalidPolicyConfiguration', |
| | 38 | | /// 'InvalidPolicyContract', 'InvalidEvaluationContract', |
| | 39 | | /// 'InvalidRewardRequest', 'InvalidEventIdToActivate', |
| | 40 | | /// 'InvalidRankRequest', 'InvalidExportLogsRequest', |
| | 41 | | /// 'InvalidContainer', 'FrontEndNotFound', 'EvaluationNotFound', |
| | 42 | | /// 'LogsPropertiesNotFound', 'RankNullResponse', |
| | 43 | | /// 'UpdateConfigurationFailed', 'ModelResetFailed'</param> |
| | 44 | | /// <param name="message">A message explaining the error reported by |
| | 45 | | /// the service.</param> |
| | 46 | | /// <param name="target">Error source element.</param> |
| | 47 | | /// <param name="details">An array of details about specific errors |
| | 48 | | /// that led to this reported error.</param> |
| | 49 | | /// <param name="innerError">Finer error details.</param> |
| 0 | 50 | | public PersonalizerError(string code, string message, string target = default(string), IList<PersonalizerError> |
| | 51 | | { |
| 0 | 52 | | Code = code; |
| 0 | 53 | | Message = message; |
| 0 | 54 | | Target = target; |
| 0 | 55 | | Details = details; |
| 0 | 56 | | InnerError = innerError; |
| | 57 | | CustomInit(); |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// An initialization method that performs custom operations like setting defaults |
| | 62 | | /// </summary> |
| | 63 | | partial void CustomInit(); |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Gets or sets high level error code. Possible values include: |
| | 67 | | /// 'BadRequest', 'ResourceNotFound', 'InternalServerError', |
| | 68 | | /// 'InvalidServiceConfiguration', 'InvalidPolicyConfiguration', |
| | 69 | | /// 'InvalidPolicyContract', 'InvalidEvaluationContract', |
| | 70 | | /// 'InvalidRewardRequest', 'InvalidEventIdToActivate', |
| | 71 | | /// 'InvalidRankRequest', 'InvalidExportLogsRequest', |
| | 72 | | /// 'InvalidContainer', 'FrontEndNotFound', 'EvaluationNotFound', |
| | 73 | | /// 'LogsPropertiesNotFound', 'RankNullResponse', |
| | 74 | | /// 'UpdateConfigurationFailed', 'ModelResetFailed' |
| | 75 | | /// </summary> |
| | 76 | | [JsonProperty(PropertyName = "code")] |
| 0 | 77 | | public string Code { get; set; } |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Gets or sets a message explaining the error reported by the |
| | 81 | | /// service. |
| | 82 | | /// </summary> |
| | 83 | | [JsonProperty(PropertyName = "message")] |
| 0 | 84 | | public string Message { get; set; } |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// Gets or sets error source element. |
| | 88 | | /// </summary> |
| | 89 | | [JsonProperty(PropertyName = "target")] |
| 0 | 90 | | public string Target { get; set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// Gets or sets an array of details about specific errors that led to |
| | 94 | | /// this reported error. |
| | 95 | | /// </summary> |
| | 96 | | [JsonProperty(PropertyName = "details")] |
| 0 | 97 | | public IList<PersonalizerError> Details { get; set; } |
| | 98 | |
|
| | 99 | | /// <summary> |
| | 100 | | /// Gets or sets finer error details. |
| | 101 | | /// </summary> |
| | 102 | | [JsonProperty(PropertyName = "innerError")] |
| 0 | 103 | | public InternalError InnerError { get; set; } |
| | 104 | |
|
| | 105 | | /// <summary> |
| | 106 | | /// Validate the object. |
| | 107 | | /// </summary> |
| | 108 | | /// <exception cref="ValidationException"> |
| | 109 | | /// Thrown if validation fails |
| | 110 | | /// </exception> |
| | 111 | | public virtual void Validate() |
| | 112 | | { |
| 0 | 113 | | if (Code == null) |
| | 114 | | { |
| 0 | 115 | | throw new ValidationException(ValidationRules.CannotBeNull, "Code"); |
| | 116 | | } |
| 0 | 117 | | if (Message == null) |
| | 118 | | { |
| 0 | 119 | | throw new ValidationException(ValidationRules.CannotBeNull, "Message"); |
| | 120 | | } |
| 0 | 121 | | if (Details != null) |
| | 122 | | { |
| 0 | 123 | | foreach (var element in Details) |
| | 124 | | { |
| 0 | 125 | | if (element != null) |
| | 126 | | { |
| 0 | 127 | | element.Validate(); |
| | 128 | | } |
| | 129 | | } |
| | 130 | | } |
| 0 | 131 | | } |
| | 132 | | } |
| | 133 | | } |