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; }
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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("metadata")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } targetResource = SubResource.DeserializeSubResource(property0.Value); continue; } if (property0.NameEquals("ARecords")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } cNAMERecord = CnameRecord.DeserializeCnameRecord(property0.Value); continue; } if (property0.NameEquals("SOARecord")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } sOARecord = SoaRecord.DeserializeSoaRecord(property0.Value); continue; } if (property0.NameEquals("caaRecords")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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)); }