mirror of
https://github.com/zerotier/zerotier-rust-api.git
synced 2026-05-22 16:26:25 -07:00
Merge pull request #6 from cheriimoya/main
Update dependencies, zerotier-central-api openapi and fix build.rs
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
with import <nixpkgs> {};
|
||||
mkShell {
|
||||
name = "zerotier-rust-api";
|
||||
buildInputs = with pkgs; [
|
||||
cacert
|
||||
cargo
|
||||
curl
|
||||
openssl
|
||||
pkg-config
|
||||
];
|
||||
|
||||
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
}
|
||||
Generated
+355
-331
File diff suppressed because it is too large
Load Diff
@@ -7,15 +7,16 @@ authors = ["Erik Hollensbe <erik.hollensbe@zerotier.com>", "Adam Ierymenko <adam
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
[dependencies]
|
||||
progenitor-client = ">=0.2.0"
|
||||
progenitor-client = "0.5.0"
|
||||
reqwest = { version = "0.11", features = ["json", "stream"] }
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
chrono = { version = "0.4", features = [ "serde" ] }
|
||||
uuid = { version = "0.8", features = [ "serde", "v4" ] }
|
||||
uuid = { version = "1.7", features = [ "serde", "v4" ] }
|
||||
futures = "0.3"
|
||||
serde_json = "1.0"
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = ">=0"
|
||||
progenitor = "0.1.1"
|
||||
prettyplease = "0.1.25"
|
||||
progenitor = "0.5.0"
|
||||
serde_json = "1.0"
|
||||
syn = "1.0"
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
fn main() {
|
||||
let src = PathBuf::from_str("openapi.json").unwrap();
|
||||
let src = "openapi.json";
|
||||
println!("cargo:rerun-if-changed={}", src);
|
||||
let file = std::fs::File::open(src).unwrap();
|
||||
let spec = serde_json::from_reader(file).unwrap();
|
||||
let mut generator = progenitor::Generator::default();
|
||||
|
||||
let content = generator.generate_text(&spec).unwrap();
|
||||
let tokens = generator.generate_tokens(&spec).unwrap();
|
||||
let ast = syn::parse2(tokens).unwrap();
|
||||
let content = prettyplease::unparse(&ast);
|
||||
|
||||
let out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
std::fs::write(out_file.join("codegen.rs"), content).unwrap();
|
||||
let mut out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
out_file.push("codegen.rs");
|
||||
|
||||
std::fs::write(out_file, content).unwrap();
|
||||
}
|
||||
|
||||
@@ -1115,6 +1115,10 @@
|
||||
},
|
||||
"nullable": true
|
||||
},
|
||||
"ssoConfig": {
|
||||
"$ref": "#/components/schemas/NetworkSSOConfig",
|
||||
"nullable": true
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -1132,6 +1136,55 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"NetworkSSOConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"example": true,
|
||||
"readOnly": false,
|
||||
"description": "SSO enabled/disabled on network"
|
||||
},
|
||||
"mode": {
|
||||
"type": "string",
|
||||
"example": "default",
|
||||
"description": "SSO mode. One of: `default`, `email`, `group`",
|
||||
"readOnly": false
|
||||
},
|
||||
"clientId": {
|
||||
"type": "string",
|
||||
"example": "some-client-id",
|
||||
"description": "SSO client ID. Client ID must be already configured in the Org",
|
||||
"readOnly": false
|
||||
},
|
||||
"issuer": {
|
||||
"type": "string",
|
||||
"example": "https://example.com/oidc",
|
||||
"description": "URL of the OIDC issuer",
|
||||
"readOnly": true
|
||||
},
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"example": "keycloak",
|
||||
"description": "Provider type",
|
||||
"readOnly": true
|
||||
},
|
||||
"authorizationEndpoint": {
|
||||
"type": "string",
|
||||
"description": "Authorization URL endpoint",
|
||||
"readOnly": true
|
||||
},
|
||||
"allowList": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"nullable": true,
|
||||
"description": "List of email addresses or group memberships that may SSO auth onto the network",
|
||||
"readOnly": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"Member": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1198,14 +1251,23 @@
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"readOnly": true,
|
||||
"description": "Last seen time of the member. Note: This data is considered ephemeral and may be reset to 0 at any time without warning.",
|
||||
"description": "Last seen time of the member (milliseconds since epoch). Note: This data is considered ephemeral and may be reset to 0 at any time without warning.",
|
||||
"example": 1612993673254,
|
||||
"nullable": true,
|
||||
"deprecated": true
|
||||
},
|
||||
"lastSeen": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"readOnly": true,
|
||||
"description": "Time the member last checked in with the network controller in milliseconds since epoch. Note: This data is considered ephemeral and may be reset to 0 at any time without warning.",
|
||||
"example": 1612993673254,
|
||||
"nullable": true
|
||||
},
|
||||
"physicalAddress": {
|
||||
"type": "string",
|
||||
"readOnly": true,
|
||||
"description": "IP address the member last spoke to the controller via. Note: This data is considered ephemeral and may be reset to 0 at any time without warning.",
|
||||
"description": "IP address the member last spoke to the controller via (milliseconds since epoch). Note: This data is considered ephemeral and may be reset to 0 at any time without warning.",
|
||||
"example": "8.8.8.8",
|
||||
"nullable": true
|
||||
},
|
||||
@@ -1450,14 +1512,36 @@
|
||||
},
|
||||
"ssoConfig": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/SsoConfig",
|
||||
"$ref": "#/components/schemas/OrgSsoConfig",
|
||||
"description": "Organization wide SSO configuration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SsoConfig": {
|
||||
"OrgSsoConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"example": true,
|
||||
"description": "Enabled flag for SSO"
|
||||
},
|
||||
"issuers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/SsoIssuer",
|
||||
"description": "list of configured OIDC issuers"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"SsoIssuer": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"example": "keycloak",
|
||||
"description": "OIDC Provider (one of: default, authelia, auth0, azure, keycloak, okta, onelogin)"
|
||||
},
|
||||
"clientId": {
|
||||
"type": "string",
|
||||
"example": "oidc-client-id",
|
||||
@@ -1468,10 +1552,11 @@
|
||||
"example": "https://example.com/oidc/auth",
|
||||
"description": "OIDC Issuer URL"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"example": true,
|
||||
"description": "Enabled flag for SSO"
|
||||
"authorization_endpoint": {
|
||||
"type": "string",
|
||||
"example": "https://example.com/oidc/auth/endpoint",
|
||||
"description": "authorization endpoint",
|
||||
"readOnly": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1814,7 +1899,7 @@
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
"tokenAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Generated
+367
-322
File diff suppressed because it is too large
Load Diff
@@ -7,15 +7,16 @@ authors = ["Erik Hollensbe <erik.hollensbe@zerotier.com>", "Adam Ierymenko <adam
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
[dependencies]
|
||||
progenitor-client = ">=0.2.0"
|
||||
progenitor-client = "0.5.0"
|
||||
reqwest = { version = "0.11", features = ["json", "stream"] }
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
chrono = { version = "0.4", features = [ "serde" ] }
|
||||
uuid = { version = "0.8", features = [ "serde", "v4" ] }
|
||||
uuid = { version = "1.7", features = [ "serde", "v4" ] }
|
||||
futures = "0.3"
|
||||
serde_json = "1.0"
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = ">=0"
|
||||
progenitor = "0.1.1"
|
||||
prettyplease = "0.1.25"
|
||||
progenitor = "0.5.0"
|
||||
serde_json = "1.0"
|
||||
syn = "1.0"
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
fn main() {
|
||||
let src = PathBuf::from_str("openapi.json").unwrap();
|
||||
let src = "openapi.json";
|
||||
println!("cargo:rerun-if-changed={}", src);
|
||||
let file = std::fs::File::open(src).unwrap();
|
||||
let spec = serde_json::from_reader(file).unwrap();
|
||||
let mut generator = progenitor::Generator::default();
|
||||
|
||||
let content = generator.generate_text(&spec).unwrap();
|
||||
let tokens = generator.generate_tokens(&spec).unwrap();
|
||||
let ast = syn::parse2(tokens).unwrap();
|
||||
let content = prettyplease::unparse(&ast);
|
||||
|
||||
let out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
std::fs::write(out_file.join("codegen.rs"), content).unwrap();
|
||||
let mut out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
out_file.push("codegen.rs");
|
||||
|
||||
std::fs::write(out_file, content).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user