From 94e14edb225b2941b759d50aae923f8085c979c2 Mon Sep 17 00:00:00 2001 From: Nick Saika Date: Mon, 8 Apr 2024 18:54:28 +0000 Subject: [PATCH] fixup! providers: Add "akamai" provider --- src/providers/akamai/mock_tests.rs | 9 ++++++++- src/providers/akamai/mod.rs | 30 ++++-------------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/providers/akamai/mock_tests.rs b/src/providers/akamai/mock_tests.rs index b01806f7..411b6f28 100644 --- a/src/providers/akamai/mock_tests.rs +++ b/src/providers/akamai/mock_tests.rs @@ -45,7 +45,14 @@ fn test_attributes() { // Mock the /v1/network endpoint. let network_metadata = r#"{ - "interfaces": [], + "interfaces": [ + { + "id": 12345678, + "purpose": "public", + "label": null, + "ipam_address": null + } + ], "ipv4": { "public": [ "1.2.3.4/32" diff --git a/src/providers/akamai/mod.rs b/src/providers/akamai/mod.rs index b36639b4..77368787 100644 --- a/src/providers/akamai/mod.rs +++ b/src/providers/akamai/mod.rs @@ -26,7 +26,6 @@ use reqwest::header::{HeaderName, HeaderValue}; use serde::Deserialize; use std::collections::HashMap; -// use crate::network; use crate::providers::MetadataProvider; use crate::retry; @@ -198,12 +197,6 @@ impl MetadataProvider for AkamaiProvider { Ok(public_keys) } - - // TODO: See if this can be implemented with the information that comes back from the - // /v1/network endpoint. - // fn networks(&self) -> Result> { - // unimplemented!() - // } } #[derive(Clone, Deserialize)] @@ -248,16 +241,7 @@ struct Specs { #[derive(Clone, Deserialize)] struct Backups { enabled: bool, - status: Option, -} - -#[allow(dead_code)] -#[derive(Clone, Deserialize)] -#[serde(untagged, rename_all = "lowercase")] -enum BackupStatus { - Pending, - Running, - Complete, + status: Option, // pending, running, complete } #[derive(Clone, Deserialize)] @@ -271,18 +255,12 @@ struct Network { #[allow(dead_code)] #[derive(Clone, Deserialize)] struct NetworkInterface { - purpose: InterfacePurpose, - label: String, + id: u64, + purpose: Option, // public, vlan + label: Option, ipam_address: Option, } -#[derive(Clone, Deserialize)] -#[serde(untagged, rename_all = "lowercase")] -enum InterfacePurpose { - Public, - Vlan, -} - #[derive(Clone, Deserialize)] struct Ipv4 { public: Vec,