Attempt to implement and test setting static ips from instance metadata
This commit is contained in:
parent
dd1cfa79e7
commit
47dbb7cdd3
16 changed files with 258 additions and 59 deletions
32
rust/program/hetzner-static-ip/src/metadata.rs
Normal file
32
rust/program/hetzner-static-ip/src/metadata.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Instance {
|
||||
#[serde(rename = "network-config")]
|
||||
pub network_config: InstanceNetworkConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct InstanceNetworkConfig {
|
||||
pub config: Vec<InstanceNetworkConfigConfig>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct InstanceNetworkConfigConfig {
|
||||
pub name: String,
|
||||
pub subnets: Vec<InstanceNetworkConfigConfigSubnet>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum InstanceNetworkConfigConfigSubnet {
|
||||
#[serde(rename = "static")]
|
||||
Static {
|
||||
ipv6: Option<bool>,
|
||||
ipv4: Option<bool>,
|
||||
address: String,
|
||||
gateway: String,
|
||||
},
|
||||
#[serde(rename = "dhcp")]
|
||||
Dhcp {},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue