| | 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.ResourceManager.Network.Models |
| | 13 | | { |
| | 14 | | public partial class ServiceAssociationLink : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Name != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("name"); |
| 0 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 0 | 24 | | if (Etag != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("etag"); |
| 0 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | writer.WritePropertyName("properties"); |
| 0 | 40 | | writer.WriteStartObject(); |
| 0 | 41 | | if (LinkedResourceType != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("linkedResourceType"); |
| 0 | 44 | | writer.WriteStringValue(LinkedResourceType); |
| | 45 | | } |
| 0 | 46 | | if (Link != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("link"); |
| 0 | 49 | | writer.WriteStringValue(Link); |
| | 50 | | } |
| 0 | 51 | | if (ProvisioningState != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("provisioningState"); |
| 0 | 54 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 55 | | } |
| 0 | 56 | | if (AllowDelete != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("allowDelete"); |
| 0 | 59 | | writer.WriteBooleanValue(AllowDelete.Value); |
| | 60 | | } |
| 0 | 61 | | if (Locations != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("locations"); |
| 0 | 64 | | writer.WriteStartArray(); |
| 0 | 65 | | foreach (var item in Locations) |
| | 66 | | { |
| 0 | 67 | | writer.WriteStringValue(item); |
| | 68 | | } |
| 0 | 69 | | writer.WriteEndArray(); |
| | 70 | | } |
| 0 | 71 | | writer.WriteEndObject(); |
| 0 | 72 | | writer.WriteEndObject(); |
| 0 | 73 | | } |
| | 74 | |
|
| | 75 | | internal static ServiceAssociationLink DeserializeServiceAssociationLink(JsonElement element) |
| | 76 | | { |
| 0 | 77 | | string name = default; |
| 0 | 78 | | string etag = default; |
| 0 | 79 | | string type = default; |
| 0 | 80 | | string id = default; |
| 0 | 81 | | string linkedResourceType = default; |
| 0 | 82 | | string link = default; |
| 0 | 83 | | ProvisioningState? provisioningState = default; |
| 0 | 84 | | bool? allowDelete = default; |
| 0 | 85 | | IList<string> locations = default; |
| 0 | 86 | | foreach (var property in element.EnumerateObject()) |
| | 87 | | { |
| 0 | 88 | | if (property.NameEquals("name")) |
| | 89 | | { |
| 0 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | name = property.Value.GetString(); |
| 0 | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | if (property.NameEquals("etag")) |
| | 98 | | { |
| 0 | 99 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 100 | | { |
| | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | etag = property.Value.GetString(); |
| 0 | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | if (property.NameEquals("type")) |
| | 107 | | { |
| 0 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | type = property.Value.GetString(); |
| 0 | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | if (property.NameEquals("id")) |
| | 116 | | { |
| 0 | 117 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 118 | | { |
| | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | id = property.Value.GetString(); |
| 0 | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | if (property.NameEquals("properties")) |
| | 125 | | { |
| 0 | 126 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 127 | | { |
| 0 | 128 | | if (property0.NameEquals("linkedResourceType")) |
| | 129 | | { |
| 0 | 130 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | linkedResourceType = property0.Value.GetString(); |
| 0 | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | if (property0.NameEquals("link")) |
| | 138 | | { |
| 0 | 139 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | link = property0.Value.GetString(); |
| 0 | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | if (property0.NameEquals("provisioningState")) |
| | 147 | | { |
| 0 | 148 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | if (property0.NameEquals("allowDelete")) |
| | 156 | | { |
| 0 | 157 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | allowDelete = property0.Value.GetBoolean(); |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property0.NameEquals("locations")) |
| | 165 | | { |
| 0 | 166 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | List<string> array = new List<string>(); |
| 0 | 171 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 172 | | { |
| 0 | 173 | | if (item.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| 0 | 175 | | array.Add(null); |
| | 176 | | } |
| | 177 | | else |
| | 178 | | { |
| 0 | 179 | | array.Add(item.GetString()); |
| | 180 | | } |
| | 181 | | } |
| 0 | 182 | | locations = array; |
| | 183 | | continue; |
| | 184 | | } |
| | 185 | | } |
| | 186 | | continue; |
| | 187 | | } |
| | 188 | | } |
| 0 | 189 | | return new ServiceAssociationLink(id, name, etag, type, linkedResourceType, link, provisioningState, allowDe |
| | 190 | | } |
| | 191 | | } |
| | 192 | | } |