Skip to content

Commit

Permalink
fixup! providers: Add "akamai" provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Saika committed Apr 8, 2024
1 parent e9fed87 commit 94e14ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
9 changes: 8 additions & 1 deletion src/providers/akamai/mock_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
30 changes: 4 additions & 26 deletions src/providers/akamai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<Vec<network::Interface>> {
// unimplemented!()
// }
}

#[derive(Clone, Deserialize)]
Expand Down Expand Up @@ -248,16 +241,7 @@ struct Specs {
#[derive(Clone, Deserialize)]
struct Backups {
enabled: bool,
status: Option<BackupStatus>,
}

#[allow(dead_code)]
#[derive(Clone, Deserialize)]
#[serde(untagged, rename_all = "lowercase")]
enum BackupStatus {
Pending,
Running,
Complete,
status: Option<String>, // pending, running, complete
}

#[derive(Clone, Deserialize)]
Expand All @@ -271,18 +255,12 @@ struct Network {
#[allow(dead_code)]
#[derive(Clone, Deserialize)]
struct NetworkInterface {
purpose: InterfacePurpose,
label: String,
id: u64,
purpose: Option<String>, // public, vlan
label: Option<String>,
ipam_address: Option<String>,
}

#[derive(Clone, Deserialize)]
#[serde(untagged, rename_all = "lowercase")]
enum InterfacePurpose {
Public,
Vlan,
}

#[derive(Clone, Deserialize)]
struct Ipv4 {
public: Vec<String>,
Expand Down

0 comments on commit 94e14ed

Please sign in to comment.