| | 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.EventGrid.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Linq; |
| | 16 | |
|
| | 17 | | /// <summary> |
| | 18 | | /// Properties of an event published to an Event Grid topic. |
| | 19 | | /// </summary> |
| | 20 | | public partial class EventGridEvent |
| | 21 | | { |
| | 22 | | /// <summary> |
| | 23 | | /// Initializes a new instance of the EventGridEvent class. |
| | 24 | | /// </summary> |
| 110 | 25 | | public EventGridEvent() |
| | 26 | | { |
| | 27 | | CustomInit(); |
| 110 | 28 | | } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Initializes a new instance of the EventGridEvent class. |
| | 32 | | /// </summary> |
| | 33 | | /// <param name="id">An unique identifier for the event.</param> |
| | 34 | | /// <param name="subject">A resource path relative to the topic |
| | 35 | | /// path.</param> |
| | 36 | | /// <param name="data">Event data specific to the event type.</param> |
| | 37 | | /// <param name="eventType">The type of the event that |
| | 38 | | /// occurred.</param> |
| | 39 | | /// <param name="eventTime">The time (in UTC) the event was |
| | 40 | | /// generated.</param> |
| | 41 | | /// <param name="dataVersion">The schema version of the data |
| | 42 | | /// object.</param> |
| | 43 | | /// <param name="topic">The resource path of the event source.</param> |
| | 44 | | /// <param name="metadataVersion">The schema version of the event |
| | 45 | | /// metadata.</param> |
| 0 | 46 | | public EventGridEvent(string id, string subject, object data, string eventType, System.DateTime eventTime, strin |
| | 47 | | { |
| 0 | 48 | | Id = id; |
| 0 | 49 | | Topic = topic; |
| 0 | 50 | | Subject = subject; |
| 0 | 51 | | Data = data; |
| 0 | 52 | | EventType = eventType; |
| 0 | 53 | | EventTime = eventTime; |
| 0 | 54 | | MetadataVersion = metadataVersion; |
| 0 | 55 | | DataVersion = dataVersion; |
| | 56 | | CustomInit(); |
| 0 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// An initialization method that performs custom operations like setting defaults |
| | 61 | | /// </summary> |
| | 62 | | partial void CustomInit(); |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets or sets an unique identifier for the event. |
| | 66 | | /// </summary> |
| | 67 | | [JsonProperty(PropertyName = "id")] |
| 150 | 68 | | public string Id { get; set; } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets or sets the resource path of the event source. |
| | 72 | | /// </summary> |
| | 73 | | [JsonProperty(PropertyName = "topic")] |
| 130 | 74 | | public string Topic { get; set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Gets or sets a resource path relative to the topic path. |
| | 78 | | /// </summary> |
| | 79 | | [JsonProperty(PropertyName = "subject")] |
| 150 | 80 | | public string Subject { get; set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Gets or sets event data specific to the event type. |
| | 84 | | /// </summary> |
| | 85 | | [JsonProperty(PropertyName = "data")] |
| 593 | 86 | | public object Data { get; set; } |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Gets or sets the type of the event that occurred. |
| | 90 | | /// </summary> |
| | 91 | | [JsonProperty(PropertyName = "eventType")] |
| 248 | 92 | | public string EventType { get; set; } |
| | 93 | |
|
| | 94 | | /// <summary> |
| | 95 | | /// Gets or sets the time (in UTC) the event was generated. |
| | 96 | | /// </summary> |
| | 97 | | [JsonProperty(PropertyName = "eventTime")] |
| 130 | 98 | | public System.DateTime EventTime { get; set; } |
| | 99 | |
|
| | 100 | | /// <summary> |
| | 101 | | /// Gets the schema version of the event metadata. |
| | 102 | | /// </summary> |
| | 103 | | [JsonProperty(PropertyName = "metadataVersion")] |
| 0 | 104 | | public string MetadataVersion { get; private set; } |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Gets or sets the schema version of the data object. |
| | 108 | | /// </summary> |
| | 109 | | [JsonProperty(PropertyName = "dataVersion")] |
| 142 | 110 | | public string DataVersion { get; set; } |
| | 111 | |
|
| | 112 | | /// <summary> |
| | 113 | | /// Validate the object. |
| | 114 | | /// </summary> |
| | 115 | | /// <exception cref="ValidationException"> |
| | 116 | | /// Thrown if validation fails |
| | 117 | | /// </exception> |
| | 118 | | public virtual void Validate() |
| | 119 | | { |
| 20 | 120 | | if (Id == null) |
| | 121 | | { |
| 0 | 122 | | throw new ValidationException(ValidationRules.CannotBeNull, "Id"); |
| | 123 | | } |
| 20 | 124 | | if (Subject == null) |
| | 125 | | { |
| 0 | 126 | | throw new ValidationException(ValidationRules.CannotBeNull, "Subject"); |
| | 127 | | } |
| 20 | 128 | | if (Data == null) |
| | 129 | | { |
| 0 | 130 | | throw new ValidationException(ValidationRules.CannotBeNull, "Data"); |
| | 131 | | } |
| 20 | 132 | | if (EventType == null) |
| | 133 | | { |
| 0 | 134 | | throw new ValidationException(ValidationRules.CannotBeNull, "EventType"); |
| | 135 | | } |
| 20 | 136 | | if (DataVersion == null) |
| | 137 | | { |
| 0 | 138 | | throw new ValidationException(ValidationRules.CannotBeNull, "DataVersion"); |
| | 139 | | } |
| 20 | 140 | | } |
| | 141 | | } |
| | 142 | | } |