| | 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 AzureMLBatchExecutionActivity : 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 | | if (Optional.IsCollectionDefined(GlobalParameters)) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("globalParameters"); |
| 0 | 63 | | writer.WriteStartObject(); |
| 0 | 64 | | foreach (var item in GlobalParameters) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName(item.Key); |
| 0 | 67 | | writer.WriteObjectValue(item.Value); |
| | 68 | | } |
| 0 | 69 | | writer.WriteEndObject(); |
| | 70 | | } |
| 0 | 71 | | if (Optional.IsCollectionDefined(WebServiceOutputs)) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("webServiceOutputs"); |
| 0 | 74 | | writer.WriteStartObject(); |
| 0 | 75 | | foreach (var item in WebServiceOutputs) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName(item.Key); |
| 0 | 78 | | writer.WriteObjectValue(item.Value); |
| | 79 | | } |
| 0 | 80 | | writer.WriteEndObject(); |
| | 81 | | } |
| 0 | 82 | | if (Optional.IsCollectionDefined(WebServiceInputs)) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("webServiceInputs"); |
| 0 | 85 | | writer.WriteStartObject(); |
| 0 | 86 | | foreach (var item in WebServiceInputs) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName(item.Key); |
| 0 | 89 | | writer.WriteObjectValue(item.Value); |
| | 90 | | } |
| 0 | 91 | | writer.WriteEndObject(); |
| | 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 AzureMLBatchExecutionActivity DeserializeAzureMLBatchExecutionActivity(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 | | Optional<IDictionary<string, object>> globalParameters = default; |
| 0 | 112 | | Optional<IDictionary<string, AzureMLWebServiceFile>> webServiceOutputs = default; |
| 0 | 113 | | Optional<IDictionary<string, AzureMLWebServiceFile>> webServiceInputs = default; |
| 0 | 114 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 115 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 116 | | foreach (var property in element.EnumerateObject()) |
| | 117 | | { |
| 0 | 118 | | if (property.NameEquals("linkedServiceName")) |
| | 119 | | { |
| 0 | 120 | | linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value); |
| 0 | 121 | | continue; |
| | 122 | | } |
| 0 | 123 | | if (property.NameEquals("policy")) |
| | 124 | | { |
| 0 | 125 | | policy = ActivityPolicy.DeserializeActivityPolicy(property.Value); |
| 0 | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | if (property.NameEquals("name")) |
| | 129 | | { |
| 0 | 130 | | name = property.Value.GetString(); |
| 0 | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | if (property.NameEquals("type")) |
| | 134 | | { |
| 0 | 135 | | type = property.Value.GetString(); |
| 0 | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | if (property.NameEquals("description")) |
| | 139 | | { |
| 0 | 140 | | description = property.Value.GetString(); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property.NameEquals("dependsOn")) |
| | 144 | | { |
| 0 | 145 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 146 | | foreach (var item in property.Value.EnumerateArray()) |
| | 147 | | { |
| 0 | 148 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 149 | | } |
| 0 | 150 | | dependsOn = array; |
| 0 | 151 | | continue; |
| | 152 | | } |
| 0 | 153 | | if (property.NameEquals("userProperties")) |
| | 154 | | { |
| 0 | 155 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 156 | | foreach (var item in property.Value.EnumerateArray()) |
| | 157 | | { |
| 0 | 158 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 159 | | } |
| 0 | 160 | | userProperties = array; |
| 0 | 161 | | continue; |
| | 162 | | } |
| 0 | 163 | | if (property.NameEquals("typeProperties")) |
| | 164 | | { |
| 0 | 165 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 166 | | { |
| 0 | 167 | | if (property0.NameEquals("globalParameters")) |
| | 168 | | { |
| 0 | 169 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 170 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 171 | | { |
| 0 | 172 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 173 | | } |
| 0 | 174 | | globalParameters = dictionary; |
| 0 | 175 | | continue; |
| | 176 | | } |
| 0 | 177 | | if (property0.NameEquals("webServiceOutputs")) |
| | 178 | | { |
| 0 | 179 | | Dictionary<string, AzureMLWebServiceFile> dictionary = new Dictionary<string, AzureMLWebServ |
| 0 | 180 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 181 | | { |
| 0 | 182 | | dictionary.Add(property1.Name, AzureMLWebServiceFile.DeserializeAzureMLWebServiceFile(pr |
| | 183 | | } |
| 0 | 184 | | webServiceOutputs = dictionary; |
| 0 | 185 | | continue; |
| | 186 | | } |
| 0 | 187 | | if (property0.NameEquals("webServiceInputs")) |
| | 188 | | { |
| 0 | 189 | | Dictionary<string, AzureMLWebServiceFile> dictionary = new Dictionary<string, AzureMLWebServ |
| 0 | 190 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 191 | | { |
| 0 | 192 | | dictionary.Add(property1.Name, AzureMLWebServiceFile.DeserializeAzureMLWebServiceFile(pr |
| | 193 | | } |
| 0 | 194 | | webServiceInputs = dictionary; |
| | 195 | | continue; |
| | 196 | | } |
| | 197 | | } |
| | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 201 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 202 | | } |
| 0 | 203 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 204 | | return new AzureMLBatchExecutionActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional |
| | 205 | | } |
| | 206 | | } |
| | 207 | | } |