예제 #1
0
        public MetaV1Metadata(ref JsonReader reader)
        {
            reader.ReadIsBeginObjectWithVerify();

            while (true)
            {
                var token = reader.GetCurrentJsonToken();
                switch (token)
                {
                case JsonToken.String:
                {
                    var propName = reader.ReadPropertyName();
                    switch (propName)
                    {
                    case "name":
                        Name = reader.ReadString();
                        break;

                    case "generateName":
                        GenerateName = reader.ReadString();
                        break;

                    case "namespace":
                        Namespace = reader.ReadString();
                        break;

                    case "selfLink":
                        SelfLink = reader.ReadString();
                        break;

                    case "uid":
                        Uid = reader.ReadString();
                        break;

                    case "resourceVersion":
                        ResourceVersion = reader.ReadString();
                        break;

                    case "creationTimestamp":
                        CreationTimestamp = reader.ReadString();
                        break;

                    case "labels":
                        Labels = JsonReaderHelper.ReadAsStringDictionary(ref reader);
                        break;

                    case "annotations":
                        Annotations = JsonReaderHelper.ReadAsStringDictionary(ref reader);
                        break;

                    case "ownerReferences":
                        OwnerReferences = JsonReaderHelper.ReadAsArray(ref reader, OwnerReference.Create);
                        break;

                    default:
                        reader.ReadNextBlock();
                        break;
                    }
                }
                break;

                case JsonToken.ValueSeparator:
                    reader.ReadNext();
                    break;

                case JsonToken.EndObject:
                    reader.ReadNext();
                    return;
                }
            }
        }