| | 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.EventHubs.Models |
| | 12 | | { |
| | 13 | | public partial class ArmDisasterRecovery : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 16 | 17 | | writer.WriteStartObject(); |
| 16 | 18 | | if (Id != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("id"); |
| 0 | 21 | | writer.WriteStringValue(Id); |
| | 22 | | } |
| 16 | 23 | | if (Name != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("name"); |
| 0 | 26 | | writer.WriteStringValue(Name); |
| | 27 | | } |
| 16 | 28 | | if (Type != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("type"); |
| 0 | 31 | | writer.WriteStringValue(Type); |
| | 32 | | } |
| 16 | 33 | | writer.WritePropertyName("properties"); |
| 16 | 34 | | writer.WriteStartObject(); |
| 16 | 35 | | if (ProvisioningState != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("provisioningState"); |
| 0 | 38 | | writer.WriteStringValue(ProvisioningState.Value.ToSerialString()); |
| | 39 | | } |
| 16 | 40 | | if (PartnerNamespace != null) |
| | 41 | | { |
| 16 | 42 | | writer.WritePropertyName("partnerNamespace"); |
| 16 | 43 | | writer.WriteStringValue(PartnerNamespace); |
| | 44 | | } |
| 16 | 45 | | if (AlternateName != null) |
| | 46 | | { |
| 8 | 47 | | writer.WritePropertyName("alternateName"); |
| 8 | 48 | | writer.WriteStringValue(AlternateName); |
| | 49 | | } |
| 16 | 50 | | if (Role != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("role"); |
| 0 | 53 | | writer.WriteStringValue(Role.Value.ToSerialString()); |
| | 54 | | } |
| 16 | 55 | | if (PendingReplicationOperationsCount != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("pendingReplicationOperationsCount"); |
| 0 | 58 | | writer.WriteNumberValue(PendingReplicationOperationsCount.Value); |
| | 59 | | } |
| 16 | 60 | | writer.WriteEndObject(); |
| 16 | 61 | | writer.WriteEndObject(); |
| 16 | 62 | | } |
| | 63 | |
|
| | 64 | | internal static ArmDisasterRecovery DeserializeArmDisasterRecovery(JsonElement element) |
| | 65 | | { |
| 6072 | 66 | | string id = default; |
| 6072 | 67 | | string name = default; |
| 6072 | 68 | | string type = default; |
| 6072 | 69 | | ProvisioningStateDR? provisioningState = default; |
| 6072 | 70 | | string partnerNamespace = default; |
| 6072 | 71 | | string alternateName = default; |
| 6072 | 72 | | RoleDisasterRecovery? role = default; |
| 6072 | 73 | | long? pendingReplicationOperationsCount = default; |
| 60720 | 74 | | foreach (var property in element.EnumerateObject()) |
| | 75 | | { |
| 24288 | 76 | | if (property.NameEquals("id")) |
| | 77 | | { |
| 6072 | 78 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 79 | | { |
| | 80 | | continue; |
| | 81 | | } |
| 6072 | 82 | | id = property.Value.GetString(); |
| 6072 | 83 | | continue; |
| | 84 | | } |
| 18216 | 85 | | if (property.NameEquals("name")) |
| | 86 | | { |
| 6072 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| | 89 | | continue; |
| | 90 | | } |
| 6072 | 91 | | name = property.Value.GetString(); |
| 6072 | 92 | | continue; |
| | 93 | | } |
| 12144 | 94 | | if (property.NameEquals("type")) |
| | 95 | | { |
| 6072 | 96 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 97 | | { |
| | 98 | | continue; |
| | 99 | | } |
| 6072 | 100 | | type = property.Value.GetString(); |
| 6072 | 101 | | continue; |
| | 102 | | } |
| 6072 | 103 | | if (property.NameEquals("properties")) |
| | 104 | | { |
| 68568 | 105 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 106 | | { |
| 28212 | 107 | | if (property0.NameEquals("provisioningState")) |
| | 108 | | { |
| 6072 | 109 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 110 | | { |
| | 111 | | continue; |
| | 112 | | } |
| 6072 | 113 | | provisioningState = property0.Value.GetString().ToProvisioningStateDR(); |
| 6072 | 114 | | continue; |
| | 115 | | } |
| 22140 | 116 | | if (property0.NameEquals("partnerNamespace")) |
| | 117 | | { |
| 6072 | 118 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 6072 | 122 | | partnerNamespace = property0.Value.GetString(); |
| 6072 | 123 | | continue; |
| | 124 | | } |
| 16068 | 125 | | if (property0.NameEquals("alternateName")) |
| | 126 | | { |
| 3900 | 127 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 3900 | 131 | | alternateName = property0.Value.GetString(); |
| 3900 | 132 | | continue; |
| | 133 | | } |
| 12168 | 134 | | if (property0.NameEquals("role")) |
| | 135 | | { |
| 6072 | 136 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 6072 | 140 | | role = property0.Value.GetString().ToRoleDisasterRecovery(); |
| 6072 | 141 | | continue; |
| | 142 | | } |
| 6096 | 143 | | if (property0.NameEquals("pendingReplicationOperationsCount")) |
| | 144 | | { |
| 24 | 145 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 24 | 149 | | pendingReplicationOperationsCount = property0.Value.GetInt64(); |
| | 150 | | continue; |
| | 151 | | } |
| | 152 | | } |
| | 153 | | continue; |
| | 154 | | } |
| | 155 | | } |
| 6072 | 156 | | return new ArmDisasterRecovery(id, name, type, provisioningState, partnerNamespace, alternateName, role, pen |
| | 157 | | } |
| | 158 | | } |
| | 159 | | } |