| | 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.Linq; |
| | 16 | |
|
| | 17 | | /// <summary> |
| | 18 | | /// Learning settings specifying how to train the model. |
| | 19 | | /// </summary> |
| | 20 | | public partial class PolicyContract |
| | 21 | | { |
| | 22 | | /// <summary> |
| | 23 | | /// Initializes a new instance of the PolicyContract class. |
| | 24 | | /// </summary> |
| 10 | 25 | | public PolicyContract() |
| | 26 | | { |
| | 27 | | CustomInit(); |
| 10 | 28 | | } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Initializes a new instance of the PolicyContract class. |
| | 32 | | /// </summary> |
| | 33 | | /// <param name="name">Name of the Learning settings.</param> |
| | 34 | | /// <param name="arguments">Arguments of the Learning settings.</param> |
| 0 | 35 | | public PolicyContract(string name, string arguments) |
| | 36 | | { |
| 0 | 37 | | Name = name; |
| 0 | 38 | | Arguments = arguments; |
| | 39 | | CustomInit(); |
| 0 | 40 | | } |
| | 41 | |
|
| | 42 | | /// <summary> |
| | 43 | | /// An initialization method that performs custom operations like setting defaults |
| | 44 | | /// </summary> |
| | 45 | | partial void CustomInit(); |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// Gets or sets name of the Learning settings. |
| | 49 | | /// </summary> |
| | 50 | | [JsonProperty(PropertyName = "name")] |
| 28 | 51 | | public string Name { get; set; } |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// Gets or sets arguments of the Learning settings. |
| | 55 | | /// </summary> |
| | 56 | | [JsonProperty(PropertyName = "arguments")] |
| 34 | 57 | | public string Arguments { get; set; } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Validate the object. |
| | 61 | | /// </summary> |
| | 62 | | /// <exception cref="ValidationException"> |
| | 63 | | /// Thrown if validation fails |
| | 64 | | /// </exception> |
| | 65 | | public virtual void Validate() |
| | 66 | | { |
| 4 | 67 | | if (Name == null) |
| | 68 | | { |
| 0 | 69 | | throw new ValidationException(ValidationRules.CannotBeNull, "Name"); |
| | 70 | | } |
| 4 | 71 | | if (Arguments == null) |
| | 72 | | { |
| 0 | 73 | | throw new ValidationException(ValidationRules.CannotBeNull, "Arguments"); |
| | 74 | | } |
| 4 | 75 | | if (Name != null) |
| | 76 | | { |
| 4 | 77 | | if (Name.Length > 256) |
| | 78 | | { |
| 0 | 79 | | throw new ValidationException(ValidationRules.MaxLength, "Name", 256); |
| | 80 | | } |
| | 81 | | } |
| 4 | 82 | | if (Arguments != null) |
| | 83 | | { |
| 4 | 84 | | if (Arguments.Length > 1024) |
| | 85 | | { |
| 0 | 86 | | throw new ValidationException(ValidationRules.MaxLength, "Arguments", 1024); |
| | 87 | | } |
| | 88 | | } |
| 4 | 89 | | } |
| | 90 | | } |
| | 91 | | } |