예제 #1
0
        internal static CheckAccessDecision DeserializeCheckAccessDecision(JsonElement element)
        {
            Optional <string> accessDecision = default;
            Optional <string> actionId       = default;
            Optional <RoleAssignmentDetails> roleAssignment = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("accessDecision"))
                {
                    accessDecision = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("actionId"))
                {
                    actionId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("roleAssignment"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    roleAssignment = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(property.Value);
                    continue;
                }
            }
            return(new CheckAccessDecision(accessDecision.Value, actionId.Value, roleAssignment.Value));
        }
예제 #2
0
        internal static RoleAssignmentDetailsList DeserializeRoleAssignmentDetailsList(JsonElement element)
        {
            Optional <int> count = default;
            Optional <IReadOnlyList <RoleAssignmentDetails> > value = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("count"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    count = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <RoleAssignmentDetails> array = new List <RoleAssignmentDetails>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(RoleAssignmentDetails.DeserializeRoleAssignmentDetails(item));
                    }
                    value = array;
                    continue;
                }
            }
            return(new RoleAssignmentDetailsList(Optional.ToNullable(count), Optional.ToList(value)));
        }