| | 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 CustomActivity : 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("command"); |
| 0 | 61 | | writer.WriteObjectValue(Command); |
| 0 | 62 | | if (Optional.IsDefined(ResourceLinkedService)) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("resourceLinkedService"); |
| 0 | 65 | | writer.WriteObjectValue(ResourceLinkedService); |
| | 66 | | } |
| 0 | 67 | | if (Optional.IsDefined(FolderPath)) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("folderPath"); |
| 0 | 70 | | writer.WriteObjectValue(FolderPath); |
| | 71 | | } |
| 0 | 72 | | if (Optional.IsDefined(ReferenceObjects)) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("referenceObjects"); |
| 0 | 75 | | writer.WriteObjectValue(ReferenceObjects); |
| | 76 | | } |
| 0 | 77 | | if (Optional.IsCollectionDefined(ExtendedProperties)) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("extendedProperties"); |
| 0 | 80 | | writer.WriteStartObject(); |
| 0 | 81 | | foreach (var item in ExtendedProperties) |
| | 82 | | { |
| 0 | 83 | | writer.WritePropertyName(item.Key); |
| 0 | 84 | | writer.WriteObjectValue(item.Value); |
| | 85 | | } |
| 0 | 86 | | writer.WriteEndObject(); |
| | 87 | | } |
| 0 | 88 | | if (Optional.IsDefined(RetentionTimeInDays)) |
| | 89 | | { |
| 0 | 90 | | writer.WritePropertyName("retentionTimeInDays"); |
| 0 | 91 | | writer.WriteObjectValue(RetentionTimeInDays); |
| | 92 | | } |
| 0 | 93 | | writer.WriteEndObject(); |
| 0 | 94 | | foreach (var item in AdditionalProperties) |
| | 95 | | { |
| 0 | 96 | | writer.WritePropertyName(item.Key); |
| 0 | 97 | | writer.WriteObjectValue(item.Value); |
| | 98 | | } |
| 0 | 99 | | writer.WriteEndObject(); |
| 0 | 100 | | } |
| | 101 | |
|
| | 102 | | internal static CustomActivity DeserializeCustomActivity(JsonElement element) |
| | 103 | | { |
| 0 | 104 | | Optional<LinkedServiceReference> linkedServiceName = default; |
| 0 | 105 | | Optional<ActivityPolicy> policy = default; |
| 0 | 106 | | string name = default; |
| 0 | 107 | | string type = default; |
| 0 | 108 | | Optional<string> description = default; |
| 0 | 109 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 110 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 111 | | object command = default; |
| 0 | 112 | | Optional<LinkedServiceReference> resourceLinkedService = default; |
| 0 | 113 | | Optional<object> folderPath = default; |
| 0 | 114 | | Optional<CustomActivityReferenceObject> referenceObjects = default; |
| 0 | 115 | | Optional<IDictionary<string, object>> extendedProperties = default; |
| 0 | 116 | | Optional<object> retentionTimeInDays = default; |
| 0 | 117 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 118 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 119 | | foreach (var property in element.EnumerateObject()) |
| | 120 | | { |
| 0 | 121 | | if (property.NameEquals("linkedServiceName")) |
| | 122 | | { |
| 0 | 123 | | linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value); |
| 0 | 124 | | continue; |
| | 125 | | } |
| 0 | 126 | | if (property.NameEquals("policy")) |
| | 127 | | { |
| 0 | 128 | | policy = ActivityPolicy.DeserializeActivityPolicy(property.Value); |
| 0 | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | if (property.NameEquals("name")) |
| | 132 | | { |
| 0 | 133 | | name = property.Value.GetString(); |
| 0 | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | if (property.NameEquals("type")) |
| | 137 | | { |
| 0 | 138 | | type = property.Value.GetString(); |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("description")) |
| | 142 | | { |
| 0 | 143 | | description = property.Value.GetString(); |
| 0 | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | if (property.NameEquals("dependsOn")) |
| | 147 | | { |
| 0 | 148 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 149 | | foreach (var item in property.Value.EnumerateArray()) |
| | 150 | | { |
| 0 | 151 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 152 | | } |
| 0 | 153 | | dependsOn = array; |
| 0 | 154 | | continue; |
| | 155 | | } |
| 0 | 156 | | if (property.NameEquals("userProperties")) |
| | 157 | | { |
| 0 | 158 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 159 | | foreach (var item in property.Value.EnumerateArray()) |
| | 160 | | { |
| 0 | 161 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 162 | | } |
| 0 | 163 | | userProperties = array; |
| 0 | 164 | | continue; |
| | 165 | | } |
| 0 | 166 | | if (property.NameEquals("typeProperties")) |
| | 167 | | { |
| 0 | 168 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 169 | | { |
| 0 | 170 | | if (property0.NameEquals("command")) |
| | 171 | | { |
| 0 | 172 | | command = property0.Value.GetObject(); |
| 0 | 173 | | continue; |
| | 174 | | } |
| 0 | 175 | | if (property0.NameEquals("resourceLinkedService")) |
| | 176 | | { |
| 0 | 177 | | resourceLinkedService = LinkedServiceReference.DeserializeLinkedServiceReference(property0.V |
| 0 | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | if (property0.NameEquals("folderPath")) |
| | 181 | | { |
| 0 | 182 | | folderPath = property0.Value.GetObject(); |
| 0 | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | if (property0.NameEquals("referenceObjects")) |
| | 186 | | { |
| 0 | 187 | | referenceObjects = CustomActivityReferenceObject.DeserializeCustomActivityReferenceObject(pr |
| 0 | 188 | | continue; |
| | 189 | | } |
| 0 | 190 | | if (property0.NameEquals("extendedProperties")) |
| | 191 | | { |
| 0 | 192 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 193 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 194 | | { |
| 0 | 195 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 196 | | } |
| 0 | 197 | | extendedProperties = dictionary; |
| 0 | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | if (property0.NameEquals("retentionTimeInDays")) |
| | 201 | | { |
| 0 | 202 | | retentionTimeInDays = property0.Value.GetObject(); |
| | 203 | | continue; |
| | 204 | | } |
| | 205 | | } |
| | 206 | | continue; |
| | 207 | | } |
| 0 | 208 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 209 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 210 | | } |
| 0 | 211 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 212 | | return new CustomActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(userPro |
| | 213 | | } |
| | 214 | | } |
| | 215 | | } |