internal static ResourceQuota DeserializeResourceQuota(JsonElement element) { Optional <string> id = default; Optional <string> amlWorkspaceLocation = default; Optional <string> type = default; Optional <ResourceName> name = default; Optional <long> limit = default; Optional <QuotaUnit> unit = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("amlWorkspaceLocation")) { amlWorkspaceLocation = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } name = ResourceName.DeserializeResourceName(property.Value); continue; } if (property.NameEquals("limit")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } limit = property.Value.GetInt64(); continue; } if (property.NameEquals("unit")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } unit = new QuotaUnit(property.Value.GetString()); continue; } } return(new ResourceQuota(id.Value, amlWorkspaceLocation.Value, type.Value, name.Value, Optional.ToNullable(limit), Optional.ToNullable(unit))); }
internal static UpdateWorkspaceQuotas DeserializeUpdateWorkspaceQuotas(JsonElement element) { Optional <string> id = default; Optional <string> type = default; Optional <long> limit = default; Optional <QuotaUnit> unit = default; Optional <Status> status = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("limit")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } limit = property.Value.GetInt64(); continue; } if (property.NameEquals("unit")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } unit = new QuotaUnit(property.Value.GetString()); continue; } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } status = new Status(property.Value.GetString()); continue; } } return(new UpdateWorkspaceQuotas(id.Value, type.Value, Optional.ToNullable(limit), Optional.ToNullable(unit), Optional.ToNullable(status))); }