| | 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.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class EncryptionScope : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (Id != null) |
| | 20 | | { |
| 4 | 21 | | writer.WritePropertyName("id"); |
| 4 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 16 | 24 | | if (Name != null) |
| | 25 | | { |
| 4 | 26 | | writer.WritePropertyName("name"); |
| 4 | 27 | | writer.WriteStringValue(Name); |
| | 28 | | } |
| 16 | 29 | | if (Type != null) |
| | 30 | | { |
| 4 | 31 | | writer.WritePropertyName("type"); |
| 4 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 16 | 34 | | writer.WritePropertyName("properties"); |
| 16 | 35 | | writer.WriteStartObject(); |
| 16 | 36 | | if (Source != null) |
| | 37 | | { |
| 16 | 38 | | writer.WritePropertyName("source"); |
| 16 | 39 | | writer.WriteStringValue(Source.Value.ToString()); |
| | 40 | | } |
| 16 | 41 | | if (State != null) |
| | 42 | | { |
| 16 | 43 | | writer.WritePropertyName("state"); |
| 16 | 44 | | writer.WriteStringValue(State.Value.ToString()); |
| | 45 | | } |
| 16 | 46 | | if (CreationTime != null) |
| | 47 | | { |
| 4 | 48 | | writer.WritePropertyName("creationTime"); |
| 4 | 49 | | writer.WriteStringValue(CreationTime.Value, "O"); |
| | 50 | | } |
| 16 | 51 | | if (LastModifiedTime != null) |
| | 52 | | { |
| 4 | 53 | | writer.WritePropertyName("lastModifiedTime"); |
| 4 | 54 | | writer.WriteStringValue(LastModifiedTime.Value, "O"); |
| | 55 | | } |
| 16 | 56 | | if (KeyVaultProperties != null) |
| | 57 | | { |
| 4 | 58 | | writer.WritePropertyName("keyVaultProperties"); |
| 4 | 59 | | writer.WriteObjectValue(KeyVaultProperties); |
| | 60 | | } |
| 16 | 61 | | writer.WriteEndObject(); |
| 16 | 62 | | writer.WriteEndObject(); |
| 16 | 63 | | } |
| | 64 | |
|
| | 65 | | internal static EncryptionScope DeserializeEncryptionScope(JsonElement element) |
| | 66 | | { |
| 24 | 67 | | string id = default; |
| 24 | 68 | | string name = default; |
| 24 | 69 | | string type = default; |
| 24 | 70 | | EncryptionScopeSource? source = default; |
| 24 | 71 | | EncryptionScopeState? state = default; |
| 24 | 72 | | DateTimeOffset? creationTime = default; |
| 24 | 73 | | DateTimeOffset? lastModifiedTime = default; |
| 24 | 74 | | EncryptionScopeKeyVaultProperties keyVaultProperties = default; |
| 240 | 75 | | foreach (var property in element.EnumerateObject()) |
| | 76 | | { |
| 96 | 77 | | if (property.NameEquals("id")) |
| | 78 | | { |
| 24 | 79 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 80 | | { |
| | 81 | | continue; |
| | 82 | | } |
| 24 | 83 | | id = property.Value.GetString(); |
| 24 | 84 | | continue; |
| | 85 | | } |
| 72 | 86 | | if (property.NameEquals("name")) |
| | 87 | | { |
| 24 | 88 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| | 90 | | continue; |
| | 91 | | } |
| 24 | 92 | | name = property.Value.GetString(); |
| 24 | 93 | | continue; |
| | 94 | | } |
| 48 | 95 | | if (property.NameEquals("type")) |
| | 96 | | { |
| 24 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 24 | 101 | | type = property.Value.GetString(); |
| 24 | 102 | | continue; |
| | 103 | | } |
| 24 | 104 | | if (property.NameEquals("properties")) |
| | 105 | | { |
| 288 | 106 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 107 | | { |
| 120 | 108 | | if (property0.NameEquals("source")) |
| | 109 | | { |
| 24 | 110 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 111 | | { |
| | 112 | | continue; |
| | 113 | | } |
| 24 | 114 | | source = new EncryptionScopeSource(property0.Value.GetString()); |
| 24 | 115 | | continue; |
| | 116 | | } |
| 96 | 117 | | if (property0.NameEquals("state")) |
| | 118 | | { |
| 24 | 119 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 120 | | { |
| | 121 | | continue; |
| | 122 | | } |
| 24 | 123 | | state = new EncryptionScopeState(property0.Value.GetString()); |
| 24 | 124 | | continue; |
| | 125 | | } |
| 72 | 126 | | if (property0.NameEquals("creationTime")) |
| | 127 | | { |
| 24 | 128 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 129 | | { |
| | 130 | | continue; |
| | 131 | | } |
| 24 | 132 | | creationTime = property0.Value.GetDateTimeOffset("O"); |
| 24 | 133 | | continue; |
| | 134 | | } |
| 48 | 135 | | if (property0.NameEquals("lastModifiedTime")) |
| | 136 | | { |
| 24 | 137 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 138 | | { |
| | 139 | | continue; |
| | 140 | | } |
| 24 | 141 | | lastModifiedTime = property0.Value.GetDateTimeOffset("O"); |
| 24 | 142 | | continue; |
| | 143 | | } |
| 24 | 144 | | if (property0.NameEquals("keyVaultProperties")) |
| | 145 | | { |
| 24 | 146 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 147 | | { |
| | 148 | | continue; |
| | 149 | | } |
| 24 | 150 | | keyVaultProperties = EncryptionScopeKeyVaultProperties.DeserializeEncryptionScopeKeyVaultPro |
| | 151 | | continue; |
| | 152 | | } |
| | 153 | | } |
| | 154 | | continue; |
| | 155 | | } |
| | 156 | | } |
| 24 | 157 | | return new EncryptionScope(id, name, type, source, state, creationTime, lastModifiedTime, keyVaultProperties |
| | 158 | | } |
| | 159 | | } |
| | 160 | | } |