internal ResourceSkuRestrictions(ResourceSkuRestrictionsType?resourceSkuRestrictionsType, IReadOnlyList <string> values, ResourceSkuRestrictionInfo restrictionInfo, ResourceSkuRestrictionsReasonCode?reasonCode) { ResourceSkuRestrictionsType = resourceSkuRestrictionsType; Values = values; RestrictionInfo = restrictionInfo; ReasonCode = reasonCode; }
internal static ResourceSkuRestrictions DeserializeResourceSkuRestrictions(JsonElement element) { Optional <ResourceSkuRestrictionsType> type = default; Optional <IReadOnlyList <string> > values = default; Optional <ResourceSkuRestrictionInfo> restrictionInfo = default; Optional <ResourceSkuRestrictionsReasonCode> reasonCode = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = property.Value.GetString().ToResourceSkuRestrictionsType(); continue; } if (property.NameEquals("values")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } values = array; continue; } if (property.NameEquals("restrictionInfo")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } restrictionInfo = ResourceSkuRestrictionInfo.DeserializeResourceSkuRestrictionInfo(property.Value); continue; } if (property.NameEquals("reasonCode")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } reasonCode = property.Value.GetString().ToResourceSkuRestrictionsReasonCode(); continue; } } return(new ResourceSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode))); }