예제 #1
0
        internal static RegionalReplicationStatus DeserializeRegionalReplicationStatus(JsonElement element)
        {
            Optional <string>           region  = default;
            Optional <ReplicationState> state   = default;
            Optional <string>           details = default;
            Optional <int> progress             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("region"))
                {
                    region = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("state"))
                {
                    state = new ReplicationState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("details"))
                {
                    details = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("progress"))
                {
                    progress = property.Value.GetInt32();
                    continue;
                }
            }
            return(new RegionalReplicationStatus(region.Value, Optional.ToNullable(state), details.Value, Optional.ToNullable(progress)));
        }
예제 #2
0
        internal static RegionalReplicationStatus DeserializeRegionalReplicationStatus(JsonElement element)
        {
            string           region  = default;
            ReplicationState?state   = default;
            string           details = default;
            int?progress             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("region"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    region = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("state"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    state = new ReplicationState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("details"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    details = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("progress"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    progress = property.Value.GetInt32();
                    continue;
                }
            }
            return(new RegionalReplicationStatus(region, state, details, progress));
        }