mirror of
https://github.com/zerotier/zerotier-rust-api.git
synced 2026-05-22 16:26:25 -07:00
Merge pull request #1 from erikh/openapiv3
openapiv3 clients generated from progenitor (erikh fork w/ fixes)
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "@@PACKAGE@@"
|
||||
version = "@@VERSION@@"
|
||||
edition = "2018"
|
||||
description = "@@DESCRIPTION@@"
|
||||
authors = ["Erik Hollensbe <erik.hollensbe@zerotier.com>", "Adam Ierymenko <adam.ierymenko@zerotier.com>"]
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
[dependencies]
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
serde_json = "^1.0"
|
||||
url = "^2.2"
|
||||
[dependencies.reqwest]
|
||||
version = "^0.11"
|
||||
features = ["json", "multipart"]
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -1,9 +1,9 @@
|
||||
central:
|
||||
@DESCRIPTION="OpenAPI bindings to the ZeroTier Central (https:\/\/my.zerotier.com) service" bash generate.sh central zerotier-central-api
|
||||
bash generate.sh central zerotier-central-api
|
||||
cd zerotier-central-api && cargo build && cargo clean
|
||||
|
||||
service:
|
||||
@DESCRIPTION="OpenAPI bindings to the ZeroTierOne JSON API" bash generate.sh service zerotier-one-api
|
||||
bash generate.sh service zerotier-one-api
|
||||
cd zerotier-one-api && cargo build && cargo clean
|
||||
|
||||
.PHONY: central service
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# ZeroTier OpenAPI-generated Rust API Libraries
|
||||
|
||||
These libraries are generated by the [openapi-generator](https://github.com/OpenAPITools/openapi-generator) and contain code to interact with the following services:
|
||||
These libraries are generated by [progenitor](https://github.com/oxidecomputer/progenitor) and contain code to interact with the following services:
|
||||
|
||||
- crate zerotier-one-api: ZeroTierOne (typically over `http://localhost:9993`)
|
||||
- crate zerotier-central-api: ZeroTier Central (Through [ZeroTier Central](https://my.zerotier.com))
|
||||
|
||||
+2
-26
@@ -2,38 +2,14 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
if [ "x$1" = "x" ]
|
||||
if [ "x$1" = "x" -o "x$2" = "x" ]
|
||||
then
|
||||
echo "Please read this script before executing it"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$VERSION" = "x" ]
|
||||
then
|
||||
echo "Please supply a version in VERSION= in plain semver format (e.g., 1.2.3)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$DESCRIPTION" = "x" ]
|
||||
then
|
||||
echo "Please supply a package description in DESCRIPTION="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGE=$1
|
||||
PREFIX=$2
|
||||
|
||||
HOST=${HOST:-docs.zerotier.com}
|
||||
|
||||
rm -rf ./${PREFIX}
|
||||
mkdir -p ./${PREFIX}
|
||||
docker pull openapitools/openapi-generator-cli:latest
|
||||
docker run --rm -u $(id -u):$(id -g) -v ${PWD}/${PREFIX}:/swagger openapitools/openapi-generator-cli generate \
|
||||
--package-name ${PREFIX} \
|
||||
-i http://${HOST}/openapi/${PACKAGE}v1.json \
|
||||
-g rust \
|
||||
-o /swagger
|
||||
|
||||
sed -e "s/@@PACKAGE@@/${PREFIX}/g" Cargo.toml.template | \
|
||||
sed -e "s/@@VERSION@@/${VERSION}/g" | \
|
||||
sed -e "s/@@DESCRIPTION@@/${DESCRIPTION}/g" > ${PREFIX}/Cargo.toml
|
||||
curl -sSL http://${HOST}/openapi/${PACKAGE}v1.json > ${PREFIX}/openapi.json
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
/target/
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
target
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
@@ -1,60 +0,0 @@
|
||||
.gitignore
|
||||
.openapi-generator-ignore
|
||||
.travis.yml
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/ApiToken.md
|
||||
docs/AuthMethods.md
|
||||
docs/Dns.md
|
||||
docs/InviteStatus.md
|
||||
docs/IpRange.md
|
||||
docs/Ipv4AssignMode.md
|
||||
docs/Ipv6AssignMode.md
|
||||
docs/Member.md
|
||||
docs/MemberConfig.md
|
||||
docs/Network.md
|
||||
docs/NetworkApi.md
|
||||
docs/NetworkConfig.md
|
||||
docs/NetworkMemberApi.md
|
||||
docs/Organization.md
|
||||
docs/OrganizationInvitation.md
|
||||
docs/OrganizationMember.md
|
||||
docs/OrganizationsApi.md
|
||||
docs/Permissions.md
|
||||
docs/RandomToken.md
|
||||
docs/Route.md
|
||||
docs/Status.md
|
||||
docs/StatusLoginMethods.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/UtilApi.md
|
||||
git_push.sh
|
||||
src/apis/configuration.rs
|
||||
src/apis/mod.rs
|
||||
src/apis/network_api.rs
|
||||
src/apis/network_member_api.rs
|
||||
src/apis/organizations_api.rs
|
||||
src/apis/user_api.rs
|
||||
src/apis/util_api.rs
|
||||
src/lib.rs
|
||||
src/models/api_token.rs
|
||||
src/models/auth_methods.rs
|
||||
src/models/dns.rs
|
||||
src/models/invite_status.rs
|
||||
src/models/ip_range.rs
|
||||
src/models/ipv4_assign_mode.rs
|
||||
src/models/ipv6_assign_mode.rs
|
||||
src/models/member.rs
|
||||
src/models/member_config.rs
|
||||
src/models/mod.rs
|
||||
src/models/network.rs
|
||||
src/models/network_config.rs
|
||||
src/models/organization.rs
|
||||
src/models/organization_invitation.rs
|
||||
src/models/organization_member.rs
|
||||
src/models/permissions.rs
|
||||
src/models/random_token.rs
|
||||
src/models/route.rs
|
||||
src/models/status.rs
|
||||
src/models/status_login_methods.rs
|
||||
src/models/user.rs
|
||||
@@ -1 +0,0 @@
|
||||
6.0.0-SNAPSHOT
|
||||
@@ -1 +0,0 @@
|
||||
language: rust
|
||||
Generated
+1401
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,21 @@
|
||||
[package]
|
||||
name = "zerotier-central-api"
|
||||
version = "1.0.3"
|
||||
edition = "2018"
|
||||
description = "OpenAPI bindings to the ZeroTier Central (https://my.zerotier.com) service"
|
||||
version = "1.1.0"
|
||||
edition = "2021"
|
||||
description = "ZeroTier Central API for Rust"
|
||||
authors = ["Erik Hollensbe <erik.hollensbe@zerotier.com>", "Adam Ierymenko <adam.ierymenko@zerotier.com>"]
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
[dependencies]
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
serde_json = "^1.0"
|
||||
url = "^2.2"
|
||||
[dependencies.reqwest]
|
||||
version = "^0.11"
|
||||
features = ["json", "multipart"]
|
||||
progenitor-client = ">=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" ] }
|
||||
futures = "0.3"
|
||||
serde_json = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
[build-dependencies]
|
||||
anyhow = ">=0"
|
||||
progenitor = ">=0"
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
# Rust API client for zerotier-central-api
|
||||
|
||||
ZeroTier Central Network Management Portal API.<p>All API requests must have an API token header specified in the <code>Authorization: Bearer xxxxx</code> format. You can generate your API key by logging into <a href=\"https://my.zerotier.com\">ZeroTier Central</a> and creating a token on the Account page.</p><p>eg. <code>curl -X GET -H \"Authorization: bearer xxxxx\" https://my.zerotier.com/api/v1/network</code></p><p><h3>Rate Limiting</h3></p><p>The ZeroTier Central API implements rate limiting. Paid users are limited to 100 requests per second. Free users are limited to 20 requests per second.</p> <p> You can get the OpenAPI spec here as well: <code>https://docs.zerotier.com/openapi/centralv1.json</code></p>
|
||||
|
||||
For more information, please visit [https://discuss.zerotier.com](https://discuss.zerotier.com)
|
||||
|
||||
## Overview
|
||||
|
||||
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
|
||||
|
||||
- API version: v1
|
||||
- Package version: v1
|
||||
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
|
||||
|
||||
## Installation
|
||||
|
||||
Put the package under your project folder in a directory named `zerotier-central-api` and add the following to `Cargo.toml` under `[dependencies]`:
|
||||
|
||||
```
|
||||
zerotier-central-api = { path = "./zerotier-central-api" }
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *https://my.zerotier.com/api/v1*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*NetworkApi* | [**delete_network**](docs/NetworkApi.md#delete_network) | **DELETE** /network/{networkID} | delete network
|
||||
*NetworkApi* | [**get_network_by_id**](docs/NetworkApi.md#get_network_by_id) | **GET** /network/{networkID} | Get network by ID
|
||||
*NetworkApi* | [**get_network_list**](docs/NetworkApi.md#get_network_list) | **GET** /network | Returns a list of Networks you have access to.
|
||||
*NetworkApi* | [**new_network**](docs/NetworkApi.md#new_network) | **POST** /network | Create a new network.
|
||||
*NetworkApi* | [**update_network**](docs/NetworkApi.md#update_network) | **POST** /network/{networkID} | update network configuration
|
||||
*NetworkMemberApi* | [**delete_network_member**](docs/NetworkMemberApi.md#delete_network_member) | **DELETE** /network/{networkID}/member/{memberID} | Delete a network member
|
||||
*NetworkMemberApi* | [**get_network_member**](docs/NetworkMemberApi.md#get_network_member) | **GET** /network/{networkID}/member/{memberID} | Return an individual member on a network
|
||||
*NetworkMemberApi* | [**get_network_member_list**](docs/NetworkMemberApi.md#get_network_member_list) | **GET** /network/{networkID}/member | Returns a list of Members on the network.
|
||||
*NetworkMemberApi* | [**update_network_member**](docs/NetworkMemberApi.md#update_network_member) | **POST** /network/{networkID}/member/{memberID} | Modify a network member
|
||||
*OrganizationsApi* | [**accept_invitation**](docs/OrganizationsApi.md#accept_invitation) | **POST** /org-invitation/{inviteID} | Accept organization invitation
|
||||
*OrganizationsApi* | [**decline_invitation**](docs/OrganizationsApi.md#decline_invitation) | **DELETE** /org-invitation/{inviteID} | Decline organization invitation
|
||||
*OrganizationsApi* | [**get_invitation_by_id**](docs/OrganizationsApi.md#get_invitation_by_id) | **GET** /org-invitation/{inviteID} | Get organization invitation
|
||||
*OrganizationsApi* | [**get_organization**](docs/OrganizationsApi.md#get_organization) | **GET** /org | Get the current user's organization
|
||||
*OrganizationsApi* | [**get_organization_by_id**](docs/OrganizationsApi.md#get_organization_by_id) | **GET** /org/{orgID} | Get organization by ID
|
||||
*OrganizationsApi* | [**get_organization_invitation_list**](docs/OrganizationsApi.md#get_organization_invitation_list) | **GET** /org-invitation | Get list of organization invitations
|
||||
*OrganizationsApi* | [**get_organization_members**](docs/OrganizationsApi.md#get_organization_members) | **GET** /org/{orgID}/user | Get list of organization members
|
||||
*OrganizationsApi* | [**invite_user_by_email**](docs/OrganizationsApi.md#invite_user_by_email) | **POST** /org-invitation | Invite a user to your organization by email
|
||||
*UserApi* | [**add_api_token**](docs/UserApi.md#add_api_token) | **POST** /user/{userID}/token | Add an API token
|
||||
*UserApi* | [**delete_api_token**](docs/UserApi.md#delete_api_token) | **DELETE** /user/{userID}/token/{tokenName} | Delete API Token
|
||||
*UserApi* | [**delete_user_by_id**](docs/UserApi.md#delete_user_by_id) | **DELETE** /user/{userID} | Delete user
|
||||
*UserApi* | [**get_user_by_id**](docs/UserApi.md#get_user_by_id) | **GET** /user/{userID} | Get user record
|
||||
*UserApi* | [**update_user_by_id**](docs/UserApi.md#update_user_by_id) | **POST** /user/{userID} | Update user record (SMS number or Display Name only)
|
||||
*UtilApi* | [**get_random_token**](docs/UtilApi.md#get_random_token) | **GET** /randomToken | Get a random 32 character token
|
||||
*UtilApi* | [**get_status**](docs/UtilApi.md#get_status) | **GET** /status | Obtain the overall status of the account tied to the API token in use.
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [ApiToken](docs/ApiToken.md)
|
||||
- [AuthMethods](docs/AuthMethods.md)
|
||||
- [Dns](docs/Dns.md)
|
||||
- [InviteStatus](docs/InviteStatus.md)
|
||||
- [IpRange](docs/IpRange.md)
|
||||
- [Ipv4AssignMode](docs/Ipv4AssignMode.md)
|
||||
- [Ipv6AssignMode](docs/Ipv6AssignMode.md)
|
||||
- [Member](docs/Member.md)
|
||||
- [MemberConfig](docs/MemberConfig.md)
|
||||
- [Network](docs/Network.md)
|
||||
- [NetworkConfig](docs/NetworkConfig.md)
|
||||
- [Organization](docs/Organization.md)
|
||||
- [OrganizationInvitation](docs/OrganizationInvitation.md)
|
||||
- [OrganizationMember](docs/OrganizationMember.md)
|
||||
- [Permissions](docs/Permissions.md)
|
||||
- [RandomToken](docs/RandomToken.md)
|
||||
- [Route](docs/Route.md)
|
||||
- [Status](docs/Status.md)
|
||||
- [StatusLoginMethods](docs/StatusLoginMethods.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
To get access to the crate's generated documentation, use:
|
||||
|
||||
```
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
fn main() {
|
||||
let src = PathBuf::from_str("openapi.json").unwrap();
|
||||
let file = std::fs::File::open(src).unwrap();
|
||||
let spec = serde_json::from_reader(file).unwrap();
|
||||
let mut generator = progenitor::Generator::new();
|
||||
|
||||
let content = generator.generate_text(&spec).unwrap();
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
# ApiToken
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**token_name** | Option<**String**> | user specified token name | [optional]
|
||||
**token** | Option<**String**> | API Token. Minimum 32 characters. This token is encrypted in the database and can not be retrieved once set | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# AuthMethods
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**local** | Option<**String**> | email address for built-in authentication | [optional][readonly]
|
||||
**google** | Option<**String**> | Google OIDC ID | [optional][readonly]
|
||||
**oidc** | Option<**String**> | Generic OIDC ID | [optional][readonly]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# Dns
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**domain** | Option<**String**> | Search domain to use for DNS records | [optional]
|
||||
**servers** | Option<**Vec<String>**> | IP address of unicast DNS service | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# InviteStatus
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# IpRange
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**ip_range_start** | Option<**String**> | | [optional]
|
||||
**ip_range_end** | Option<**String**> | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# Ipv4AssignMode
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**zt** | Option<**bool**> | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# Ipv6AssignMode
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**var_6plane** | Option<**bool**> | | [optional]
|
||||
**rfc4193** | Option<**bool**> | | [optional]
|
||||
**zt** | Option<**bool**> | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user