diff --git a/flake.nix b/flake.nix index a00ca48..f66e23b 100644 --- a/flake.nix +++ b/flake.nix @@ -78,11 +78,14 @@ config = lib.mkOption { type = lib.types.submodule { - options.facilities = lib.mkOption { + options.metros = lib.mkOption { type = with lib.types; listOf str; description = lib.mdDoc '' - The facilities the instances are allowed to be created in. + The metros the instances are allowed to be created in. ''; + example = [ + "any" + ]; }; options.tags = lib.mkOption { type = with lib.types; listOf str; diff --git a/src/device.rs b/src/device.rs index eb65ac3..701181c 100644 --- a/src/device.rs +++ b/src/device.rs @@ -46,7 +46,7 @@ pub struct Device { #[derive(Serialize, Debug)] struct CreateDeviceRequest { always_pxe: bool, - facility: Vec, + metro: Vec, hostname: String, ipxe_script_url: String, operating_system: String, @@ -62,7 +62,7 @@ pub async fn create_device( equinix_project_id: &str, plan: HardwarePlan, tags: &[String], - facilities: &[String], + metros: &[String], ) -> Result { let raw = http_client .post(format!( @@ -78,7 +78,7 @@ pub async fn create_device( spot_instance: true, spot_price_max: plan.bid, tags: tags.to_vec(), - facility: facilities.to_vec(), + metro: metros.to_vec(), }) .header(ACCEPT, "application/json") .header(CONTENT_TYPE, "application/json") diff --git a/src/hardware.rs b/src/hardware.rs index d9da401..0496e51 100644 --- a/src/hardware.rs +++ b/src/hardware.rs @@ -40,13 +40,13 @@ type CategoryMap = HashMap>; pub struct Config { categories: CategoryMap, tags: Vec, - facilities: Vec, + metros: Vec, } pub struct DesiredHardwareConfig { pub plans: Vec, pub tags: Vec, - pub facilities: Vec, + pub metros: Vec, } pub fn parse_config_file(file: &Path) -> Result { @@ -119,12 +119,12 @@ pub async fn get_desired_hardware( let mut tags = config.tags; tags.dedup(); - let mut facilities = config.facilities; - facilities.dedup(); + let mut metros = config.metros; + metros.dedup(); Ok(DesiredHardwareConfig { plans: desired_hardware, tags, - facilities, + metros, }) } diff --git a/src/main.rs b/src/main.rs index 467b7be..4333e71 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ struct Cli { prometheus_root: String, /// A JSON description of machines and their Nix system types and job sizes, and the tags and - /// facilities with which to create the machines. + /// metros with which to create the machines. #[clap(long, required = true)] config_file: PathBuf, } @@ -111,7 +111,7 @@ async fn real_main( &equinix_project_id, desired.clone(), &desired_hardware.tags, - &desired_hardware.facilities, + &desired_hardware.metros, ) .await?; }