internal static CassandraTableResource DeserializeCassandraTableResource(JsonElement element)
        {
            string                     id                   = default;
            Optional <int>             defaultTtl           = default;
            Optional <CassandraSchema> schema               = default;
            Optional <int>             analyticalStorageTtl = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("defaultTtl"))
                {
                    defaultTtl = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("schema"))
                {
                    schema = CassandraSchema.DeserializeCassandraSchema(property.Value);
                    continue;
                }
                if (property.NameEquals("analyticalStorageTtl"))
                {
                    analyticalStorageTtl = property.Value.GetInt32();
                    continue;
                }
            }
            return(new CassandraTableResource(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl)));
        }
Пример #2
0
        internal static CassandraTableGetPropertiesResource DeserializeCassandraTableGetPropertiesResource(JsonElement element)
        {
            Optional <string>          Rid                  = default;
            Optional <object>          Ts                   = default;
            Optional <string>          Etag                 = default;
            string                     id                   = default;
            Optional <int>             defaultTtl           = default;
            Optional <CassandraSchema> schema               = default;
            Optional <int>             analyticalStorageTtl = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("_rid"))
                {
                    Rid = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("_ts"))
                {
                    Ts = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("_etag"))
                {
                    Etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("defaultTtl"))
                {
                    defaultTtl = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("schema"))
                {
                    schema = CassandraSchema.DeserializeCassandraSchema(property.Value);
                    continue;
                }
                if (property.NameEquals("analyticalStorageTtl"))
                {
                    analyticalStorageTtl = property.Value.GetInt32();
                    continue;
                }
            }
            return(new CassandraTableGetPropertiesResource(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), Rid.Value, Ts.Value, Etag.Value));
        }
Пример #3
0
        internal static CassandraTablePropertiesResource DeserializeCassandraTablePropertiesResource(JsonElement element)
        {
            Optional <string>          rid                  = default;
            Optional <float>           ts                   = default;
            Optional <string>          etag                 = default;
            string                     id                   = default;
            Optional <int>             defaultTtl           = default;
            Optional <CassandraSchema> schema               = default;
            Optional <int>             analyticalStorageTtl = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("_rid"))
                {
                    rid = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("_ts"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    ts = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("_etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("defaultTtl"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    defaultTtl = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("schema"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    schema = CassandraSchema.DeserializeCassandraSchema(property.Value);
                    continue;
                }
                if (property.NameEquals("analyticalStorageTtl"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    analyticalStorageTtl = property.Value.GetInt32();
                    continue;
                }
            }
            return(new CassandraTablePropertiesResource(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), rid.Value, Optional.ToNullable(ts), etag.Value));
        }