| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.Analytics.Synapse.Artifacts.Models |
| | 13 | | { |
| | 14 | | public partial class WebHookActivity : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("name"); |
| 0 | 20 | | writer.WriteStringValue(Name); |
| 0 | 21 | | writer.WritePropertyName("type"); |
| 0 | 22 | | writer.WriteStringValue(Type); |
| 0 | 23 | | if (Optional.IsDefined(Description)) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("description"); |
| 0 | 26 | | writer.WriteStringValue(Description); |
| | 27 | | } |
| 0 | 28 | | if (Optional.IsCollectionDefined(DependsOn)) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("dependsOn"); |
| 0 | 31 | | writer.WriteStartArray(); |
| 0 | 32 | | foreach (var item in DependsOn) |
| | 33 | | { |
| 0 | 34 | | writer.WriteObjectValue(item); |
| | 35 | | } |
| 0 | 36 | | writer.WriteEndArray(); |
| | 37 | | } |
| 0 | 38 | | if (Optional.IsCollectionDefined(UserProperties)) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("userProperties"); |
| 0 | 41 | | writer.WriteStartArray(); |
| 0 | 42 | | foreach (var item in UserProperties) |
| | 43 | | { |
| 0 | 44 | | writer.WriteObjectValue(item); |
| | 45 | | } |
| 0 | 46 | | writer.WriteEndArray(); |
| | 47 | | } |
| 0 | 48 | | writer.WritePropertyName("typeProperties"); |
| 0 | 49 | | writer.WriteStartObject(); |
| 0 | 50 | | writer.WritePropertyName("method"); |
| 0 | 51 | | writer.WriteStringValue(Method.ToString()); |
| 0 | 52 | | writer.WritePropertyName("url"); |
| 0 | 53 | | writer.WriteObjectValue(Url); |
| 0 | 54 | | if (Optional.IsDefined(Timeout)) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("timeout"); |
| 0 | 57 | | writer.WriteStringValue(Timeout); |
| | 58 | | } |
| 0 | 59 | | if (Optional.IsDefined(Headers)) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("headers"); |
| 0 | 62 | | writer.WriteObjectValue(Headers); |
| | 63 | | } |
| 0 | 64 | | if (Optional.IsDefined(Body)) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("body"); |
| 0 | 67 | | writer.WriteObjectValue(Body); |
| | 68 | | } |
| 0 | 69 | | if (Optional.IsDefined(Authentication)) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("authentication"); |
| 0 | 72 | | writer.WriteObjectValue(Authentication); |
| | 73 | | } |
| 0 | 74 | | if (Optional.IsDefined(ReportStatusOnCallBack)) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("reportStatusOnCallBack"); |
| 0 | 77 | | writer.WriteObjectValue(ReportStatusOnCallBack); |
| | 78 | | } |
| 0 | 79 | | writer.WriteEndObject(); |
| 0 | 80 | | foreach (var item in AdditionalProperties) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName(item.Key); |
| 0 | 83 | | writer.WriteObjectValue(item.Value); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndObject(); |
| 0 | 86 | | } |
| | 87 | |
|
| | 88 | | internal static WebHookActivity DeserializeWebHookActivity(JsonElement element) |
| | 89 | | { |
| 0 | 90 | | string name = default; |
| 0 | 91 | | string type = default; |
| 0 | 92 | | Optional<string> description = default; |
| 0 | 93 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 94 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 95 | | WebHookActivityMethod method = default; |
| 0 | 96 | | object url = default; |
| 0 | 97 | | Optional<string> timeout = default; |
| 0 | 98 | | Optional<object> headers = default; |
| 0 | 99 | | Optional<object> body = default; |
| 0 | 100 | | Optional<WebActivityAuthentication> authentication = default; |
| 0 | 101 | | Optional<object> reportStatusOnCallBack = default; |
| 0 | 102 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 103 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 104 | | foreach (var property in element.EnumerateObject()) |
| | 105 | | { |
| 0 | 106 | | if (property.NameEquals("name")) |
| | 107 | | { |
| 0 | 108 | | name = property.Value.GetString(); |
| 0 | 109 | | continue; |
| | 110 | | } |
| 0 | 111 | | if (property.NameEquals("type")) |
| | 112 | | { |
| 0 | 113 | | type = property.Value.GetString(); |
| 0 | 114 | | continue; |
| | 115 | | } |
| 0 | 116 | | if (property.NameEquals("description")) |
| | 117 | | { |
| 0 | 118 | | description = property.Value.GetString(); |
| 0 | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | if (property.NameEquals("dependsOn")) |
| | 122 | | { |
| 0 | 123 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 124 | | foreach (var item in property.Value.EnumerateArray()) |
| | 125 | | { |
| 0 | 126 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 127 | | } |
| 0 | 128 | | dependsOn = array; |
| 0 | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | if (property.NameEquals("userProperties")) |
| | 132 | | { |
| 0 | 133 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 134 | | foreach (var item in property.Value.EnumerateArray()) |
| | 135 | | { |
| 0 | 136 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 137 | | } |
| 0 | 138 | | userProperties = array; |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("typeProperties")) |
| | 142 | | { |
| 0 | 143 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 144 | | { |
| 0 | 145 | | if (property0.NameEquals("method")) |
| | 146 | | { |
| 0 | 147 | | method = new WebHookActivityMethod(property0.Value.GetString()); |
| 0 | 148 | | continue; |
| | 149 | | } |
| 0 | 150 | | if (property0.NameEquals("url")) |
| | 151 | | { |
| 0 | 152 | | url = property0.Value.GetObject(); |
| 0 | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | if (property0.NameEquals("timeout")) |
| | 156 | | { |
| 0 | 157 | | timeout = property0.Value.GetString(); |
| 0 | 158 | | continue; |
| | 159 | | } |
| 0 | 160 | | if (property0.NameEquals("headers")) |
| | 161 | | { |
| 0 | 162 | | headers = property0.Value.GetObject(); |
| 0 | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | if (property0.NameEquals("body")) |
| | 166 | | { |
| 0 | 167 | | body = property0.Value.GetObject(); |
| 0 | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | if (property0.NameEquals("authentication")) |
| | 171 | | { |
| 0 | 172 | | authentication = WebActivityAuthentication.DeserializeWebActivityAuthentication(property0.Va |
| 0 | 173 | | continue; |
| | 174 | | } |
| 0 | 175 | | if (property0.NameEquals("reportStatusOnCallBack")) |
| | 176 | | { |
| 0 | 177 | | reportStatusOnCallBack = property0.Value.GetObject(); |
| | 178 | | continue; |
| | 179 | | } |
| | 180 | | } |
| | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 184 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 185 | | } |
| 0 | 186 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 187 | | return new WebHookActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(userPr |
| | 188 | | } |
| | 189 | | } |
| | 190 | | } |