| | 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 PipelineResource : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("properties"); |
| 0 | 20 | | writer.WriteStartObject(); |
| 0 | 21 | | if (Optional.IsDefined(Description)) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("description"); |
| 0 | 24 | | writer.WriteStringValue(Description); |
| | 25 | | } |
| 0 | 26 | | if (Optional.IsCollectionDefined(Activities)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("activities"); |
| 0 | 29 | | writer.WriteStartArray(); |
| 0 | 30 | | foreach (var item in Activities) |
| | 31 | | { |
| 0 | 32 | | writer.WriteObjectValue(item); |
| | 33 | | } |
| 0 | 34 | | writer.WriteEndArray(); |
| | 35 | | } |
| 0 | 36 | | if (Optional.IsCollectionDefined(Parameters)) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("parameters"); |
| 0 | 39 | | writer.WriteStartObject(); |
| 0 | 40 | | foreach (var item in Parameters) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName(item.Key); |
| 0 | 43 | | writer.WriteObjectValue(item.Value); |
| | 44 | | } |
| 0 | 45 | | writer.WriteEndObject(); |
| | 46 | | } |
| 0 | 47 | | if (Optional.IsCollectionDefined(Variables)) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("variables"); |
| 0 | 50 | | writer.WriteStartObject(); |
| 0 | 51 | | foreach (var item in Variables) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName(item.Key); |
| 0 | 54 | | writer.WriteObjectValue(item.Value); |
| | 55 | | } |
| 0 | 56 | | writer.WriteEndObject(); |
| | 57 | | } |
| 0 | 58 | | if (Optional.IsDefined(Concurrency)) |
| | 59 | | { |
| 0 | 60 | | writer.WritePropertyName("concurrency"); |
| 0 | 61 | | writer.WriteNumberValue(Concurrency.Value); |
| | 62 | | } |
| 0 | 63 | | if (Optional.IsCollectionDefined(Annotations)) |
| | 64 | | { |
| 0 | 65 | | writer.WritePropertyName("annotations"); |
| 0 | 66 | | writer.WriteStartArray(); |
| 0 | 67 | | foreach (var item in Annotations) |
| | 68 | | { |
| 0 | 69 | | writer.WriteObjectValue(item); |
| | 70 | | } |
| 0 | 71 | | writer.WriteEndArray(); |
| | 72 | | } |
| 0 | 73 | | if (Optional.IsCollectionDefined(RunDimensions)) |
| | 74 | | { |
| 0 | 75 | | writer.WritePropertyName("runDimensions"); |
| 0 | 76 | | writer.WriteStartObject(); |
| 0 | 77 | | foreach (var item in RunDimensions) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName(item.Key); |
| 0 | 80 | | writer.WriteObjectValue(item.Value); |
| | 81 | | } |
| 0 | 82 | | writer.WriteEndObject(); |
| | 83 | | } |
| 0 | 84 | | if (Optional.IsDefined(Folder)) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("folder"); |
| 0 | 87 | | writer.WriteObjectValue(Folder); |
| | 88 | | } |
| 0 | 89 | | writer.WriteEndObject(); |
| 0 | 90 | | foreach (var item in AdditionalProperties) |
| | 91 | | { |
| 0 | 92 | | writer.WritePropertyName(item.Key); |
| 0 | 93 | | writer.WriteObjectValue(item.Value); |
| | 94 | | } |
| 0 | 95 | | writer.WriteEndObject(); |
| 0 | 96 | | } |
| | 97 | |
|
| | 98 | | internal static PipelineResource DeserializePipelineResource(JsonElement element) |
| | 99 | | { |
| 8 | 100 | | Optional<string> id = default; |
| 8 | 101 | | Optional<string> name = default; |
| 8 | 102 | | Optional<string> type = default; |
| 8 | 103 | | Optional<string> etag = default; |
| 8 | 104 | | Optional<string> description = default; |
| 8 | 105 | | Optional<IList<Activity>> activities = default; |
| 8 | 106 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 8 | 107 | | Optional<IDictionary<string, VariableSpecification>> variables = default; |
| 8 | 108 | | Optional<int> concurrency = default; |
| 8 | 109 | | Optional<IList<object>> annotations = default; |
| 8 | 110 | | Optional<IDictionary<string, object>> runDimensions = default; |
| 8 | 111 | | Optional<PipelineFolder> folder = default; |
| 8 | 112 | | IDictionary<string, object> additionalProperties = default; |
| 8 | 113 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 96 | 114 | | foreach (var property in element.EnumerateObject()) |
| | 115 | | { |
| 40 | 116 | | if (property.NameEquals("id")) |
| | 117 | | { |
| 8 | 118 | | id = property.Value.GetString(); |
| 8 | 119 | | continue; |
| | 120 | | } |
| 32 | 121 | | if (property.NameEquals("name")) |
| | 122 | | { |
| 8 | 123 | | name = property.Value.GetString(); |
| 8 | 124 | | continue; |
| | 125 | | } |
| 24 | 126 | | if (property.NameEquals("type")) |
| | 127 | | { |
| 8 | 128 | | type = property.Value.GetString(); |
| 8 | 129 | | continue; |
| | 130 | | } |
| 16 | 131 | | if (property.NameEquals("etag")) |
| | 132 | | { |
| 8 | 133 | | etag = property.Value.GetString(); |
| 8 | 134 | | continue; |
| | 135 | | } |
| 8 | 136 | | if (property.NameEquals("properties")) |
| | 137 | | { |
| 48 | 138 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 139 | | { |
| 16 | 140 | | if (property0.NameEquals("description")) |
| | 141 | | { |
| 0 | 142 | | description = property0.Value.GetString(); |
| 0 | 143 | | continue; |
| | 144 | | } |
| 16 | 145 | | if (property0.NameEquals("activities")) |
| | 146 | | { |
| 8 | 147 | | List<Activity> array = new List<Activity>(); |
| 32 | 148 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 149 | | { |
| 8 | 150 | | array.Add(Activity.DeserializeActivity(item)); |
| | 151 | | } |
| 8 | 152 | | activities = array; |
| 8 | 153 | | continue; |
| | 154 | | } |
| 8 | 155 | | if (property0.NameEquals("parameters")) |
| | 156 | | { |
| 0 | 157 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpec |
| 0 | 158 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 159 | | { |
| 0 | 160 | | dictionary.Add(property1.Name, ParameterSpecification.DeserializeParameterSpecification( |
| | 161 | | } |
| 0 | 162 | | parameters = dictionary; |
| 0 | 163 | | continue; |
| | 164 | | } |
| 8 | 165 | | if (property0.NameEquals("variables")) |
| | 166 | | { |
| 0 | 167 | | Dictionary<string, VariableSpecification> dictionary = new Dictionary<string, VariableSpecif |
| 0 | 168 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 169 | | { |
| 0 | 170 | | dictionary.Add(property1.Name, VariableSpecification.DeserializeVariableSpecification(pr |
| | 171 | | } |
| 0 | 172 | | variables = dictionary; |
| 0 | 173 | | continue; |
| | 174 | | } |
| 8 | 175 | | if (property0.NameEquals("concurrency")) |
| | 176 | | { |
| 0 | 177 | | concurrency = property0.Value.GetInt32(); |
| 0 | 178 | | continue; |
| | 179 | | } |
| 8 | 180 | | if (property0.NameEquals("annotations")) |
| | 181 | | { |
| 8 | 182 | | List<object> array = new List<object>(); |
| 0 | 183 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 184 | | { |
| 0 | 185 | | array.Add(item.GetObject()); |
| | 186 | | } |
| 8 | 187 | | annotations = array; |
| 8 | 188 | | continue; |
| | 189 | | } |
| 0 | 190 | | if (property0.NameEquals("runDimensions")) |
| | 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 | | runDimensions = dictionary; |
| 0 | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | if (property0.NameEquals("folder")) |
| | 201 | | { |
| 0 | 202 | | folder = PipelineFolder.DeserializePipelineFolder(property0.Value); |
| | 203 | | continue; |
| | 204 | | } |
| | 205 | | } |
| | 206 | | continue; |
| | 207 | | } |
| 0 | 208 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 209 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 210 | | } |
| 8 | 211 | | additionalProperties = additionalPropertiesDictionary; |
| 8 | 212 | | return new PipelineResource(id.Value, name.Value, type.Value, etag.Value, description.Value, Optional.ToList |
| | 213 | | } |
| | 214 | | } |
| | 215 | | } |