| | 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 ServiceEndpointPolicyDefinition : 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 (Id != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("id"); |
| 0 | 32 | | writer.WriteStringValue(Id); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("properties"); |
| 0 | 35 | | writer.WriteStartObject(); |
| 0 | 36 | | if (Description != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("description"); |
| 0 | 39 | | writer.WriteStringValue(Description); |
| | 40 | | } |
| 0 | 41 | | if (Service != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("service"); |
| 0 | 44 | | writer.WriteStringValue(Service); |
| | 45 | | } |
| 0 | 46 | | if (ServiceResources != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("serviceResources"); |
| 0 | 49 | | writer.WriteStartArray(); |
| 0 | 50 | | foreach (var item in ServiceResources) |
| | 51 | | { |
| 0 | 52 | | writer.WriteStringValue(item); |
| | 53 | | } |
| 0 | 54 | | writer.WriteEndArray(); |
| | 55 | | } |
| 0 | 56 | | if (ProvisioningState != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("provisioningState"); |
| 0 | 59 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 60 | | } |
| 0 | 61 | | writer.WriteEndObject(); |
| 0 | 62 | | writer.WriteEndObject(); |
| 0 | 63 | | } |
| | 64 | |
|
| | 65 | | internal static ServiceEndpointPolicyDefinition DeserializeServiceEndpointPolicyDefinition(JsonElement element) |
| | 66 | | { |
| 0 | 67 | | string name = default; |
| 0 | 68 | | string etag = default; |
| 0 | 69 | | string id = default; |
| 0 | 70 | | string description = default; |
| 0 | 71 | | string service = default; |
| 0 | 72 | | IList<string> serviceResources = default; |
| 0 | 73 | | ProvisioningState? provisioningState = default; |
| 0 | 74 | | foreach (var property in element.EnumerateObject()) |
| | 75 | | { |
| 0 | 76 | | if (property.NameEquals("name")) |
| | 77 | | { |
| 0 | 78 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 79 | | { |
| | 80 | | continue; |
| | 81 | | } |
| 0 | 82 | | name = property.Value.GetString(); |
| 0 | 83 | | continue; |
| | 84 | | } |
| 0 | 85 | | if (property.NameEquals("etag")) |
| | 86 | | { |
| 0 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | etag = property.Value.GetString(); |
| 0 | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | if (property.NameEquals("id")) |
| | 95 | | { |
| 0 | 96 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 97 | | { |
| | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | id = property.Value.GetString(); |
| 0 | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | if (property.NameEquals("properties")) |
| | 104 | | { |
| 0 | 105 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 106 | | { |
| 0 | 107 | | if (property0.NameEquals("description")) |
| | 108 | | { |
| 0 | 109 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 110 | | { |
| | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | description = property0.Value.GetString(); |
| 0 | 114 | | continue; |
| | 115 | | } |
| 0 | 116 | | if (property0.NameEquals("service")) |
| | 117 | | { |
| 0 | 118 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | service = property0.Value.GetString(); |
| 0 | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | if (property0.NameEquals("serviceResources")) |
| | 126 | | { |
| 0 | 127 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | List<string> array = new List<string>(); |
| 0 | 132 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 133 | | { |
| 0 | 134 | | if (item.ValueKind == JsonValueKind.Null) |
| | 135 | | { |
| 0 | 136 | | array.Add(null); |
| | 137 | | } |
| | 138 | | else |
| | 139 | | { |
| 0 | 140 | | array.Add(item.GetString()); |
| | 141 | | } |
| | 142 | | } |
| 0 | 143 | | serviceResources = array; |
| 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()); |
| | 153 | | continue; |
| | 154 | | } |
| | 155 | | } |
| | 156 | | continue; |
| | 157 | | } |
| | 158 | | } |
| 0 | 159 | | return new ServiceEndpointPolicyDefinition(id, name, etag, description, service, serviceResources, provision |
| | 160 | | } |
| | 161 | | } |
| | 162 | | } |