| | 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 WebActivity : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Optional.IsDefined(LinkedServiceName)) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("linkedServiceName"); |
| 0 | 22 | | writer.WriteObjectValue(LinkedServiceName); |
| | 23 | | } |
| 0 | 24 | | if (Optional.IsDefined(Policy)) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("policy"); |
| 0 | 27 | | writer.WriteObjectValue(Policy); |
| | 28 | | } |
| 0 | 29 | | writer.WritePropertyName("name"); |
| 0 | 30 | | writer.WriteStringValue(Name); |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| 0 | 33 | | if (Optional.IsDefined(Description)) |
| | 34 | | { |
| 0 | 35 | | writer.WritePropertyName("description"); |
| 0 | 36 | | writer.WriteStringValue(Description); |
| | 37 | | } |
| 0 | 38 | | if (Optional.IsCollectionDefined(DependsOn)) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("dependsOn"); |
| 0 | 41 | | writer.WriteStartArray(); |
| 0 | 42 | | foreach (var item in DependsOn) |
| | 43 | | { |
| 0 | 44 | | writer.WriteObjectValue(item); |
| | 45 | | } |
| 0 | 46 | | writer.WriteEndArray(); |
| | 47 | | } |
| 0 | 48 | | if (Optional.IsCollectionDefined(UserProperties)) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName("userProperties"); |
| 0 | 51 | | writer.WriteStartArray(); |
| 0 | 52 | | foreach (var item in UserProperties) |
| | 53 | | { |
| 0 | 54 | | writer.WriteObjectValue(item); |
| | 55 | | } |
| 0 | 56 | | writer.WriteEndArray(); |
| | 57 | | } |
| 0 | 58 | | writer.WritePropertyName("typeProperties"); |
| 0 | 59 | | writer.WriteStartObject(); |
| 0 | 60 | | writer.WritePropertyName("method"); |
| 0 | 61 | | writer.WriteStringValue(Method.ToString()); |
| 0 | 62 | | writer.WritePropertyName("url"); |
| 0 | 63 | | writer.WriteObjectValue(Url); |
| 0 | 64 | | if (Optional.IsDefined(Headers)) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("headers"); |
| 0 | 67 | | writer.WriteObjectValue(Headers); |
| | 68 | | } |
| 0 | 69 | | if (Optional.IsDefined(Body)) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("body"); |
| 0 | 72 | | writer.WriteObjectValue(Body); |
| | 73 | | } |
| 0 | 74 | | if (Optional.IsDefined(Authentication)) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("authentication"); |
| 0 | 77 | | writer.WriteObjectValue(Authentication); |
| | 78 | | } |
| 0 | 79 | | if (Optional.IsCollectionDefined(Datasets)) |
| | 80 | | { |
| 0 | 81 | | writer.WritePropertyName("datasets"); |
| 0 | 82 | | writer.WriteStartArray(); |
| 0 | 83 | | foreach (var item in Datasets) |
| | 84 | | { |
| 0 | 85 | | writer.WriteObjectValue(item); |
| | 86 | | } |
| 0 | 87 | | writer.WriteEndArray(); |
| | 88 | | } |
| 0 | 89 | | if (Optional.IsCollectionDefined(LinkedServices)) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName("linkedServices"); |
| 0 | 92 | | writer.WriteStartArray(); |
| 0 | 93 | | foreach (var item in LinkedServices) |
| | 94 | | { |
| 0 | 95 | | writer.WriteObjectValue(item); |
| | 96 | | } |
| 0 | 97 | | writer.WriteEndArray(); |
| | 98 | | } |
| 0 | 99 | | if (Optional.IsDefined(ConnectVia)) |
| | 100 | | { |
| 0 | 101 | | writer.WritePropertyName("connectVia"); |
| 0 | 102 | | writer.WriteObjectValue(ConnectVia); |
| | 103 | | } |
| 0 | 104 | | writer.WriteEndObject(); |
| 0 | 105 | | foreach (var item in AdditionalProperties) |
| | 106 | | { |
| 0 | 107 | | writer.WritePropertyName(item.Key); |
| 0 | 108 | | writer.WriteObjectValue(item.Value); |
| | 109 | | } |
| 0 | 110 | | writer.WriteEndObject(); |
| 0 | 111 | | } |
| | 112 | |
|
| | 113 | | internal static WebActivity DeserializeWebActivity(JsonElement element) |
| | 114 | | { |
| 0 | 115 | | Optional<LinkedServiceReference> linkedServiceName = default; |
| 0 | 116 | | Optional<ActivityPolicy> policy = default; |
| 0 | 117 | | string name = default; |
| 0 | 118 | | string type = default; |
| 0 | 119 | | Optional<string> description = default; |
| 0 | 120 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 121 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 122 | | WebActivityMethod method = default; |
| 0 | 123 | | object url = default; |
| 0 | 124 | | Optional<object> headers = default; |
| 0 | 125 | | Optional<object> body = default; |
| 0 | 126 | | Optional<WebActivityAuthentication> authentication = default; |
| 0 | 127 | | Optional<IList<DatasetReference>> datasets = default; |
| 0 | 128 | | Optional<IList<LinkedServiceReference>> linkedServices = default; |
| 0 | 129 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 130 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 131 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 132 | | foreach (var property in element.EnumerateObject()) |
| | 133 | | { |
| 0 | 134 | | if (property.NameEquals("linkedServiceName")) |
| | 135 | | { |
| 0 | 136 | | linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value); |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property.NameEquals("policy")) |
| | 140 | | { |
| 0 | 141 | | policy = ActivityPolicy.DeserializeActivityPolicy(property.Value); |
| 0 | 142 | | continue; |
| | 143 | | } |
| 0 | 144 | | if (property.NameEquals("name")) |
| | 145 | | { |
| 0 | 146 | | name = property.Value.GetString(); |
| 0 | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | if (property.NameEquals("type")) |
| | 150 | | { |
| 0 | 151 | | type = property.Value.GetString(); |
| 0 | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | if (property.NameEquals("description")) |
| | 155 | | { |
| 0 | 156 | | description = property.Value.GetString(); |
| 0 | 157 | | continue; |
| | 158 | | } |
| 0 | 159 | | if (property.NameEquals("dependsOn")) |
| | 160 | | { |
| 0 | 161 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 162 | | foreach (var item in property.Value.EnumerateArray()) |
| | 163 | | { |
| 0 | 164 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 165 | | } |
| 0 | 166 | | dependsOn = array; |
| 0 | 167 | | continue; |
| | 168 | | } |
| 0 | 169 | | if (property.NameEquals("userProperties")) |
| | 170 | | { |
| 0 | 171 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 172 | | foreach (var item in property.Value.EnumerateArray()) |
| | 173 | | { |
| 0 | 174 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 175 | | } |
| 0 | 176 | | userProperties = array; |
| 0 | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | if (property.NameEquals("typeProperties")) |
| | 180 | | { |
| 0 | 181 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 182 | | { |
| 0 | 183 | | if (property0.NameEquals("method")) |
| | 184 | | { |
| 0 | 185 | | method = new WebActivityMethod(property0.Value.GetString()); |
| 0 | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | if (property0.NameEquals("url")) |
| | 189 | | { |
| 0 | 190 | | url = property0.Value.GetObject(); |
| 0 | 191 | | continue; |
| | 192 | | } |
| 0 | 193 | | if (property0.NameEquals("headers")) |
| | 194 | | { |
| 0 | 195 | | headers = property0.Value.GetObject(); |
| 0 | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | if (property0.NameEquals("body")) |
| | 199 | | { |
| 0 | 200 | | body = property0.Value.GetObject(); |
| 0 | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | if (property0.NameEquals("authentication")) |
| | 204 | | { |
| 0 | 205 | | authentication = WebActivityAuthentication.DeserializeWebActivityAuthentication(property0.Va |
| 0 | 206 | | continue; |
| | 207 | | } |
| 0 | 208 | | if (property0.NameEquals("datasets")) |
| | 209 | | { |
| 0 | 210 | | List<DatasetReference> array = new List<DatasetReference>(); |
| 0 | 211 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 212 | | { |
| 0 | 213 | | array.Add(DatasetReference.DeserializeDatasetReference(item)); |
| | 214 | | } |
| 0 | 215 | | datasets = array; |
| 0 | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | if (property0.NameEquals("linkedServices")) |
| | 219 | | { |
| 0 | 220 | | List<LinkedServiceReference> array = new List<LinkedServiceReference>(); |
| 0 | 221 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 222 | | { |
| 0 | 223 | | array.Add(LinkedServiceReference.DeserializeLinkedServiceReference(item)); |
| | 224 | | } |
| 0 | 225 | | linkedServices = array; |
| 0 | 226 | | continue; |
| | 227 | | } |
| 0 | 228 | | if (property0.NameEquals("connectVia")) |
| | 229 | | { |
| 0 | 230 | | connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property0.Va |
| | 231 | | continue; |
| | 232 | | } |
| | 233 | | } |
| | 234 | | continue; |
| | 235 | | } |
| 0 | 236 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 237 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 238 | | } |
| 0 | 239 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 240 | | return new WebActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(userProper |
| | 241 | | } |
| | 242 | | } |
| | 243 | | } |