| | 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; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Resources.Models |
| | 14 | | { |
| | 15 | | public partial class AzureCliScript : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 0 | 19 | | writer.WriteStartObject(); |
| 0 | 20 | | writer.WritePropertyName("identity"); |
| 0 | 21 | | writer.WriteObjectValue(Identity); |
| 0 | 22 | | writer.WritePropertyName("location"); |
| 0 | 23 | | writer.WriteStringValue(Location); |
| 0 | 24 | | if (Tags != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("tags"); |
| 0 | 27 | | writer.WriteStartObject(); |
| 0 | 28 | | foreach (var item in Tags) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName(item.Key); |
| 0 | 31 | | writer.WriteStringValue(item.Value); |
| | 32 | | } |
| 0 | 33 | | writer.WriteEndObject(); |
| | 34 | | } |
| 0 | 35 | | writer.WritePropertyName("kind"); |
| 0 | 36 | | writer.WriteStringValue(Kind.ToString()); |
| 0 | 37 | | if (SystemData != null) |
| | 38 | | { |
| 0 | 39 | | writer.WritePropertyName("systemData"); |
| 0 | 40 | | writer.WriteObjectValue(SystemData); |
| | 41 | | } |
| 0 | 42 | | if (Id != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("id"); |
| 0 | 45 | | writer.WriteStringValue(Id); |
| | 46 | | } |
| 0 | 47 | | if (Name != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("name"); |
| 0 | 50 | | writer.WriteStringValue(Name); |
| | 51 | | } |
| 0 | 52 | | if (Type != null) |
| | 53 | | { |
| 0 | 54 | | writer.WritePropertyName("type"); |
| 0 | 55 | | writer.WriteStringValue(Type); |
| | 56 | | } |
| 0 | 57 | | writer.WritePropertyName("properties"); |
| 0 | 58 | | writer.WriteStartObject(); |
| 0 | 59 | | if (ContainerSettings != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("containerSettings"); |
| 0 | 62 | | writer.WriteObjectValue(ContainerSettings); |
| | 63 | | } |
| 0 | 64 | | if (StorageAccountSettings != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("storageAccountSettings"); |
| 0 | 67 | | writer.WriteObjectValue(StorageAccountSettings); |
| | 68 | | } |
| 0 | 69 | | if (CleanupPreference != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("cleanupPreference"); |
| 0 | 72 | | writer.WriteStringValue(CleanupPreference.Value.ToString()); |
| | 73 | | } |
| 0 | 74 | | if (ProvisioningState != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("provisioningState"); |
| 0 | 77 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 78 | | } |
| 0 | 79 | | if (Status != null) |
| | 80 | | { |
| 0 | 81 | | writer.WritePropertyName("status"); |
| 0 | 82 | | writer.WriteObjectValue(Status); |
| | 83 | | } |
| 0 | 84 | | if (Outputs != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("outputs"); |
| 0 | 87 | | writer.WriteStartObject(); |
| 0 | 88 | | foreach (var item in Outputs) |
| | 89 | | { |
| 0 | 90 | | writer.WritePropertyName(item.Key); |
| 0 | 91 | | writer.WriteObjectValue(item.Value); |
| | 92 | | } |
| 0 | 93 | | writer.WriteEndObject(); |
| | 94 | | } |
| 0 | 95 | | if (PrimaryScriptUri != null) |
| | 96 | | { |
| 0 | 97 | | writer.WritePropertyName("primaryScriptUri"); |
| 0 | 98 | | writer.WriteStringValue(PrimaryScriptUri); |
| | 99 | | } |
| 0 | 100 | | if (SupportingScriptUris != null) |
| | 101 | | { |
| 0 | 102 | | writer.WritePropertyName("supportingScriptUris"); |
| 0 | 103 | | writer.WriteStartArray(); |
| 0 | 104 | | foreach (var item in SupportingScriptUris) |
| | 105 | | { |
| 0 | 106 | | writer.WriteStringValue(item); |
| | 107 | | } |
| 0 | 108 | | writer.WriteEndArray(); |
| | 109 | | } |
| 0 | 110 | | if (ScriptContent != null) |
| | 111 | | { |
| 0 | 112 | | writer.WritePropertyName("scriptContent"); |
| 0 | 113 | | writer.WriteStringValue(ScriptContent); |
| | 114 | | } |
| 0 | 115 | | if (Arguments != null) |
| | 116 | | { |
| 0 | 117 | | writer.WritePropertyName("arguments"); |
| 0 | 118 | | writer.WriteStringValue(Arguments); |
| | 119 | | } |
| 0 | 120 | | if (EnvironmentVariables != null) |
| | 121 | | { |
| 0 | 122 | | writer.WritePropertyName("environmentVariables"); |
| 0 | 123 | | writer.WriteStartArray(); |
| 0 | 124 | | foreach (var item in EnvironmentVariables) |
| | 125 | | { |
| 0 | 126 | | writer.WriteObjectValue(item); |
| | 127 | | } |
| 0 | 128 | | writer.WriteEndArray(); |
| | 129 | | } |
| 0 | 130 | | if (ForceUpdateTag != null) |
| | 131 | | { |
| 0 | 132 | | writer.WritePropertyName("forceUpdateTag"); |
| 0 | 133 | | writer.WriteStringValue(ForceUpdateTag); |
| | 134 | | } |
| 0 | 135 | | writer.WritePropertyName("retentionInterval"); |
| 0 | 136 | | writer.WriteStringValue(RetentionInterval, "P"); |
| 0 | 137 | | if (Timeout != null) |
| | 138 | | { |
| 0 | 139 | | writer.WritePropertyName("timeout"); |
| 0 | 140 | | writer.WriteStringValue(Timeout.Value, "P"); |
| | 141 | | } |
| 0 | 142 | | writer.WritePropertyName("azCliVersion"); |
| 0 | 143 | | writer.WriteStringValue(AzCliVersion); |
| 0 | 144 | | writer.WriteEndObject(); |
| 0 | 145 | | writer.WriteEndObject(); |
| 0 | 146 | | } |
| | 147 | |
|
| | 148 | | internal static AzureCliScript DeserializeAzureCliScript(JsonElement element) |
| | 149 | | { |
| 0 | 150 | | ManagedServiceIdentity identity = default; |
| 0 | 151 | | string location = default; |
| 0 | 152 | | IDictionary<string, string> tags = default; |
| 0 | 153 | | ScriptType kind = default; |
| 0 | 154 | | SystemData systemData = default; |
| 0 | 155 | | string id = default; |
| 0 | 156 | | string name = default; |
| 0 | 157 | | string type = default; |
| 0 | 158 | | ContainerConfiguration containerSettings = default; |
| 0 | 159 | | StorageAccountConfiguration storageAccountSettings = default; |
| 0 | 160 | | CleanupOptions? cleanupPreference = default; |
| 0 | 161 | | ScriptProvisioningState? provisioningState = default; |
| 0 | 162 | | ScriptStatus status = default; |
| 0 | 163 | | IDictionary<string, object> outputs = default; |
| 0 | 164 | | string primaryScriptUri = default; |
| 0 | 165 | | IList<string> supportingScriptUris = default; |
| 0 | 166 | | string scriptContent = default; |
| 0 | 167 | | string arguments = default; |
| 0 | 168 | | IList<EnvironmentVariable> environmentVariables = default; |
| 0 | 169 | | string forceUpdateTag = default; |
| 0 | 170 | | TimeSpan retentionInterval = default; |
| 0 | 171 | | TimeSpan? timeout = default; |
| 0 | 172 | | string azCliVersion = default; |
| 0 | 173 | | foreach (var property in element.EnumerateObject()) |
| | 174 | | { |
| 0 | 175 | | if (property.NameEquals("identity")) |
| | 176 | | { |
| 0 | 177 | | identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); |
| 0 | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | if (property.NameEquals("location")) |
| | 181 | | { |
| 0 | 182 | | location = property.Value.GetString(); |
| 0 | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | if (property.NameEquals("tags")) |
| | 186 | | { |
| 0 | 187 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 188 | | { |
| | 189 | | continue; |
| | 190 | | } |
| 0 | 191 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 192 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 193 | | { |
| 0 | 194 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| 0 | 196 | | dictionary.Add(property0.Name, null); |
| | 197 | | } |
| | 198 | | else |
| | 199 | | { |
| 0 | 200 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 201 | | } |
| | 202 | | } |
| 0 | 203 | | tags = dictionary; |
| 0 | 204 | | continue; |
| | 205 | | } |
| 0 | 206 | | if (property.NameEquals("kind")) |
| | 207 | | { |
| 0 | 208 | | kind = new ScriptType(property.Value.GetString()); |
| 0 | 209 | | continue; |
| | 210 | | } |
| 0 | 211 | | if (property.NameEquals("systemData")) |
| | 212 | | { |
| 0 | 213 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 214 | | { |
| | 215 | | continue; |
| | 216 | | } |
| 0 | 217 | | systemData = SystemData.DeserializeSystemData(property.Value); |
| 0 | 218 | | continue; |
| | 219 | | } |
| 0 | 220 | | if (property.NameEquals("id")) |
| | 221 | | { |
| 0 | 222 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 223 | | { |
| | 224 | | continue; |
| | 225 | | } |
| 0 | 226 | | id = property.Value.GetString(); |
| 0 | 227 | | continue; |
| | 228 | | } |
| 0 | 229 | | if (property.NameEquals("name")) |
| | 230 | | { |
| 0 | 231 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 232 | | { |
| | 233 | | continue; |
| | 234 | | } |
| 0 | 235 | | name = property.Value.GetString(); |
| 0 | 236 | | continue; |
| | 237 | | } |
| 0 | 238 | | if (property.NameEquals("type")) |
| | 239 | | { |
| 0 | 240 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 241 | | { |
| | 242 | | continue; |
| | 243 | | } |
| 0 | 244 | | type = property.Value.GetString(); |
| 0 | 245 | | continue; |
| | 246 | | } |
| 0 | 247 | | if (property.NameEquals("properties")) |
| | 248 | | { |
| 0 | 249 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 250 | | { |
| 0 | 251 | | if (property0.NameEquals("containerSettings")) |
| | 252 | | { |
| 0 | 253 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 254 | | { |
| | 255 | | continue; |
| | 256 | | } |
| 0 | 257 | | containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property0.Value |
| 0 | 258 | | continue; |
| | 259 | | } |
| 0 | 260 | | if (property0.NameEquals("storageAccountSettings")) |
| | 261 | | { |
| 0 | 262 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration( |
| 0 | 267 | | continue; |
| | 268 | | } |
| 0 | 269 | | if (property0.NameEquals("cleanupPreference")) |
| | 270 | | { |
| 0 | 271 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 272 | | { |
| | 273 | | continue; |
| | 274 | | } |
| 0 | 275 | | cleanupPreference = new CleanupOptions(property0.Value.GetString()); |
| 0 | 276 | | continue; |
| | 277 | | } |
| 0 | 278 | | if (property0.NameEquals("provisioningState")) |
| | 279 | | { |
| 0 | 280 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 281 | | { |
| | 282 | | continue; |
| | 283 | | } |
| 0 | 284 | | provisioningState = new ScriptProvisioningState(property0.Value.GetString()); |
| 0 | 285 | | continue; |
| | 286 | | } |
| 0 | 287 | | if (property0.NameEquals("status")) |
| | 288 | | { |
| 0 | 289 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 290 | | { |
| | 291 | | continue; |
| | 292 | | } |
| 0 | 293 | | status = ScriptStatus.DeserializeScriptStatus(property0.Value); |
| 0 | 294 | | continue; |
| | 295 | | } |
| 0 | 296 | | if (property0.NameEquals("outputs")) |
| | 297 | | { |
| 0 | 298 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 299 | | { |
| | 300 | | continue; |
| | 301 | | } |
| 0 | 302 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 303 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 304 | | { |
| 0 | 305 | | if (property1.Value.ValueKind == JsonValueKind.Null) |
| | 306 | | { |
| 0 | 307 | | dictionary.Add(property1.Name, null); |
| | 308 | | } |
| | 309 | | else |
| | 310 | | { |
| 0 | 311 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 312 | | } |
| | 313 | | } |
| 0 | 314 | | outputs = dictionary; |
| 0 | 315 | | continue; |
| | 316 | | } |
| 0 | 317 | | if (property0.NameEquals("primaryScriptUri")) |
| | 318 | | { |
| 0 | 319 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 320 | | { |
| | 321 | | continue; |
| | 322 | | } |
| 0 | 323 | | primaryScriptUri = property0.Value.GetString(); |
| 0 | 324 | | continue; |
| | 325 | | } |
| 0 | 326 | | if (property0.NameEquals("supportingScriptUris")) |
| | 327 | | { |
| 0 | 328 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 329 | | { |
| | 330 | | continue; |
| | 331 | | } |
| 0 | 332 | | List<string> array = new List<string>(); |
| 0 | 333 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 334 | | { |
| 0 | 335 | | if (item.ValueKind == JsonValueKind.Null) |
| | 336 | | { |
| 0 | 337 | | array.Add(null); |
| | 338 | | } |
| | 339 | | else |
| | 340 | | { |
| 0 | 341 | | array.Add(item.GetString()); |
| | 342 | | } |
| | 343 | | } |
| 0 | 344 | | supportingScriptUris = array; |
| 0 | 345 | | continue; |
| | 346 | | } |
| 0 | 347 | | if (property0.NameEquals("scriptContent")) |
| | 348 | | { |
| 0 | 349 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 350 | | { |
| | 351 | | continue; |
| | 352 | | } |
| 0 | 353 | | scriptContent = property0.Value.GetString(); |
| 0 | 354 | | continue; |
| | 355 | | } |
| 0 | 356 | | if (property0.NameEquals("arguments")) |
| | 357 | | { |
| 0 | 358 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 359 | | { |
| | 360 | | continue; |
| | 361 | | } |
| 0 | 362 | | arguments = property0.Value.GetString(); |
| 0 | 363 | | continue; |
| | 364 | | } |
| 0 | 365 | | if (property0.NameEquals("environmentVariables")) |
| | 366 | | { |
| 0 | 367 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 368 | | { |
| | 369 | | continue; |
| | 370 | | } |
| 0 | 371 | | List<EnvironmentVariable> array = new List<EnvironmentVariable>(); |
| 0 | 372 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 373 | | { |
| 0 | 374 | | if (item.ValueKind == JsonValueKind.Null) |
| | 375 | | { |
| 0 | 376 | | array.Add(null); |
| | 377 | | } |
| | 378 | | else |
| | 379 | | { |
| 0 | 380 | | array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); |
| | 381 | | } |
| | 382 | | } |
| 0 | 383 | | environmentVariables = array; |
| 0 | 384 | | continue; |
| | 385 | | } |
| 0 | 386 | | if (property0.NameEquals("forceUpdateTag")) |
| | 387 | | { |
| 0 | 388 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 389 | | { |
| | 390 | | continue; |
| | 391 | | } |
| 0 | 392 | | forceUpdateTag = property0.Value.GetString(); |
| 0 | 393 | | continue; |
| | 394 | | } |
| 0 | 395 | | if (property0.NameEquals("retentionInterval")) |
| | 396 | | { |
| 0 | 397 | | retentionInterval = property0.Value.GetTimeSpan("P"); |
| 0 | 398 | | continue; |
| | 399 | | } |
| 0 | 400 | | if (property0.NameEquals("timeout")) |
| | 401 | | { |
| 0 | 402 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 403 | | { |
| | 404 | | continue; |
| | 405 | | } |
| 0 | 406 | | timeout = property0.Value.GetTimeSpan("P"); |
| 0 | 407 | | continue; |
| | 408 | | } |
| 0 | 409 | | if (property0.NameEquals("azCliVersion")) |
| | 410 | | { |
| 0 | 411 | | azCliVersion = property0.Value.GetString(); |
| | 412 | | continue; |
| | 413 | | } |
| | 414 | | } |
| | 415 | | continue; |
| | 416 | | } |
| | 417 | | } |
| 0 | 418 | | return new AzureCliScript(id, name, type, identity, location, tags, kind, systemData, containerSettings, sto |
| | 419 | | } |
| | 420 | | } |
| | 421 | | } |