Exemplo n.º 1
0
        public static bool AreEqual(
            Azure.ResourceManager.Dns.Models.SubResource first,
            Azure.ResourceManager.Dns.Models.SubResource second)
        {
            if (first != null && second != null)
            {
                return(first.Id == second.Id);
            }

            return(true);
        }
Exemplo n.º 2
0
 internal DnsResourceReference(IReadOnlyList <SubResource> dnsResources, SubResource targetResource)
 {
     DnsResources   = dnsResources;
     TargetResource = targetResource;
 }
Exemplo n.º 3
0
        internal static Zone DeserializeZone(JsonElement element)
        {
            Optional <string> etag     = default;
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            string            location = default;
            Optional <IDictionary <string, string> > tags  = default;
            Optional <long> maxNumberOfRecordSets          = default;
            Optional <long> numberOfRecordSets             = default;
            Optional <IReadOnlyList <string> > nameServers = default;
            Optional <ZoneType>             zoneType       = default;
            Optional <IList <SubResource> > registrationVirtualNetworks = default;
            Optional <IList <SubResource> > resolutionVirtualNetworks   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    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("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("maxNumberOfRecordSets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            maxNumberOfRecordSets = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("numberOfRecordSets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            numberOfRecordSets = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("nameServers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            nameServers = array;
                            continue;
                        }
                        if (property0.NameEquals("zoneType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            zoneType = property0.Value.GetString().ToZoneType();
                            continue;
                        }
                        if (property0.NameEquals("registrationVirtualNetworks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SubResource> array = new List <SubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubResource.DeserializeSubResource(item));
                            }
                            registrationVirtualNetworks = array;
                            continue;
                        }
                        if (property0.NameEquals("resolutionVirtualNetworks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SubResource> array = new List <SubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubResource.DeserializeSubResource(item));
                            }
                            resolutionVirtualNetworks = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new Zone(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(maxNumberOfRecordSets), Optional.ToNullable(numberOfRecordSets), Optional.ToList(nameServers), Optional.ToNullable(zoneType), Optional.ToList(registrationVirtualNetworks), Optional.ToList(resolutionVirtualNetworks)));
        }
Exemplo n.º 4
0
        internal static RecordSet DeserializeRecordSet(JsonElement element)
        {
            Optional <string> id   = default;
            Optional <string> name = default;
            Optional <string> type = default;
            Optional <string> etag = default;
            Optional <IDictionary <string, string> > metadata = default;
            Optional <long>                tTL  = default;
            Optional <string>              fqdn = default;
            Optional <string>              provisioningState = default;
            Optional <SubResource>         targetResource    = default;
            Optional <IList <ARecord> >    aRecords          = default;
            Optional <IList <AaaaRecord> > aAAARecords       = default;
            Optional <IList <MxRecord> >   mXRecords         = default;
            Optional <IList <NsRecord> >   nSRecords         = default;
            Optional <IList <PtrRecord> >  pTRRecords        = default;
            Optional <IList <SrvRecord> >  sRVRecords        = default;
            Optional <IList <TxtRecord> >  tXTRecords        = default;
            Optional <CnameRecord>         cNAMERecord       = default;
            Optional <SoaRecord>           sOARecord         = default;
            Optional <IList <CaaRecord> >  caaRecords        = 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("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("metadata"))
                        {
                            Dictionary <string, string> dictionary = new Dictionary <string, string>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, property1.Value.GetString());
                            }
                            metadata = dictionary;
                            continue;
                        }
                        if (property0.NameEquals("TTL"))
                        {
                            tTL = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("fqdn"))
                        {
                            fqdn = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("targetResource"))
                        {
                            targetResource = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ARecords"))
                        {
                            List <ARecord> array = new List <ARecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ARecord.DeserializeARecord(item));
                            }
                            aRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("AAAARecords"))
                        {
                            List <AaaaRecord> array = new List <AaaaRecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AaaaRecord.DeserializeAaaaRecord(item));
                            }
                            aAAARecords = array;
                            continue;
                        }
                        if (property0.NameEquals("MXRecords"))
                        {
                            List <MxRecord> array = new List <MxRecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(MxRecord.DeserializeMxRecord(item));
                            }
                            mXRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("NSRecords"))
                        {
                            List <NsRecord> array = new List <NsRecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NsRecord.DeserializeNsRecord(item));
                            }
                            nSRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("PTRRecords"))
                        {
                            List <PtrRecord> array = new List <PtrRecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PtrRecord.DeserializePtrRecord(item));
                            }
                            pTRRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("SRVRecords"))
                        {
                            List <SrvRecord> array = new List <SrvRecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SrvRecord.DeserializeSrvRecord(item));
                            }
                            sRVRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("TXTRecords"))
                        {
                            List <TxtRecord> array = new List <TxtRecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(TxtRecord.DeserializeTxtRecord(item));
                            }
                            tXTRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("CNAMERecord"))
                        {
                            cNAMERecord = CnameRecord.DeserializeCnameRecord(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("SOARecord"))
                        {
                            sOARecord = SoaRecord.DeserializeSoaRecord(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("caaRecords"))
                        {
                            List <CaaRecord> array = new List <CaaRecord>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(CaaRecord.DeserializeCaaRecord(item));
                            }
                            caaRecords = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RecordSet(id.Value, name.Value, type.Value, etag.Value, Optional.ToDictionary(metadata), Optional.ToNullable(tTL), fqdn.Value, provisioningState.Value, targetResource.Value, Optional.ToList(aRecords), Optional.ToList(aAAARecords), Optional.ToList(mXRecords), Optional.ToList(nSRecords), Optional.ToList(pTRRecords), Optional.ToList(sRVRecords), Optional.ToList(tXTRecords), cNAMERecord.Value, sOARecord.Value, Optional.ToList(caaRecords)));
        }
Exemplo n.º 5
0
 internal RecordSet(string id, string name, string type, string etag, IDictionary <string, string> metadata, long?tTL, string fqdn, string provisioningState, SubResource targetResource, IList <ARecord> aRecords, IList <AaaaRecord> aaaaRecords, IList <MxRecord> mxRecords, IList <NsRecord> nsRecords, IList <PtrRecord> ptrRecords, IList <SrvRecord> srvRecords, IList <TxtRecord> txtRecords, CnameRecord cnameRecord, SoaRecord soaRecord, IList <CaaRecord> caaRecords)
 {
     Id                = id;
     Name              = name;
     Type              = type;
     Etag              = etag;
     Metadata          = metadata;
     TTL               = tTL;
     Fqdn              = fqdn;
     ProvisioningState = provisioningState;
     TargetResource    = targetResource;
     ARecords          = aRecords;
     AaaaRecords       = aaaaRecords;
     MxRecords         = mxRecords;
     NsRecords         = nsRecords;
     PtrRecords        = ptrRecords;
     SrvRecords        = srvRecords;
     TxtRecords        = txtRecords;
     CnameRecord       = cnameRecord;
     SoaRecord         = soaRecord;
     CaaRecords        = caaRecords;
 }