Beispiel #1
0
        internal static ManagementPolicyAction DeserializeManagementPolicyAction(JsonElement element)
        {
            Optional <ManagementPolicyBaseBlob> baseBlob = default;
            Optional <ManagementPolicySnapShot> snapshot = default;
            Optional <ManagementPolicyVersion>  version  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("baseBlob"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    baseBlob = ManagementPolicyBaseBlob.DeserializeManagementPolicyBaseBlob(property.Value);
                    continue;
                }
                if (property.NameEquals("snapshot"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    snapshot = ManagementPolicySnapShot.DeserializeManagementPolicySnapShot(property.Value);
                    continue;
                }
                if (property.NameEquals("version"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    version = ManagementPolicyVersion.DeserializeManagementPolicyVersion(property.Value);
                    continue;
                }
            }
            return(new ManagementPolicyAction(baseBlob.Value, snapshot.Value, version.Value));
        }