| | 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.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Represents an indexer. |
| | 21 | | /// <see |
| | 22 | | /// href="https://docs.microsoft.com/rest/api/searchservice/Indexer-operations" |
| | 23 | | /// /> |
| | 24 | | /// </summary> |
| | 25 | | public partial class Indexer |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the Indexer class. |
| | 29 | | /// </summary> |
| 56 | 30 | | public Indexer() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 56 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the Indexer class. |
| | 37 | | /// </summary> |
| | 38 | | /// <param name="name">The name of the indexer.</param> |
| | 39 | | /// <param name="dataSourceName">The name of the datasource from which |
| | 40 | | /// this indexer reads data.</param> |
| | 41 | | /// <param name="targetIndexName">The name of the index to which this |
| | 42 | | /// indexer writes data.</param> |
| | 43 | | /// <param name="description">The description of the indexer.</param> |
| | 44 | | /// <param name="skillsetName">The name of the skillset executing with |
| | 45 | | /// this indexer.</param> |
| | 46 | | /// <param name="schedule">The schedule for this indexer.</param> |
| | 47 | | /// <param name="parameters">Parameters for indexer execution.</param> |
| | 48 | | /// <param name="fieldMappings">Defines mappings between fields in the |
| | 49 | | /// data source and corresponding target fields in the index.</param> |
| | 50 | | /// <param name="outputFieldMappings">Output field mappings are applied |
| | 51 | | /// after enrichment and immediately before indexing.</param> |
| | 52 | | /// <param name="isDisabled">A value indicating whether the indexer is |
| | 53 | | /// disabled. Default is false.</param> |
| | 54 | | /// <param name="eTag">The ETag of the Indexer.</param> |
| 44 | 55 | | public Indexer(string name, string dataSourceName, string targetIndexName, string description = default(string), |
| | 56 | | { |
| 44 | 57 | | Name = name; |
| 44 | 58 | | Description = description; |
| 44 | 59 | | DataSourceName = dataSourceName; |
| 44 | 60 | | SkillsetName = skillsetName; |
| 44 | 61 | | TargetIndexName = targetIndexName; |
| 44 | 62 | | Schedule = schedule; |
| 44 | 63 | | Parameters = parameters; |
| 44 | 64 | | FieldMappings = fieldMappings; |
| 44 | 65 | | OutputFieldMappings = outputFieldMappings; |
| 44 | 66 | | IsDisabled = isDisabled; |
| 44 | 67 | | ETag = eTag; |
| | 68 | | CustomInit(); |
| 44 | 69 | | } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// An initialization method that performs custom operations like setting defaults |
| | 73 | | /// </summary> |
| | 74 | | partial void CustomInit(); |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Gets or sets the name of the indexer. |
| | 78 | | /// </summary> |
| | 79 | | [JsonProperty(PropertyName = "name")] |
| 300 | 80 | | public string Name { get; set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Gets or sets the description of the indexer. |
| | 84 | | /// </summary> |
| | 85 | | [JsonProperty(PropertyName = "description")] |
| 138 | 86 | | public string Description { get; set; } |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Gets or sets the name of the datasource from which this indexer |
| | 90 | | /// reads data. |
| | 91 | | /// </summary> |
| | 92 | | [JsonProperty(PropertyName = "dataSourceName")] |
| 232 | 93 | | public string DataSourceName { get; set; } |
| | 94 | |
|
| | 95 | | /// <summary> |
| | 96 | | /// Gets or sets the name of the skillset executing with this indexer. |
| | 97 | | /// </summary> |
| | 98 | | [JsonProperty(PropertyName = "skillsetName")] |
| 118 | 99 | | public string SkillsetName { get; set; } |
| | 100 | |
|
| | 101 | | /// <summary> |
| | 102 | | /// Gets or sets the name of the index to which this indexer writes |
| | 103 | | /// data. |
| | 104 | | /// </summary> |
| | 105 | | [JsonProperty(PropertyName = "targetIndexName")] |
| 228 | 106 | | public string TargetIndexName { get; set; } |
| | 107 | |
|
| | 108 | | /// <summary> |
| | 109 | | /// Gets or sets the schedule for this indexer. |
| | 110 | | /// </summary> |
| | 111 | | [JsonProperty(PropertyName = "schedule")] |
| 384 | 112 | | public IndexingSchedule Schedule { get; set; } |
| | 113 | |
|
| | 114 | | /// <summary> |
| | 115 | | /// Gets or sets parameters for indexer execution. |
| | 116 | | /// </summary> |
| | 117 | | [JsonProperty(PropertyName = "parameters")] |
| 132 | 118 | | public IndexingParameters Parameters { get; set; } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Gets or sets defines mappings between fields in the data source and |
| | 122 | | /// corresponding target fields in the index. |
| | 123 | | /// </summary> |
| | 124 | | [JsonProperty(PropertyName = "fieldMappings")] |
| 380 | 125 | | public IList<FieldMapping> FieldMappings { get; set; } |
| | 126 | |
|
| | 127 | | /// <summary> |
| | 128 | | /// Gets or sets output field mappings are applied after enrichment and |
| | 129 | | /// immediately before indexing. |
| | 130 | | /// </summary> |
| | 131 | | [JsonProperty(PropertyName = "outputFieldMappings")] |
| 300 | 132 | | public IList<FieldMapping> OutputFieldMappings { get; set; } |
| | 133 | |
|
| | 134 | | /// <summary> |
| | 135 | | /// Gets or sets a value indicating whether the indexer is disabled. |
| | 136 | | /// Default is false. |
| | 137 | | /// </summary> |
| | 138 | | [JsonProperty(PropertyName = "disabled")] |
| 124 | 139 | | public bool? IsDisabled { get; set; } |
| | 140 | |
|
| | 141 | | /// <summary> |
| | 142 | | /// Gets or sets the ETag of the Indexer. |
| | 143 | | /// </summary> |
| | 144 | | [JsonProperty(PropertyName = "@odata.etag")] |
| 198 | 145 | | public string ETag { get; set; } |
| | 146 | |
|
| | 147 | | /// <summary> |
| | 148 | | /// Validate the object. |
| | 149 | | /// </summary> |
| | 150 | | /// <exception cref="ValidationException"> |
| | 151 | | /// Thrown if validation fails |
| | 152 | | /// </exception> |
| | 153 | | public virtual void Validate() |
| | 154 | | { |
| 56 | 155 | | if (Name == null) |
| | 156 | | { |
| 0 | 157 | | throw new ValidationException(ValidationRules.CannotBeNull, "Name"); |
| | 158 | | } |
| 56 | 159 | | if (DataSourceName == null) |
| | 160 | | { |
| 0 | 161 | | throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceName"); |
| | 162 | | } |
| 56 | 163 | | if (TargetIndexName == null) |
| | 164 | | { |
| 0 | 165 | | throw new ValidationException(ValidationRules.CannotBeNull, "TargetIndexName"); |
| | 166 | | } |
| 56 | 167 | | if (Schedule != null) |
| | 168 | | { |
| 54 | 169 | | Schedule.Validate(); |
| | 170 | | } |
| 56 | 171 | | if (FieldMappings != null) |
| | 172 | | { |
| 764 | 173 | | foreach (var element in FieldMappings) |
| | 174 | | { |
| 328 | 175 | | if (element != null) |
| | 176 | | { |
| 328 | 177 | | element.Validate(); |
| | 178 | | } |
| | 179 | | } |
| | 180 | | } |
| 56 | 181 | | if (OutputFieldMappings != null) |
| | 182 | | { |
| 36 | 183 | | foreach (var element1 in OutputFieldMappings) |
| | 184 | | { |
| 4 | 185 | | if (element1 != null) |
| | 186 | | { |
| 4 | 187 | | element1.Validate(); |
| | 188 | | } |
| | 189 | | } |
| | 190 | | } |
| 56 | 191 | | } |
| | 192 | | } |
| | 193 | | } |