internal static SqlContainerResource DeserializeSqlContainerResource(JsonElement element)
        {
            string id = default;
            Optional <IndexingPolicy>        indexingPolicy              = default;
            Optional <ContainerPartitionKey> partitionKey                = default;
            Optional <int>                      defaultTtl               = default;
            Optional <UniqueKeyPolicy>          uniqueKeyPolicy          = default;
            Optional <ConflictResolutionPolicy> conflictResolutionPolicy = default;
            Optional <long>                     analyticalStorageTtl     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("indexingPolicy"))
                {
                    indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("partitionKey"))
                {
                    partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultTtl"))
                {
                    defaultTtl = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("uniqueKeyPolicy"))
                {
                    uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("conflictResolutionPolicy"))
                {
                    conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("analyticalStorageTtl"))
                {
                    analyticalStorageTtl = property.Value.GetInt64();
                    continue;
                }
            }
            return(new SqlContainerResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl)));
        }
Exemple #2
0
 internal SqlContainerGetPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int?defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long?analyticalStorageTtl, string rid, object ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl)
 {
     Rid  = rid;
     Ts   = ts;
     Etag = etag;
 }
Exemple #3
0
        internal static GremlinGraphGetPropertiesResource DeserializeGremlinGraphGetPropertiesResource(JsonElement element)
        {
            Optional <string>                   Rid                      = default;
            Optional <object>                   Ts                       = default;
            Optional <string>                   Etag                     = default;
            string                              id                       = default;
            Optional <IndexingPolicy>           indexingPolicy           = default;
            Optional <ContainerPartitionKey>    partitionKey             = default;
            Optional <int>                      defaultTtl               = default;
            Optional <UniqueKeyPolicy>          uniqueKeyPolicy          = default;
            Optional <ConflictResolutionPolicy> conflictResolutionPolicy = 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("indexingPolicy"))
                {
                    indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("partitionKey"))
                {
                    partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultTtl"))
                {
                    defaultTtl = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("uniqueKeyPolicy"))
                {
                    uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("conflictResolutionPolicy"))
                {
                    conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value);
                    continue;
                }
            }
            return(new GremlinGraphGetPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Rid.Value, Ts.Value, Etag.Value));
        }
 internal GremlinGraphPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int?defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, string rid, float?ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy)
 {
     Rid  = rid;
     Ts   = ts;
     Etag = etag;
 }
        internal static SqlContainerPropertiesResource DeserializeSqlContainerPropertiesResource(JsonElement element)
        {
            Optional <string>                   rid                      = default;
            Optional <float>                    ts                       = default;
            Optional <string>                   etag                     = default;
            string                              id                       = default;
            Optional <IndexingPolicy>           indexingPolicy           = default;
            Optional <ContainerPartitionKey>    partitionKey             = default;
            Optional <int>                      defaultTtl               = default;
            Optional <UniqueKeyPolicy>          uniqueKeyPolicy          = default;
            Optional <ConflictResolutionPolicy> conflictResolutionPolicy = default;
            Optional <long>                     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("indexingPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("partitionKey"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultTtl"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    defaultTtl = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("uniqueKeyPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("conflictResolutionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("analyticalStorageTtl"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    analyticalStorageTtl = property.Value.GetInt64();
                    continue;
                }
            }
            return(new SqlContainerPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), rid.Value, Optional.ToNullable(ts), etag.Value));
        }
 internal SqlContainerResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int?defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long?analyticalStorageTtl)
 {
     Id                       = id;
     IndexingPolicy           = indexingPolicy;
     PartitionKey             = partitionKey;
     DefaultTtl               = defaultTtl;
     UniqueKeyPolicy          = uniqueKeyPolicy;
     ConflictResolutionPolicy = conflictResolutionPolicy;
     AnalyticalStorageTtl     = analyticalStorageTtl;
 }
Exemple #7
0
        internal static GremlinGraphResource DeserializeGremlinGraphResource(JsonElement element)
        {
            string id = default;
            Optional <IndexingPolicy>        indexingPolicy              = default;
            Optional <ContainerPartitionKey> partitionKey                = default;
            Optional <int>                      defaultTtl               = default;
            Optional <UniqueKeyPolicy>          uniqueKeyPolicy          = default;
            Optional <ConflictResolutionPolicy> conflictResolutionPolicy = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("indexingPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("partitionKey"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultTtl"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    defaultTtl = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("uniqueKeyPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("conflictResolutionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value);
                    continue;
                }
            }
            return(new GremlinGraphResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value));
        }
Exemple #8
0
 internal GremlinGraphResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int?defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy)
 {
     Id                       = id;
     IndexingPolicy           = indexingPolicy;
     PartitionKey             = partitionKey;
     DefaultTtl               = defaultTtl;
     UniqueKeyPolicy          = uniqueKeyPolicy;
     ConflictResolutionPolicy = conflictResolutionPolicy;
 }
Exemple #9
0
 internal RestorableSqlContainerPropertiesResourceContainer(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int?defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long?analyticalStorageTtl, string self, string rid, float?ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl)
 {
     Self = self;
     Rid  = rid;
     Ts   = ts;
     Etag = etag;
 }