Exemple #1
0
 internal FailoverGroup(string id, string name, string type, string location, IDictionary <string, string> tags, FailoverGroupReadWriteEndpoint readWriteEndpoint, FailoverGroupReadOnlyEndpoint readOnlyEndpoint, FailoverGroupReplicationRole?replicationRole, string replicationState, IList <PartnerInfo> partnerServers, IList <string> databases) : base(id, name, type)
 {
     Location          = location;
     Tags              = tags;
     ReadWriteEndpoint = readWriteEndpoint;
     ReadOnlyEndpoint  = readOnlyEndpoint;
     ReplicationRole   = replicationRole;
     ReplicationState  = replicationState;
     PartnerServers    = partnerServers;
     Databases         = databases;
 }
Exemple #2
0
        internal static FailoverGroup DeserializeFailoverGroup(JsonElement element)
        {
            Optional <string> location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <string> id   = default;
            Optional <string> name = default;
            Optional <string> type = default;
            Optional <FailoverGroupReadWriteEndpoint> readWriteEndpoint = default;
            Optional <FailoverGroupReadOnlyEndpoint>  readOnlyEndpoint  = default;
            Optional <FailoverGroupReplicationRole>   replicationRole   = default;
            Optional <string> replicationState             = default;
            Optional <IList <PartnerInfo> > partnerServers = default;
            Optional <IList <string> >      databases      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("readWriteEndpoint"))
                        {
                            readWriteEndpoint = FailoverGroupReadWriteEndpoint.DeserializeFailoverGroupReadWriteEndpoint(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("readOnlyEndpoint"))
                        {
                            readOnlyEndpoint = FailoverGroupReadOnlyEndpoint.DeserializeFailoverGroupReadOnlyEndpoint(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("replicationRole"))
                        {
                            replicationRole = new FailoverGroupReplicationRole(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("replicationState"))
                        {
                            replicationState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("partnerServers"))
                        {
                            List <PartnerInfo> array = new List <PartnerInfo>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PartnerInfo.DeserializePartnerInfo(item));
                            }
                            partnerServers = array;
                            continue;
                        }
                        if (property0.NameEquals("databases"))
                        {
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            databases = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new FailoverGroup(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), readWriteEndpoint.Value, readOnlyEndpoint.Value, Optional.ToNullable(replicationRole), replicationState.Value, Optional.ToList(partnerServers), Optional.ToList(databases)));
        }