コード例 #1
0
 internal InstanceFailoverGroup(string id, string name, string type, InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint, InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint, InstanceFailoverGroupReplicationRole?replicationRole, string replicationState, IList <PartnerRegionInfo> partnerRegions, IList <ManagedInstancePairInfo> managedInstancePairs) : base(id, name, type)
 {
     ReadWriteEndpoint    = readWriteEndpoint;
     ReadOnlyEndpoint     = readOnlyEndpoint;
     ReplicationRole      = replicationRole;
     ReplicationState     = replicationState;
     PartnerRegions       = partnerRegions;
     ManagedInstancePairs = managedInstancePairs;
 }
        internal static InstanceFailoverGroup DeserializeInstanceFailoverGroup(JsonElement element)
        {
            Optional <string> id   = default;
            Optional <string> name = default;
            Optional <string> type = default;
            Optional <InstanceFailoverGroupReadWriteEndpoint> readWriteEndpoint = default;
            Optional <InstanceFailoverGroupReadOnlyEndpoint>  readOnlyEndpoint  = default;
            Optional <InstanceFailoverGroupReplicationRole>   replicationRole   = default;
            Optional <string> replicationState = default;
            Optional <IList <PartnerRegionInfo> >       partnerRegions       = default;
            Optional <IList <ManagedInstancePairInfo> > managedInstancePairs = default;

            foreach (var property in element.EnumerateObject())
            {
                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 = InstanceFailoverGroupReadWriteEndpoint.DeserializeInstanceFailoverGroupReadWriteEndpoint(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("readOnlyEndpoint"))
                        {
                            readOnlyEndpoint = InstanceFailoverGroupReadOnlyEndpoint.DeserializeInstanceFailoverGroupReadOnlyEndpoint(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("replicationRole"))
                        {
                            replicationRole = new InstanceFailoverGroupReplicationRole(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("replicationState"))
                        {
                            replicationState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("partnerRegions"))
                        {
                            List <PartnerRegionInfo> array = new List <PartnerRegionInfo>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PartnerRegionInfo.DeserializePartnerRegionInfo(item));
                            }
                            partnerRegions = array;
                            continue;
                        }
                        if (property0.NameEquals("managedInstancePairs"))
                        {
                            List <ManagedInstancePairInfo> array = new List <ManagedInstancePairInfo>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ManagedInstancePairInfo.DeserializeManagedInstancePairInfo(item));
                            }
                            managedInstancePairs = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new InstanceFailoverGroup(id.Value, name.Value, type.Value, readWriteEndpoint.Value, readOnlyEndpoint.Value, Optional.ToNullable(replicationRole), replicationState.Value, Optional.ToList(partnerRegions), Optional.ToList(managedInstancePairs)));
        }