| | 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 PolicyDefinitionGroup : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 8 | 17 | | writer.WriteStartObject(); |
| 8 | 18 | | writer.WritePropertyName("name"); |
| 8 | 19 | | writer.WriteStringValue(Name); |
| 8 | 20 | | if (DisplayName != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("displayName"); |
| 0 | 23 | | writer.WriteStringValue(DisplayName); |
| | 24 | | } |
| 8 | 25 | | if (Category != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("category"); |
| 0 | 28 | | writer.WriteStringValue(Category); |
| | 29 | | } |
| 8 | 30 | | if (Description != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("description"); |
| 0 | 33 | | writer.WriteStringValue(Description); |
| | 34 | | } |
| 8 | 35 | | if (AdditionalMetadataId != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("additionalMetadataId"); |
| 0 | 38 | | writer.WriteStringValue(AdditionalMetadataId); |
| | 39 | | } |
| 8 | 40 | | writer.WriteEndObject(); |
| 8 | 41 | | } |
| | 42 | |
|
| | 43 | | internal static PolicyDefinitionGroup DeserializePolicyDefinitionGroup(JsonElement element) |
| | 44 | | { |
| 17392 | 45 | | string name = default; |
| 17392 | 46 | | string displayName = default; |
| 17392 | 47 | | string category = default; |
| 17392 | 48 | | string description = default; |
| 17392 | 49 | | string additionalMetadataId = default; |
| 104320 | 50 | | foreach (var property in element.EnumerateObject()) |
| | 51 | | { |
| 34768 | 52 | | if (property.NameEquals("name")) |
| | 53 | | { |
| 17392 | 54 | | name = property.Value.GetString(); |
| 17392 | 55 | | continue; |
| | 56 | | } |
| 17376 | 57 | | if (property.NameEquals("displayName")) |
| | 58 | | { |
| 0 | 59 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 60 | | { |
| | 61 | | continue; |
| | 62 | | } |
| 0 | 63 | | displayName = property.Value.GetString(); |
| 0 | 64 | | continue; |
| | 65 | | } |
| 17376 | 66 | | if (property.NameEquals("category")) |
| | 67 | | { |
| 0 | 68 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 69 | | { |
| | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | category = property.Value.GetString(); |
| 0 | 73 | | continue; |
| | 74 | | } |
| 17376 | 75 | | if (property.NameEquals("description")) |
| | 76 | | { |
| 0 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 78 | | { |
| | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | description = property.Value.GetString(); |
| 0 | 82 | | continue; |
| | 83 | | } |
| 17376 | 84 | | if (property.NameEquals("additionalMetadataId")) |
| | 85 | | { |
| 17376 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 17376 | 90 | | additionalMetadataId = property.Value.GetString(); |
| | 91 | | continue; |
| | 92 | | } |
| | 93 | | } |
| 17392 | 94 | | return new PolicyDefinitionGroup(name, displayName, category, description, additionalMetadataId); |
| | 95 | | } |
| | 96 | | } |
| | 97 | | } |