| | 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.Search.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Linq; |
| | 16 | |
|
| | 17 | | /// <summary> |
| | 18 | | /// Represents a synonym map definition. |
| | 19 | | /// </summary> |
| | 20 | | public partial class SynonymMap |
| | 21 | | { |
| | 22 | | /// <summary> |
| | 23 | | /// Initializes a new instance of the SynonymMap class. |
| | 24 | | /// </summary> |
| 56 | 25 | | public SynonymMap() |
| | 26 | | { |
| | 27 | | CustomInit(); |
| 56 | 28 | | } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Initializes a new instance of the SynonymMap class. |
| | 32 | | /// </summary> |
| | 33 | | /// <param name="name">The name of the synonym map.</param> |
| | 34 | | /// <param name="synonyms">A series of synonym rules in the specified |
| | 35 | | /// synonym map format. The rules must be separated by |
| | 36 | | /// newlines.</param> |
| | 37 | | /// <param name="eTag">The ETag of the synonym map.</param> |
| 44 | 38 | | public SynonymMap(string name, string synonyms, string eTag = default(string)) |
| | 39 | | { |
| 44 | 40 | | Name = name; |
| 44 | 41 | | Synonyms = synonyms; |
| 44 | 42 | | ETag = eTag; |
| | 43 | | CustomInit(); |
| 44 | 44 | | } |
| | 45 | | /// <summary> |
| | 46 | | /// Static constructor for SynonymMap class. |
| | 47 | | /// </summary> |
| | 48 | | static SynonymMap() |
| | 49 | | { |
| 2 | 50 | | Format = "solr"; |
| 2 | 51 | | } |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// An initialization method that performs custom operations like setting defaults |
| | 55 | | /// </summary> |
| | 56 | | partial void CustomInit(); |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// Gets or sets the name of the synonym map. |
| | 60 | | /// </summary> |
| | 61 | | [JsonProperty(PropertyName = "name")] |
| 288 | 62 | | public string Name { get; set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets or sets a series of synonym rules in the specified synonym map |
| | 66 | | /// format. The rules must be separated by newlines. |
| | 67 | | /// </summary> |
| | 68 | | [JsonProperty(PropertyName = "synonyms")] |
| 238 | 69 | | public string Synonyms { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets or sets the ETag of the synonym map. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "@odata.etag")] |
| 198 | 75 | | public string ETag { get; set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// The format of the synonym map. Only the 'solr' format is currently |
| | 79 | | /// supported. |
| | 80 | | /// </summary> |
| | 81 | | [JsonProperty(PropertyName = "format")] |
| 114 | 82 | | public static string Format { get; private set; } |
| | 83 | |
|
| | 84 | | /// <summary> |
| | 85 | | /// Validate the object. |
| | 86 | | /// </summary> |
| | 87 | | /// <exception cref="ValidationException"> |
| | 88 | | /// Thrown if validation fails |
| | 89 | | /// </exception> |
| | 90 | | public virtual void Validate() |
| | 91 | | { |
| 56 | 92 | | if (Name == null) |
| | 93 | | { |
| 0 | 94 | | throw new ValidationException(ValidationRules.CannotBeNull, "Name"); |
| | 95 | | } |
| 56 | 96 | | if (Synonyms == null) |
| | 97 | | { |
| 0 | 98 | | throw new ValidationException(ValidationRules.CannotBeNull, "Synonyms"); |
| | 99 | | } |
| 56 | 100 | | } |
| | 101 | | } |
| | 102 | | } |