| | 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 | | /// Abstract base class for skills. |
| | 21 | | /// <see |
| | 22 | | /// href="https://docs.microsoft.com/azure/search/cognitive-search-predefined-skills" |
| | 23 | | /// /> |
| | 24 | | /// </summary> |
| | 25 | | public partial class Skill |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// Initializes a new instance of the Skill class. |
| | 29 | | /// </summary> |
| 118 | 30 | | public Skill() |
| | 31 | | { |
| | 32 | | CustomInit(); |
| 118 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Initializes a new instance of the Skill class. |
| | 37 | | /// </summary> |
| | 38 | | /// <param name="inputs">Inputs of the skills could be a column in the |
| | 39 | | /// source data set, or the output of an upstream skill.</param> |
| | 40 | | /// <param name="outputs">The output of a skill is either a field in a |
| | 41 | | /// search index, or a value that can be consumed as an input by |
| | 42 | | /// another skill.</param> |
| | 43 | | /// <param name="name">The name of the skill which uniquely identifies |
| | 44 | | /// it within the skillset. A skill with no name defined will be given |
| | 45 | | /// a default name of its 1-based index in the skills array, prefixed |
| | 46 | | /// with the character '#'.</param> |
| | 47 | | /// <param name="description">The description of the skill which |
| | 48 | | /// describes the inputs, outputs, and usage of the skill.</param> |
| | 49 | | /// <param name="context">Represents the level at which operations take |
| | 50 | | /// place, such as the document root or document content (for example, |
| | 51 | | /// /document or /document/content). The default is /document.</param> |
| 112 | 52 | | public Skill(IList<InputFieldMappingEntry> inputs, IList<OutputFieldMappingEntry> outputs, string name = default |
| | 53 | | { |
| 112 | 54 | | Name = name; |
| 112 | 55 | | Description = description; |
| 112 | 56 | | Context = context; |
| 112 | 57 | | Inputs = inputs; |
| 112 | 58 | | Outputs = outputs; |
| | 59 | | CustomInit(); |
| 112 | 60 | | } |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// An initialization method that performs custom operations like setting defaults |
| | 64 | | /// </summary> |
| | 65 | | partial void CustomInit(); |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Gets or sets the name of the skill which uniquely identifies it |
| | 69 | | /// within the skillset. A skill with no name defined will be given a |
| | 70 | | /// default name of its 1-based index in the skills array, prefixed |
| | 71 | | /// with the character '#'. |
| | 72 | | /// </summary> |
| | 73 | | [JsonProperty(PropertyName = "name")] |
| 534 | 74 | | public string Name { get; set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Gets or sets the description of the skill which describes the |
| | 78 | | /// inputs, outputs, and usage of the skill. |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "description")] |
| 534 | 81 | | public string Description { get; set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Gets or sets represents the level at which operations take place, |
| | 85 | | /// such as the document root or document content (for example, |
| | 86 | | /// /document or /document/content). The default is /document. |
| | 87 | | /// </summary> |
| | 88 | | [JsonProperty(PropertyName = "context")] |
| 534 | 89 | | public string Context { get; set; } |
| | 90 | |
|
| | 91 | | /// <summary> |
| | 92 | | /// Gets or sets inputs of the skills could be a column in the source |
| | 93 | | /// data set, or the output of an upstream skill. |
| | 94 | | /// </summary> |
| | 95 | | [JsonProperty(PropertyName = "inputs")] |
| 870 | 96 | | public IList<InputFieldMappingEntry> Inputs { get; set; } |
| | 97 | |
|
| | 98 | | /// <summary> |
| | 99 | | /// Gets or sets the output of a skill is either a field in a search |
| | 100 | | /// index, or a value that can be consumed as an input by another |
| | 101 | | /// skill. |
| | 102 | | /// </summary> |
| | 103 | | [JsonProperty(PropertyName = "outputs")] |
| 870 | 104 | | public IList<OutputFieldMappingEntry> Outputs { get; set; } |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Validate the object. |
| | 108 | | /// </summary> |
| | 109 | | /// <exception cref="ValidationException"> |
| | 110 | | /// Thrown if validation fails |
| | 111 | | /// </exception> |
| | 112 | | public virtual void Validate() |
| | 113 | | { |
| 112 | 114 | | if (Inputs == null) |
| | 115 | | { |
| 0 | 116 | | throw new ValidationException(ValidationRules.CannotBeNull, "Inputs"); |
| | 117 | | } |
| 112 | 118 | | if (Outputs == null) |
| | 119 | | { |
| 0 | 120 | | throw new ValidationException(ValidationRules.CannotBeNull, "Outputs"); |
| | 121 | | } |
| 112 | 122 | | if (Inputs != null) |
| | 123 | | { |
| 576 | 124 | | foreach (var element in Inputs) |
| | 125 | | { |
| 176 | 126 | | if (element != null) |
| | 127 | | { |
| 176 | 128 | | element.Validate(); |
| | 129 | | } |
| | 130 | | } |
| | 131 | | } |
| 112 | 132 | | if (Outputs != null) |
| | 133 | | { |
| 480 | 134 | | foreach (var element1 in Outputs) |
| | 135 | | { |
| 128 | 136 | | if (element1 != null) |
| | 137 | | { |
| 128 | 138 | | element1.Validate(); |
| | 139 | | } |
| | 140 | | } |
| | 141 | | } |
| 112 | 142 | | } |
| | 143 | | } |
| | 144 | | } |