@ -0,0 +1,3 @@
|
||||
alter table ip_range
|
||||
add column allocation_mode smallint unsigned not null default 0,
|
||||
add column use_full_range bit(1) not null;
|
@ -247,7 +247,7 @@ pub enum RouterKind {
|
||||
OvhAdditionalIp = 1,
|
||||
}
|
||||
|
||||
#[derive(FromRow, Clone, Debug)]
|
||||
#[derive(FromRow, Clone, Debug, Default)]
|
||||
pub struct IpRange {
|
||||
pub id: u64,
|
||||
pub cidr: String,
|
||||
@ -256,6 +256,22 @@ pub struct IpRange {
|
||||
pub region_id: u64,
|
||||
pub reverse_zone_id: Option<String>,
|
||||
pub access_policy_id: Option<u64>,
|
||||
pub allocation_mode: IpRangeAllocationMode,
|
||||
/// Use all IPs in the range, including first and last
|
||||
pub use_full_range: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, sqlx::Type, Default)]
|
||||
#[repr(u16)]
|
||||
/// How ips are allocated from this range
|
||||
pub enum IpRangeAllocationMode {
|
||||
/// IPs are assigned in a random order
|
||||
Random = 0,
|
||||
#[default]
|
||||
/// IPs are assigned in sequential order
|
||||
Sequential = 1,
|
||||
/// IP(v6) assignment uses SLAAC EUI-64
|
||||
SlaacEui64 = 2,
|
||||
}
|
||||
|
||||
#[derive(FromRow, Clone, Debug)]
|
||||
|
@ -80,13 +80,13 @@ impl LNVpsDb for LNVpsDbMysql {
|
||||
Ok(sqlx::query(
|
||||
"insert into user_ssh_key(name,user_id,key_data) values(?, ?, ?) returning id",
|
||||
)
|
||||
.bind(&new_key.name)
|
||||
.bind(new_key.user_id)
|
||||
.bind(&new_key.key_data)
|
||||
.fetch_one(&self.db)
|
||||
.await
|
||||
.map_err(Error::new)?
|
||||
.try_get(0)?)
|
||||
.bind(&new_key.name)
|
||||
.bind(new_key.user_id)
|
||||
.bind(&new_key.key_data)
|
||||
.fetch_one(&self.db)
|
||||
.await
|
||||
.map_err(Error::new)?
|
||||
.try_get(0)?)
|
||||
}
|
||||
|
||||
async fn get_user_ssh_key(&self, id: u64) -> Result<UserSshKey> {
|
||||
@ -489,9 +489,9 @@ impl LNVpsDb for LNVpsDbMysql {
|
||||
sqlx::query_as(
|
||||
"select * from vm_payment where is_paid = true order by created desc limit 1",
|
||||
)
|
||||
.fetch_optional(&self.db)
|
||||
.await
|
||||
.map_err(Error::new)
|
||||
.fetch_optional(&self.db)
|
||||
.await
|
||||
.map_err(Error::new)
|
||||
}
|
||||
|
||||
async fn list_custom_pricing(&self, region_id: u64) -> Result<Vec<VmCustomPricing>> {
|
||||
|
Reference in New Issue
Block a user