|  |  | 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.ApplicationInsights.Query.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 |  |     /// The Analytics query. Learn more about the [Analytics query | 
|  |  | 21 |  |     /// syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) | 
|  |  | 22 |  |     /// </summary> | 
|  |  | 23 |  |     public partial class QueryBody | 
|  |  | 24 |  |     { | 
|  |  | 25 |  |         /// <summary> | 
|  |  | 26 |  |         /// Initializes a new instance of the QueryBody class. | 
|  |  | 27 |  |         /// </summary> | 
|  | 0 | 28 |  |         public QueryBody() | 
|  |  | 29 |  |         { | 
|  |  | 30 |  |             CustomInit(); | 
|  | 0 | 31 |  |         } | 
|  |  | 32 |  |  | 
|  |  | 33 |  |         /// <summary> | 
|  |  | 34 |  |         /// Initializes a new instance of the QueryBody class. | 
|  |  | 35 |  |         /// </summary> | 
|  |  | 36 |  |         /// <param name="query">The query to execute.</param> | 
|  |  | 37 |  |         /// <param name="timespan">Optional. The timespan over which to query | 
|  |  | 38 |  |         /// data. This is an ISO8601 time period value.  This timespan is | 
|  |  | 39 |  |         /// applied in addition to any that are specified in the query | 
|  |  | 40 |  |         /// expression.</param> | 
|  |  | 41 |  |         /// <param name="applications">A list of Application IDs for | 
|  |  | 42 |  |         /// cross-application queries.</param> | 
|  | 0 | 43 |  |         public QueryBody(string query, string timespan = default(string), IList<string> applications = default(IList<str | 
|  |  | 44 |  |         { | 
|  | 0 | 45 |  |             Query = query; | 
|  | 0 | 46 |  |             Timespan = timespan; | 
|  | 0 | 47 |  |             Applications = applications; | 
|  |  | 48 |  |             CustomInit(); | 
|  | 0 | 49 |  |         } | 
|  |  | 50 |  |  | 
|  |  | 51 |  |         /// <summary> | 
|  |  | 52 |  |         /// An initialization method that performs custom operations like setting defaults | 
|  |  | 53 |  |         /// </summary> | 
|  |  | 54 |  |         partial void CustomInit(); | 
|  |  | 55 |  |  | 
|  |  | 56 |  |         /// <summary> | 
|  |  | 57 |  |         /// Gets or sets the query to execute. | 
|  |  | 58 |  |         /// </summary> | 
|  |  | 59 |  |         [JsonProperty(PropertyName = "query")] | 
|  | 0 | 60 |  |         public string Query { get; set; } | 
|  |  | 61 |  |  | 
|  |  | 62 |  |         /// <summary> | 
|  |  | 63 |  |         /// Gets or sets optional. The timespan over which to query data. This | 
|  |  | 64 |  |         /// is an ISO8601 time period value.  This timespan is applied in | 
|  |  | 65 |  |         /// addition to any that are specified in the query expression. | 
|  |  | 66 |  |         /// </summary> | 
|  |  | 67 |  |         [JsonProperty(PropertyName = "timespan")] | 
|  | 0 | 68 |  |         public string Timespan { get; set; } | 
|  |  | 69 |  |  | 
|  |  | 70 |  |         /// <summary> | 
|  |  | 71 |  |         /// Gets or sets a list of Application IDs for cross-application | 
|  |  | 72 |  |         /// queries. | 
|  |  | 73 |  |         /// </summary> | 
|  |  | 74 |  |         [JsonProperty(PropertyName = "applications")] | 
|  | 0 | 75 |  |         public IList<string> Applications { get; set; } | 
|  |  | 76 |  |  | 
|  |  | 77 |  |         /// <summary> | 
|  |  | 78 |  |         /// Validate the object. | 
|  |  | 79 |  |         /// </summary> | 
|  |  | 80 |  |         /// <exception cref="ValidationException"> | 
|  |  | 81 |  |         /// Thrown if validation fails | 
|  |  | 82 |  |         /// </exception> | 
|  |  | 83 |  |         public virtual void Validate() | 
|  |  | 84 |  |         { | 
|  | 0 | 85 |  |             if (Query == null) | 
|  |  | 86 |  |             { | 
|  | 0 | 87 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "Query"); | 
|  |  | 88 |  |             } | 
|  | 0 | 89 |  |         } | 
|  |  | 90 |  |     } | 
|  |  | 91 |  | } |