| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Resources.Models |
| | 12 | | { |
| | 13 | | public partial class EnvironmentVariable : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("name"); |
| 0 | 19 | | writer.WriteStringValue(Name); |
| 0 | 20 | | if (Value != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("value"); |
| 0 | 23 | | writer.WriteStringValue(Value); |
| | 24 | | } |
| 0 | 25 | | if (SecureValue != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("secureValue"); |
| 0 | 28 | | writer.WriteStringValue(SecureValue); |
| | 29 | | } |
| 0 | 30 | | writer.WriteEndObject(); |
| 0 | 31 | | } |
| | 32 | |
|
| | 33 | | internal static EnvironmentVariable DeserializeEnvironmentVariable(JsonElement element) |
| | 34 | | { |
| 0 | 35 | | string name = default; |
| 0 | 36 | | string value = default; |
| 0 | 37 | | string secureValue = default; |
| 0 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 0 | 40 | | if (property.NameEquals("name")) |
| | 41 | | { |
| 0 | 42 | | name = property.Value.GetString(); |
| 0 | 43 | | continue; |
| | 44 | | } |
| 0 | 45 | | if (property.NameEquals("value")) |
| | 46 | | { |
| 0 | 47 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 48 | | { |
| | 49 | | continue; |
| | 50 | | } |
| 0 | 51 | | value = property.Value.GetString(); |
| 0 | 52 | | continue; |
| | 53 | | } |
| 0 | 54 | | if (property.NameEquals("secureValue")) |
| | 55 | | { |
| 0 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 0 | 60 | | secureValue = property.Value.GetString(); |
| | 61 | | continue; |
| | 62 | | } |
| | 63 | | } |
| 0 | 64 | | return new EnvironmentVariable(name, value, secureValue); |
| | 65 | | } |
| | 66 | | } |
| | 67 | | } |