| | 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 AzureFunctionActivity : 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("functionName"); |
| 0 | 63 | | writer.WriteObjectValue(FunctionName); |
| 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 | | writer.WriteEndObject(); |
| 0 | 75 | | foreach (var item in AdditionalProperties) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName(item.Key); |
| 0 | 78 | | writer.WriteObjectValue(item.Value); |
| | 79 | | } |
| 0 | 80 | | writer.WriteEndObject(); |
| 0 | 81 | | } |
| | 82 | |
|
| | 83 | | internal static AzureFunctionActivity DeserializeAzureFunctionActivity(JsonElement element) |
| | 84 | | { |
| 0 | 85 | | Optional<LinkedServiceReference> linkedServiceName = default; |
| 0 | 86 | | Optional<ActivityPolicy> policy = default; |
| 0 | 87 | | string name = default; |
| 0 | 88 | | string type = default; |
| 0 | 89 | | Optional<string> description = default; |
| 0 | 90 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 91 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 92 | | AzureFunctionActivityMethod method = default; |
| 0 | 93 | | object functionName = default; |
| 0 | 94 | | Optional<object> headers = default; |
| 0 | 95 | | Optional<object> body = default; |
| 0 | 96 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 97 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 98 | | foreach (var property in element.EnumerateObject()) |
| | 99 | | { |
| 0 | 100 | | if (property.NameEquals("linkedServiceName")) |
| | 101 | | { |
| 0 | 102 | | linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value); |
| 0 | 103 | | continue; |
| | 104 | | } |
| 0 | 105 | | if (property.NameEquals("policy")) |
| | 106 | | { |
| 0 | 107 | | policy = ActivityPolicy.DeserializeActivityPolicy(property.Value); |
| 0 | 108 | | continue; |
| | 109 | | } |
| 0 | 110 | | if (property.NameEquals("name")) |
| | 111 | | { |
| 0 | 112 | | name = property.Value.GetString(); |
| 0 | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | if (property.NameEquals("type")) |
| | 116 | | { |
| 0 | 117 | | type = property.Value.GetString(); |
| 0 | 118 | | continue; |
| | 119 | | } |
| 0 | 120 | | if (property.NameEquals("description")) |
| | 121 | | { |
| 0 | 122 | | description = property.Value.GetString(); |
| 0 | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | if (property.NameEquals("dependsOn")) |
| | 126 | | { |
| 0 | 127 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 128 | | foreach (var item in property.Value.EnumerateArray()) |
| | 129 | | { |
| 0 | 130 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 131 | | } |
| 0 | 132 | | dependsOn = array; |
| 0 | 133 | | continue; |
| | 134 | | } |
| 0 | 135 | | if (property.NameEquals("userProperties")) |
| | 136 | | { |
| 0 | 137 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 138 | | foreach (var item in property.Value.EnumerateArray()) |
| | 139 | | { |
| 0 | 140 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 141 | | } |
| 0 | 142 | | userProperties = array; |
| 0 | 143 | | continue; |
| | 144 | | } |
| 0 | 145 | | if (property.NameEquals("typeProperties")) |
| | 146 | | { |
| 0 | 147 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 148 | | { |
| 0 | 149 | | if (property0.NameEquals("method")) |
| | 150 | | { |
| 0 | 151 | | method = new AzureFunctionActivityMethod(property0.Value.GetString()); |
| 0 | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | if (property0.NameEquals("functionName")) |
| | 155 | | { |
| 0 | 156 | | functionName = property0.Value.GetObject(); |
| 0 | 157 | | continue; |
| | 158 | | } |
| 0 | 159 | | if (property0.NameEquals("headers")) |
| | 160 | | { |
| 0 | 161 | | headers = property0.Value.GetObject(); |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property0.NameEquals("body")) |
| | 165 | | { |
| 0 | 166 | | body = property0.Value.GetObject(); |
| | 167 | | continue; |
| | 168 | | } |
| | 169 | | } |
| | 170 | | continue; |
| | 171 | | } |
| 0 | 172 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 173 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 174 | | } |
| 0 | 175 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 176 | | return new AzureFunctionActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList( |
| | 177 | | } |
| | 178 | | } |
| | 179 | | } |