| | 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 | | /// A skill that can call a Web API endpoint, allowing you to extend a |
| | 21 | | /// skillset by having it call your custom code. |
| | 22 | | /// <see |
| | 23 | | /// href="https://docs.microsoft.com/azure/search/cognitive-search-custom-skill-web-api" |
| | 24 | | /// /> |
| | 25 | | /// </summary> |
| | 26 | | [Newtonsoft.Json.JsonObject("#Microsoft.Skills.Custom.WebApiSkill")] |
| | 27 | | public partial class WebApiSkill : Skill |
| | 28 | | { |
| | 29 | | /// <summary> |
| | 30 | | /// Initializes a new instance of the WebApiSkill class. |
| | 31 | | /// </summary> |
| 4 | 32 | | public WebApiSkill() |
| | 33 | | { |
| | 34 | | CustomInit(); |
| 4 | 35 | | } |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// Initializes a new instance of the WebApiSkill class. |
| | 39 | | /// </summary> |
| | 40 | | /// <param name="inputs">Inputs of the skills could be a column in the |
| | 41 | | /// source data set, or the output of an upstream skill.</param> |
| | 42 | | /// <param name="outputs">The output of a skill is either a field in a |
| | 43 | | /// search index, or a value that can be consumed as an input by |
| | 44 | | /// another skill.</param> |
| | 45 | | /// <param name="uri">The url for the Web API.</param> |
| | 46 | | /// <param name="name">The name of the skill which uniquely identifies |
| | 47 | | /// it within the skillset. A skill with no name defined will be given |
| | 48 | | /// a default name of its 1-based index in the skills array, prefixed |
| | 49 | | /// with the character '#'.</param> |
| | 50 | | /// <param name="description">The description of the skill which |
| | 51 | | /// describes the inputs, outputs, and usage of the skill.</param> |
| | 52 | | /// <param name="context">Represents the level at which operations take |
| | 53 | | /// place, such as the document root or document content (for example, |
| | 54 | | /// /document or /document/content). The default is /document.</param> |
| | 55 | | /// <param name="httpHeaders">The headers required to make the http |
| | 56 | | /// request.</param> |
| | 57 | | /// <param name="httpMethod">The method for the http request.</param> |
| | 58 | | /// <param name="timeout">The desired timeout for the request. Default |
| | 59 | | /// is 30 seconds.</param> |
| | 60 | | /// <param name="batchSize">The desired batch size which indicates |
| | 61 | | /// number of documents.</param> |
| | 62 | | /// <param name="degreeOfParallelism">If set, the number of parallel |
| | 63 | | /// calls that can be made to the Web API.</param> |
| | 64 | | public WebApiSkill(IList<InputFieldMappingEntry> inputs, IList<OutputFieldMappingEntry> outputs, string uri, str |
| 4 | 65 | | : base(inputs, outputs, name, description, context) |
| | 66 | | { |
| 4 | 67 | | Uri = uri; |
| 4 | 68 | | HttpHeaders = httpHeaders; |
| 4 | 69 | | HttpMethod = httpMethod; |
| 4 | 70 | | Timeout = timeout; |
| 4 | 71 | | BatchSize = batchSize; |
| 4 | 72 | | DegreeOfParallelism = degreeOfParallelism; |
| | 73 | | CustomInit(); |
| 4 | 74 | | } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// An initialization method that performs custom operations like setting defaults |
| | 78 | | /// </summary> |
| | 79 | | partial void CustomInit(); |
| | 80 | |
|
| | 81 | | /// <summary> |
| | 82 | | /// Gets or sets the url for the Web API. |
| | 83 | | /// </summary> |
| | 84 | | [JsonProperty(PropertyName = "uri")] |
| 24 | 85 | | public string Uri { get; set; } |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// Gets or sets the headers required to make the http request. |
| | 89 | | /// </summary> |
| | 90 | | [JsonProperty(PropertyName = "httpHeaders")] |
| 22 | 91 | | public IDictionary<string, string> HttpHeaders { get; set; } |
| | 92 | |
|
| | 93 | | /// <summary> |
| | 94 | | /// Gets or sets the method for the http request. |
| | 95 | | /// </summary> |
| | 96 | | [JsonProperty(PropertyName = "httpMethod")] |
| 24 | 97 | | public string HttpMethod { get; set; } |
| | 98 | |
|
| | 99 | | /// <summary> |
| | 100 | | /// Gets or sets the desired timeout for the request. Default is 30 |
| | 101 | | /// seconds. |
| | 102 | | /// </summary> |
| | 103 | | [JsonProperty(PropertyName = "timeout")] |
| 20 | 104 | | public System.TimeSpan? Timeout { get; set; } |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Gets or sets the desired batch size which indicates number of |
| | 108 | | /// documents. |
| | 109 | | /// </summary> |
| | 110 | | [JsonProperty(PropertyName = "batchSize")] |
| 20 | 111 | | public int? BatchSize { get; set; } |
| | 112 | |
|
| | 113 | | /// <summary> |
| | 114 | | /// Gets or sets if set, the number of parallel calls that can be made |
| | 115 | | /// to the Web API. |
| | 116 | | /// </summary> |
| | 117 | | [JsonProperty(PropertyName = "degreeOfParallelism")] |
| 24 | 118 | | public int? DegreeOfParallelism { get; set; } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Validate the object. |
| | 122 | | /// </summary> |
| | 123 | | /// <exception cref="ValidationException"> |
| | 124 | | /// Thrown if validation fails |
| | 125 | | /// </exception> |
| | 126 | | public override void Validate() |
| | 127 | | { |
| 4 | 128 | | base.Validate(); |
| 4 | 129 | | if (Uri == null) |
| | 130 | | { |
| 0 | 131 | | throw new ValidationException(ValidationRules.CannotBeNull, "Uri"); |
| | 132 | | } |
| 4 | 133 | | } |
| | 134 | | } |
| | 135 | | } |