From 737716f8eb94057c7616ebc58eb255cefda3b69d Mon Sep 17 00:00:00 2001 From: Andrea Mistrali Date: Thu, 27 Jun 2024 16:31:55 +0200 Subject: [PATCH] First working version --- .gitignore | 266 ++++++++++++++ .python-version | 1 + README.md | 0 headscale_api_client/__init__.py | 4 + headscale_api_client/apikeys.py | 26 ++ headscale_api_client/config.py | 25 ++ headscale_api_client/model.py | 48 +++ headscale_api_client/nodes.py | 48 +++ headscale_api_client/routes.py | 27 ++ .../schemas/HeadscaleServiceSetTagsBody.py | 12 + headscale_api_client/schemas/__init__.py | 42 +++ headscale_api_client/schemas/protobufAny.py | 12 + headscale_api_client/schemas/rpcStatus.py | 18 + headscale_api_client/schemas/v1ApiKey.py | 20 ++ .../schemas/v1BackfillNodeIPsResponse.py | 12 + .../schemas/v1CreateApiKeyRequest.py | 12 + .../schemas/v1CreateApiKeyResponse.py | 12 + .../schemas/v1CreatePreAuthKeyRequest.py | 20 ++ .../schemas/v1CreatePreAuthKeyResponse.py | 14 + .../schemas/v1CreateUserRequest.py | 12 + .../schemas/v1CreateUserResponse.py | 14 + .../schemas/v1DebugCreateNodeRequest.py | 18 + .../schemas/v1DebugCreateNodeResponse.py | 14 + .../schemas/v1DeleteApiKeyResponse.py | 10 + .../schemas/v1DeleteNodeResponse.py | 10 + .../schemas/v1DeleteRouteResponse.py | 10 + .../schemas/v1DeleteUserResponse.py | 10 + .../schemas/v1DisableRouteResponse.py | 10 + .../schemas/v1EnableRouteResponse.py | 10 + .../schemas/v1ExpireApiKeyRequest.py | 12 + .../schemas/v1ExpireApiKeyResponse.py | 10 + .../schemas/v1ExpireNodeResponse.py | 14 + .../schemas/v1ExpirePreAuthKeyRequest.py | 14 + .../schemas/v1ExpirePreAuthKeyResponse.py | 10 + .../schemas/v1GetNodeResponse.py | 14 + .../schemas/v1GetNodeRoutesResponse.py | 14 + .../schemas/v1GetRoutesResponse.py | 14 + .../schemas/v1GetUserResponse.py | 14 + .../schemas/v1ListApiKeysResponse.py | 14 + .../schemas/v1ListNodesResponse.py | 14 + .../schemas/v1ListPreAuthKeysResponse.py | 14 + .../schemas/v1ListUsersResponse.py | 14 + .../schemas/v1MoveNodeRequest.py | 12 + .../schemas/v1MoveNodeResponse.py | 14 + headscale_api_client/schemas/v1Node.py | 36 ++ headscale_api_client/schemas/v1PreAuthKey.py | 28 ++ .../schemas/v1RegisterMethod.py | 9 + .../schemas/v1RegisterNodeResponse.py | 14 + .../schemas/v1RenameNodeResponse.py | 14 + .../schemas/v1RenameUserResponse.py | 14 + headscale_api_client/schemas/v1Route.py | 30 ++ .../schemas/v1SetTagsResponse.py | 14 + headscale_api_client/schemas/v1User.py | 16 + headscale_api_client/users.py | 33 ++ main.py | 17 + poetry.lock | 330 ++++++++++++++++++ pyproject.toml | 18 + 57 files changed, 1508 insertions(+) create mode 100644 .gitignore create mode 100644 .python-version create mode 100644 README.md create mode 100644 headscale_api_client/__init__.py create mode 100644 headscale_api_client/apikeys.py create mode 100644 headscale_api_client/config.py create mode 100644 headscale_api_client/model.py create mode 100644 headscale_api_client/nodes.py create mode 100644 headscale_api_client/routes.py create mode 100644 headscale_api_client/schemas/HeadscaleServiceSetTagsBody.py create mode 100644 headscale_api_client/schemas/__init__.py create mode 100644 headscale_api_client/schemas/protobufAny.py create mode 100644 headscale_api_client/schemas/rpcStatus.py create mode 100644 headscale_api_client/schemas/v1ApiKey.py create mode 100644 headscale_api_client/schemas/v1BackfillNodeIPsResponse.py create mode 100644 headscale_api_client/schemas/v1CreateApiKeyRequest.py create mode 100644 headscale_api_client/schemas/v1CreateApiKeyResponse.py create mode 100644 headscale_api_client/schemas/v1CreatePreAuthKeyRequest.py create mode 100644 headscale_api_client/schemas/v1CreatePreAuthKeyResponse.py create mode 100644 headscale_api_client/schemas/v1CreateUserRequest.py create mode 100644 headscale_api_client/schemas/v1CreateUserResponse.py create mode 100644 headscale_api_client/schemas/v1DebugCreateNodeRequest.py create mode 100644 headscale_api_client/schemas/v1DebugCreateNodeResponse.py create mode 100644 headscale_api_client/schemas/v1DeleteApiKeyResponse.py create mode 100644 headscale_api_client/schemas/v1DeleteNodeResponse.py create mode 100644 headscale_api_client/schemas/v1DeleteRouteResponse.py create mode 100644 headscale_api_client/schemas/v1DeleteUserResponse.py create mode 100644 headscale_api_client/schemas/v1DisableRouteResponse.py create mode 100644 headscale_api_client/schemas/v1EnableRouteResponse.py create mode 100644 headscale_api_client/schemas/v1ExpireApiKeyRequest.py create mode 100644 headscale_api_client/schemas/v1ExpireApiKeyResponse.py create mode 100644 headscale_api_client/schemas/v1ExpireNodeResponse.py create mode 100644 headscale_api_client/schemas/v1ExpirePreAuthKeyRequest.py create mode 100644 headscale_api_client/schemas/v1ExpirePreAuthKeyResponse.py create mode 100644 headscale_api_client/schemas/v1GetNodeResponse.py create mode 100644 headscale_api_client/schemas/v1GetNodeRoutesResponse.py create mode 100644 headscale_api_client/schemas/v1GetRoutesResponse.py create mode 100644 headscale_api_client/schemas/v1GetUserResponse.py create mode 100644 headscale_api_client/schemas/v1ListApiKeysResponse.py create mode 100644 headscale_api_client/schemas/v1ListNodesResponse.py create mode 100644 headscale_api_client/schemas/v1ListPreAuthKeysResponse.py create mode 100644 headscale_api_client/schemas/v1ListUsersResponse.py create mode 100644 headscale_api_client/schemas/v1MoveNodeRequest.py create mode 100644 headscale_api_client/schemas/v1MoveNodeResponse.py create mode 100644 headscale_api_client/schemas/v1Node.py create mode 100644 headscale_api_client/schemas/v1PreAuthKey.py create mode 100644 headscale_api_client/schemas/v1RegisterMethod.py create mode 100644 headscale_api_client/schemas/v1RegisterNodeResponse.py create mode 100644 headscale_api_client/schemas/v1RenameNodeResponse.py create mode 100644 headscale_api_client/schemas/v1RenameUserResponse.py create mode 100644 headscale_api_client/schemas/v1Route.py create mode 100644 headscale_api_client/schemas/v1SetTagsResponse.py create mode 100644 headscale_api_client/schemas/v1User.py create mode 100644 headscale_api_client/users.py create mode 100644 main.py create mode 100644 poetry.lock create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fecda6e --- /dev/null +++ b/.gitignore @@ -0,0 +1,266 @@ +# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig +# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,linux,python,vim +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,linux,python,vim + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,linux,python,vim + +# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..051a30c --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +headscale diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/headscale_api_client/__init__.py b/headscale_api_client/__init__.py new file mode 100644 index 0000000..1b77937 --- /dev/null +++ b/headscale_api_client/__init__.py @@ -0,0 +1,4 @@ +from .apikeys import APIKey +from .nodes import Node +from .users import User +from .routes import Route diff --git a/headscale_api_client/apikeys.py b/headscale_api_client/apikeys.py new file mode 100644 index 0000000..d7b3ad7 --- /dev/null +++ b/headscale_api_client/apikeys.py @@ -0,0 +1,26 @@ +from .model import HSAPICall +from headscale_api_client.schemas import (v1CreateApiKeyRequest, + v1ListApiKeysResponse, + v1CreateApiKeyResponse, + v1ExpireApiKeyRequest, + v1ExpireApiKeyResponse, + v1DeleteApiKeyResponse) + + +class APIKey(HSAPICall): + + def list(self) -> v1ListApiKeysResponse: + response = self.call('get', 'apikey') + return v1ListApiKeysResponse(**response.json()) + + def create(self, data: v1CreateApiKeyRequest) -> v1CreateApiKeyResponse: + response = self.call('post', 'apikey', data) + return v1CreateApiKeyResponse(**response.json()) + + def expire(self, data: v1ExpireApiKeyRequest) -> v1ExpireApiKeyResponse: + response = self.call('post', 'apikey/expire', data) + return v1ExpireApiKeyResponse(**response.json()) + + def delete(self, prefix: str) -> v1DeleteApiKeyResponse: + response = self.call('delete', f'apikey/{prefix}') + return v1DeleteApiKeyResponse(**response.json()) diff --git a/headscale_api_client/config.py b/headscale_api_client/config.py new file mode 100644 index 0000000..a0af05a --- /dev/null +++ b/headscale_api_client/config.py @@ -0,0 +1,25 @@ +import os +from typing import Optional, Union + +from pydantic_settings import BaseSettings, SettingsConfigDict + + +class APISettings(BaseSettings): + model_config = SettingsConfigDict(env_prefix='HS_') + server: str = "http://localhost:8080" + api_path: str = "/api/v1" + ssl_verify: Union[bool, str] = True + api_token: Union[None, str] = None + + def refresh_api_token(self): + self.api_token = os.environ.get('HS_API_TOKEN') + + +class HTTPException(Exception): + def __init__(self, status_code: int, message: str): + self.status_code = status_code + self.message = message + super().__init__(f"{status_code} {message}") + + def __str__(self): + return f"{self.status_code} {self.message}" diff --git a/headscale_api_client/model.py b/headscale_api_client/model.py new file mode 100644 index 0000000..a99ba62 --- /dev/null +++ b/headscale_api_client/model.py @@ -0,0 +1,48 @@ +from .schemas import * +from .config import APISettings, HTTPException +import requests + + +class HSAPICall: + """ + Generic API call. + It has a call() method that wants: + - a method (GET, POST, DELETE); + - a subpath, that is appended to /api/v1 + - optional `data` payload + """ + + objectPath: str = "" + + def __init__(self, api_settings_override: Optional[APISettings] = None) -> None: + if api_settings_override: + self.api_settings = api_settings_override + else: + self.api_settings = APISettings() + self.base_path = f"{ + self.api_settings.server}{self.api_settings.api_path}/{self.objectPath}" + + def call(self, method, call_path: str = "", data=None): + headers = { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": f"Bearer {self.api_settings.api_token}", + } + + json_ = data.dict() if data else dict() + + path = '/'.join([self.base_path, str(call_path)] + ) if call_path else self.base_path + + response = requests.request( + method, + path, + headers=headers, + verify=self.api_settings.ssl_verify, + json=json_ + ) + if response.status_code != 200: + raise HTTPException(response.status_code, f" failed with status code: { + response.text}") + + return response diff --git a/headscale_api_client/nodes.py b/headscale_api_client/nodes.py new file mode 100644 index 0000000..927ba94 --- /dev/null +++ b/headscale_api_client/nodes.py @@ -0,0 +1,48 @@ +from .model import HSAPICall +from headscale_api_client.schemas import (v1ListNodesResponse, + v1GetNodeResponse, + v1DeleteNodeResponse, + v1ExpireNodeResponse, v1MoveNodeRequest, + v1RenameNodeResponse, + v1MoveNodeRequest, + v1MoveNodeResponse, + v1GetNodeRoutesResponse, + v1SetTagsResponse, + HeadscaleServiceSetTagsBody) + + +class Node(HSAPICall): + + objectPath = "node" + + def list(self) -> v1ListNodesResponse: + response = self.call('get') + return v1ListNodesResponse(**response.json()) + + def get(self, nodeId: str) -> v1GetNodeResponse: + response = self.call('get', call_path=nodeId) + return v1GetNodeResponse(**response.json()) + + def delete(self, nodeId: str) -> v1DeleteNodeResponse: + response = self.call('delete', call_path=nodeId) + return v1DeleteNodeResponse(**response.json()) + + def expire(self, nodeId: str) -> v1ExpireNodeResponse: + response = self.call('post', f'{nodeId}/expire') + return v1ExpireNodeResponse()(**response.json()) + + def rename(self, nodeId: str, newName: str) -> v1RenameNodeResponse: + response = self.call('post', f'{nodeId}/rename/{newName}') + return v1RenameNodeResponse(**response.json()) + + def move(self, nodeId: str, data: v1MoveNodeRequest) -> v1MoveNodeResponse: + response = self.call('post', f'{nodeId}/user', data) + return v1MoveNodeResponse()(**response.json()) + + def routes(self, nodeId: str) -> v1GetNodeRoutesResponse: + response = self.call('get', f'{nodeId}/routes') + return v1GetNodeRoutesResponse(**response.json()) + + def setTags(self, nodeId: str, data: HeadscaleServiceSetTagsBody) -> v1SetTagsResponse: + response = self.call('post', f'{nodeId}/tags', data) + return v1SetTagsResponse(**response.json()) diff --git a/headscale_api_client/routes.py b/headscale_api_client/routes.py new file mode 100644 index 0000000..16cc084 --- /dev/null +++ b/headscale_api_client/routes.py @@ -0,0 +1,27 @@ +from .model import HSAPICall +from headscale_api_client.schemas import (v1GetRoutesResponse, + v1DeleteRouteResponse, + v1EnableRouteResponse, + v1DisableRouteResponse, + ) + + +class Route(HSAPICall): + + objectPath = "routes" + + def list(self) -> v1GetRoutesResponse: + response = self.call('get') + return v1GetRoutesResponse(**response.json()) + + def delete(self, routeId: str) -> v1DeleteRouteResponse: + response = self.call('delete', call_path=routeId) + return v1DeleteRouteResponse(**response.json()) + + def enable(self, routeId: str) -> v1EnableRouteResponse: + response = self.call('post', f'{routeId}/enable') + return v1EnableRouteResponse(**response.json()) + + def disable(self, routeId: str) -> v1DisableRouteResponse: + response = self.call('post', f'{routeId}/disable') + return v1DisableRouteResponse(**response.json()) diff --git a/headscale_api_client/schemas/HeadscaleServiceSetTagsBody.py b/headscale_api_client/schemas/HeadscaleServiceSetTagsBody.py new file mode 100644 index 0000000..c6b1a1a --- /dev/null +++ b/headscale_api_client/schemas/HeadscaleServiceSetTagsBody.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class HeadscaleServiceSetTagsBody(BaseModel): + """ + None model + + """ + + tags: Optional[List[str]] = Field(alias="tags", default=None) diff --git a/headscale_api_client/schemas/__init__.py b/headscale_api_client/schemas/__init__.py new file mode 100644 index 0000000..a61c3c1 --- /dev/null +++ b/headscale_api_client/schemas/__init__.py @@ -0,0 +1,42 @@ +from .HeadscaleServiceSetTagsBody import * +from .protobufAny import * +from .rpcStatus import * +from .v1ApiKey import * +from .v1BackfillNodeIPsResponse import * +from .v1CreateApiKeyRequest import * +from .v1CreateApiKeyResponse import * +from .v1CreatePreAuthKeyRequest import * +from .v1CreatePreAuthKeyResponse import * +from .v1CreateUserRequest import * +from .v1CreateUserResponse import * +from .v1DebugCreateNodeRequest import * +from .v1DebugCreateNodeResponse import * +from .v1DeleteApiKeyResponse import * +from .v1DeleteNodeResponse import * +from .v1DeleteRouteResponse import * +from .v1DeleteUserResponse import * +from .v1DisableRouteResponse import * +from .v1EnableRouteResponse import * +from .v1ExpireApiKeyRequest import * +from .v1ExpireApiKeyResponse import * +from .v1ExpireNodeResponse import * +from .v1ExpirePreAuthKeyRequest import * +from .v1ExpirePreAuthKeyResponse import * +from .v1GetNodeResponse import * +from .v1GetNodeRoutesResponse import * +from .v1GetRoutesResponse import * +from .v1GetUserResponse import * +from .v1ListApiKeysResponse import * +from .v1ListNodesResponse import * +from .v1ListPreAuthKeysResponse import * +from .v1ListUsersResponse import * +from .v1MoveNodeResponse import * +from .v1Node import * +from .v1PreAuthKey import * +from .v1RegisterMethod import * +from .v1RegisterNodeResponse import * +from .v1RenameNodeResponse import * +from .v1RenameUserResponse import * +from .v1Route import * +from .v1SetTagsResponse import * +from .v1User import * diff --git a/headscale_api_client/schemas/protobufAny.py b/headscale_api_client/schemas/protobufAny.py new file mode 100644 index 0000000..bcc0bd6 --- /dev/null +++ b/headscale_api_client/schemas/protobufAny.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class protobufAny(BaseModel): + """ + None model + + """ + + type: Optional[str] = Field(alias="@type", default=None) diff --git a/headscale_api_client/schemas/rpcStatus.py b/headscale_api_client/schemas/rpcStatus.py new file mode 100644 index 0000000..e34a872 --- /dev/null +++ b/headscale_api_client/schemas/rpcStatus.py @@ -0,0 +1,18 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .protobufAny import protobufAny + + +class rpcStatus(BaseModel): + """ + None model + + """ + + code: Optional[int] = Field(alias="code", default=None) + + message: Optional[str] = Field(alias="message", default=None) + + details: Optional[List[Optional[protobufAny]]] = Field(alias="details", default=None) diff --git a/headscale_api_client/schemas/v1ApiKey.py b/headscale_api_client/schemas/v1ApiKey.py new file mode 100644 index 0000000..7235d50 --- /dev/null +++ b/headscale_api_client/schemas/v1ApiKey.py @@ -0,0 +1,20 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1ApiKey(BaseModel): + """ + None model + + """ + + id: Optional[str] = Field(alias="id", default=None) + + prefix: Optional[str] = Field(alias="prefix", default=None) + + expiration: Optional[str] = Field(alias="expiration", default=None) + + createdAt: Optional[str] = Field(alias="createdAt", default=None) + + lastSeen: Optional[str] = Field(alias="lastSeen", default=None) diff --git a/headscale_api_client/schemas/v1BackfillNodeIPsResponse.py b/headscale_api_client/schemas/v1BackfillNodeIPsResponse.py new file mode 100644 index 0000000..c20348d --- /dev/null +++ b/headscale_api_client/schemas/v1BackfillNodeIPsResponse.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1BackfillNodeIPsResponse(BaseModel): + """ + None model + + """ + + changes: Optional[List[str]] = Field(alias="changes", default=None) diff --git a/headscale_api_client/schemas/v1CreateApiKeyRequest.py b/headscale_api_client/schemas/v1CreateApiKeyRequest.py new file mode 100644 index 0000000..51c74ad --- /dev/null +++ b/headscale_api_client/schemas/v1CreateApiKeyRequest.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1CreateApiKeyRequest(BaseModel): + """ + None model + + """ + + expiration: Optional[str] = Field(alias="expiration", default=None) diff --git a/headscale_api_client/schemas/v1CreateApiKeyResponse.py b/headscale_api_client/schemas/v1CreateApiKeyResponse.py new file mode 100644 index 0000000..95709e8 --- /dev/null +++ b/headscale_api_client/schemas/v1CreateApiKeyResponse.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1CreateApiKeyResponse(BaseModel): + """ + None model + + """ + + apiKey: Optional[str] = Field(alias="apiKey", default=None) diff --git a/headscale_api_client/schemas/v1CreatePreAuthKeyRequest.py b/headscale_api_client/schemas/v1CreatePreAuthKeyRequest.py new file mode 100644 index 0000000..394dcb6 --- /dev/null +++ b/headscale_api_client/schemas/v1CreatePreAuthKeyRequest.py @@ -0,0 +1,20 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1CreatePreAuthKeyRequest(BaseModel): + """ + None model + + """ + + user: Optional[str] = Field(alias="user", default=None) + + reusable: Optional[bool] = Field(alias="reusable", default=None) + + ephemeral: Optional[bool] = Field(alias="ephemeral", default=None) + + expiration: Optional[str] = Field(alias="expiration", default=None) + + aclTags: Optional[List[str]] = Field(alias="aclTags", default=None) diff --git a/headscale_api_client/schemas/v1CreatePreAuthKeyResponse.py b/headscale_api_client/schemas/v1CreatePreAuthKeyResponse.py new file mode 100644 index 0000000..3a962f1 --- /dev/null +++ b/headscale_api_client/schemas/v1CreatePreAuthKeyResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1PreAuthKey import v1PreAuthKey + + +class v1CreatePreAuthKeyResponse(BaseModel): + """ + None model + + """ + + preAuthKey: Optional[v1PreAuthKey] = Field(alias="preAuthKey", default=None) diff --git a/headscale_api_client/schemas/v1CreateUserRequest.py b/headscale_api_client/schemas/v1CreateUserRequest.py new file mode 100644 index 0000000..919dda1 --- /dev/null +++ b/headscale_api_client/schemas/v1CreateUserRequest.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1CreateUserRequest(BaseModel): + """ + None model + + """ + + name: Optional[str] = Field(alias="name", default=None) diff --git a/headscale_api_client/schemas/v1CreateUserResponse.py b/headscale_api_client/schemas/v1CreateUserResponse.py new file mode 100644 index 0000000..bf890dd --- /dev/null +++ b/headscale_api_client/schemas/v1CreateUserResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1User import v1User + + +class v1CreateUserResponse(BaseModel): + """ + None model + + """ + + user: Optional[v1User] = Field(alias="user", default=None) diff --git a/headscale_api_client/schemas/v1DebugCreateNodeRequest.py b/headscale_api_client/schemas/v1DebugCreateNodeRequest.py new file mode 100644 index 0000000..48792f3 --- /dev/null +++ b/headscale_api_client/schemas/v1DebugCreateNodeRequest.py @@ -0,0 +1,18 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1DebugCreateNodeRequest(BaseModel): + """ + None model + + """ + + user: Optional[str] = Field(alias="user", default=None) + + key: Optional[str] = Field(alias="key", default=None) + + name: Optional[str] = Field(alias="name", default=None) + + routes: Optional[List[str]] = Field(alias="routes", default=None) diff --git a/headscale_api_client/schemas/v1DebugCreateNodeResponse.py b/headscale_api_client/schemas/v1DebugCreateNodeResponse.py new file mode 100644 index 0000000..1d0ca31 --- /dev/null +++ b/headscale_api_client/schemas/v1DebugCreateNodeResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1DebugCreateNodeResponse(BaseModel): + """ + None model + + """ + + node: Optional[v1Node] = Field(alias="node", default=None) diff --git a/headscale_api_client/schemas/v1DeleteApiKeyResponse.py b/headscale_api_client/schemas/v1DeleteApiKeyResponse.py new file mode 100644 index 0000000..eb0a7bc --- /dev/null +++ b/headscale_api_client/schemas/v1DeleteApiKeyResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1DeleteApiKeyResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1DeleteNodeResponse.py b/headscale_api_client/schemas/v1DeleteNodeResponse.py new file mode 100644 index 0000000..9e25b10 --- /dev/null +++ b/headscale_api_client/schemas/v1DeleteNodeResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1DeleteNodeResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1DeleteRouteResponse.py b/headscale_api_client/schemas/v1DeleteRouteResponse.py new file mode 100644 index 0000000..7b333ce --- /dev/null +++ b/headscale_api_client/schemas/v1DeleteRouteResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1DeleteRouteResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1DeleteUserResponse.py b/headscale_api_client/schemas/v1DeleteUserResponse.py new file mode 100644 index 0000000..e8b63cb --- /dev/null +++ b/headscale_api_client/schemas/v1DeleteUserResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1DeleteUserResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1DisableRouteResponse.py b/headscale_api_client/schemas/v1DisableRouteResponse.py new file mode 100644 index 0000000..0401cfc --- /dev/null +++ b/headscale_api_client/schemas/v1DisableRouteResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1DisableRouteResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1EnableRouteResponse.py b/headscale_api_client/schemas/v1EnableRouteResponse.py new file mode 100644 index 0000000..b7a7586 --- /dev/null +++ b/headscale_api_client/schemas/v1EnableRouteResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1EnableRouteResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1ExpireApiKeyRequest.py b/headscale_api_client/schemas/v1ExpireApiKeyRequest.py new file mode 100644 index 0000000..43ae93d --- /dev/null +++ b/headscale_api_client/schemas/v1ExpireApiKeyRequest.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1ExpireApiKeyRequest(BaseModel): + """ + None model + + """ + + prefix: Optional[str] = Field(alias="prefix", default=None) diff --git a/headscale_api_client/schemas/v1ExpireApiKeyResponse.py b/headscale_api_client/schemas/v1ExpireApiKeyResponse.py new file mode 100644 index 0000000..4d8b72e --- /dev/null +++ b/headscale_api_client/schemas/v1ExpireApiKeyResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1ExpireApiKeyResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1ExpireNodeResponse.py b/headscale_api_client/schemas/v1ExpireNodeResponse.py new file mode 100644 index 0000000..16eb7f2 --- /dev/null +++ b/headscale_api_client/schemas/v1ExpireNodeResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1ExpireNodeResponse(BaseModel): + """ + None model + + """ + + node: Optional[v1Node] = Field(alias="node", default=None) diff --git a/headscale_api_client/schemas/v1ExpirePreAuthKeyRequest.py b/headscale_api_client/schemas/v1ExpirePreAuthKeyRequest.py new file mode 100644 index 0000000..2e401d8 --- /dev/null +++ b/headscale_api_client/schemas/v1ExpirePreAuthKeyRequest.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1ExpirePreAuthKeyRequest(BaseModel): + """ + None model + + """ + + user: Optional[str] = Field(alias="user", default=None) + + key: Optional[str] = Field(alias="key", default=None) diff --git a/headscale_api_client/schemas/v1ExpirePreAuthKeyResponse.py b/headscale_api_client/schemas/v1ExpirePreAuthKeyResponse.py new file mode 100644 index 0000000..af44c0f --- /dev/null +++ b/headscale_api_client/schemas/v1ExpirePreAuthKeyResponse.py @@ -0,0 +1,10 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1ExpirePreAuthKeyResponse(BaseModel): + """ + None model + + """ diff --git a/headscale_api_client/schemas/v1GetNodeResponse.py b/headscale_api_client/schemas/v1GetNodeResponse.py new file mode 100644 index 0000000..adfeb17 --- /dev/null +++ b/headscale_api_client/schemas/v1GetNodeResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1GetNodeResponse(BaseModel): + """ + None model + + """ + + node: Optional[v1Node] = Field(alias="node", default=None) diff --git a/headscale_api_client/schemas/v1GetNodeRoutesResponse.py b/headscale_api_client/schemas/v1GetNodeRoutesResponse.py new file mode 100644 index 0000000..f48cf40 --- /dev/null +++ b/headscale_api_client/schemas/v1GetNodeRoutesResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Route import v1Route + + +class v1GetNodeRoutesResponse(BaseModel): + """ + None model + + """ + + routes: Optional[List[Optional[v1Route]]] = Field(alias="routes", default=None) diff --git a/headscale_api_client/schemas/v1GetRoutesResponse.py b/headscale_api_client/schemas/v1GetRoutesResponse.py new file mode 100644 index 0000000..cea6379 --- /dev/null +++ b/headscale_api_client/schemas/v1GetRoutesResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Route import v1Route + + +class v1GetRoutesResponse(BaseModel): + """ + None model + + """ + + routes: Optional[List[Optional[v1Route]]] = Field(alias="routes", default=None) diff --git a/headscale_api_client/schemas/v1GetUserResponse.py b/headscale_api_client/schemas/v1GetUserResponse.py new file mode 100644 index 0000000..a523b2d --- /dev/null +++ b/headscale_api_client/schemas/v1GetUserResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1User import v1User + + +class v1GetUserResponse(BaseModel): + """ + None model + + """ + + user: Optional[v1User] = Field(alias="user", default=None) diff --git a/headscale_api_client/schemas/v1ListApiKeysResponse.py b/headscale_api_client/schemas/v1ListApiKeysResponse.py new file mode 100644 index 0000000..470be2a --- /dev/null +++ b/headscale_api_client/schemas/v1ListApiKeysResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1ApiKey import v1ApiKey + + +class v1ListApiKeysResponse(BaseModel): + """ + None model + + """ + + apiKeys: Optional[List[Optional[v1ApiKey]]] = Field(alias="apiKeys", default=None) diff --git a/headscale_api_client/schemas/v1ListNodesResponse.py b/headscale_api_client/schemas/v1ListNodesResponse.py new file mode 100644 index 0000000..33b321b --- /dev/null +++ b/headscale_api_client/schemas/v1ListNodesResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1ListNodesResponse(BaseModel): + """ + None model + + """ + + nodes: Optional[List[Optional[v1Node]]] = Field(alias="nodes", default=None) diff --git a/headscale_api_client/schemas/v1ListPreAuthKeysResponse.py b/headscale_api_client/schemas/v1ListPreAuthKeysResponse.py new file mode 100644 index 0000000..0a71756 --- /dev/null +++ b/headscale_api_client/schemas/v1ListPreAuthKeysResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1PreAuthKey import v1PreAuthKey + + +class v1ListPreAuthKeysResponse(BaseModel): + """ + None model + + """ + + preAuthKeys: Optional[List[Optional[v1PreAuthKey]]] = Field(alias="preAuthKeys", default=None) diff --git a/headscale_api_client/schemas/v1ListUsersResponse.py b/headscale_api_client/schemas/v1ListUsersResponse.py new file mode 100644 index 0000000..be8d830 --- /dev/null +++ b/headscale_api_client/schemas/v1ListUsersResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1User import v1User + + +class v1ListUsersResponse(BaseModel): + """ + None model + + """ + + users: Optional[List[Optional[v1User]]] = Field(alias="users", default=None) diff --git a/headscale_api_client/schemas/v1MoveNodeRequest.py b/headscale_api_client/schemas/v1MoveNodeRequest.py new file mode 100644 index 0000000..b8b02b1 --- /dev/null +++ b/headscale_api_client/schemas/v1MoveNodeRequest.py @@ -0,0 +1,12 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1DebugCreateNodeRequest(BaseModel): + """ + None model + + """ + + user: Optional[str] = Field(alias="user", default=None) diff --git a/headscale_api_client/schemas/v1MoveNodeResponse.py b/headscale_api_client/schemas/v1MoveNodeResponse.py new file mode 100644 index 0000000..37390d4 --- /dev/null +++ b/headscale_api_client/schemas/v1MoveNodeResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1MoveNodeResponse(BaseModel): + """ + None model + + """ + + node: Optional[v1Node] = Field(alias="node", default=None) diff --git a/headscale_api_client/schemas/v1Node.py b/headscale_api_client/schemas/v1Node.py new file mode 100644 index 0000000..49b78a7 --- /dev/null +++ b/headscale_api_client/schemas/v1Node.py @@ -0,0 +1,36 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1PreAuthKey import v1PreAuthKey +from .v1RegisterMethod import v1RegisterMethod +from .v1User import v1User + + +class v1Node(BaseModel): + """ + None model + + """ + + id: Optional[str] = Field(alias="id", default=None) + machineKey: Optional[str] = Field(alias="machineKey", default=None) + nodeKey: Optional[str] = Field(alias="nodeKey", default=None) + discoKey: Optional[str] = Field(alias="discoKey", default=None) + ipAddresses: Optional[List[str]] = Field(alias="ipAddresses", default=None) + name: Optional[str] = Field(alias="name", default=None) + user: Optional[v1User] = Field(alias="user", default=None) + lastSeen: Optional[str] = Field(alias="lastSeen", default=None) + expiry: Optional[str] = Field(alias="expiry", default=None) + preAuthKey: Optional[v1PreAuthKey] = Field( + alias="preAuthKey", default=None) + + createdAt: Optional[str] = Field(alias="createdAt", default=None) + registerMethod: Optional[v1RegisterMethod] = Field( + alias="registerMethod", default=None) + + forcedTags: Optional[List[str]] = Field(alias="forcedTags", default=None) + invalidTags: Optional[List[str]] = Field(alias="invalidTags", default=None) + validTags: Optional[List[str]] = Field(alias="validTags", default=None) + givenName: Optional[str] = Field(alias="givenName", default=None) + online: Optional[bool] = Field(alias="online", default=None) diff --git a/headscale_api_client/schemas/v1PreAuthKey.py b/headscale_api_client/schemas/v1PreAuthKey.py new file mode 100644 index 0000000..57a8b27 --- /dev/null +++ b/headscale_api_client/schemas/v1PreAuthKey.py @@ -0,0 +1,28 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1PreAuthKey(BaseModel): + """ + None model + + """ + + user: Optional[str] = Field(alias="user", default=None) + + id: Optional[str] = Field(alias="id", default=None) + + key: Optional[str] = Field(alias="key", default=None) + + reusable: Optional[bool] = Field(alias="reusable", default=None) + + ephemeral: Optional[bool] = Field(alias="ephemeral", default=None) + + used: Optional[bool] = Field(alias="used", default=None) + + expiration: Optional[str] = Field(alias="expiration", default=None) + + createdAt: Optional[str] = Field(alias="createdAt", default=None) + + aclTags: Optional[List[str]] = Field(alias="aclTags", default=None) diff --git a/headscale_api_client/schemas/v1RegisterMethod.py b/headscale_api_client/schemas/v1RegisterMethod.py new file mode 100644 index 0000000..c812382 --- /dev/null +++ b/headscale_api_client/schemas/v1RegisterMethod.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class v1RegisterMethod(str, Enum): + + REGISTER_METHOD_UNSPECIFIED = "REGISTER_METHOD_UNSPECIFIED" + REGISTER_METHOD_AUTH_KEY = "REGISTER_METHOD_AUTH_KEY" + REGISTER_METHOD_CLI = "REGISTER_METHOD_CLI" + REGISTER_METHOD_OIDC = "REGISTER_METHOD_OIDC" diff --git a/headscale_api_client/schemas/v1RegisterNodeResponse.py b/headscale_api_client/schemas/v1RegisterNodeResponse.py new file mode 100644 index 0000000..0ee8719 --- /dev/null +++ b/headscale_api_client/schemas/v1RegisterNodeResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1RegisterNodeResponse(BaseModel): + """ + None model + + """ + + node: Optional[v1Node] = Field(alias="node", default=None) diff --git a/headscale_api_client/schemas/v1RenameNodeResponse.py b/headscale_api_client/schemas/v1RenameNodeResponse.py new file mode 100644 index 0000000..a5b57b0 --- /dev/null +++ b/headscale_api_client/schemas/v1RenameNodeResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1RenameNodeResponse(BaseModel): + """ + None model + + """ + + node: Optional[v1Node] = Field(alias="node", default=None) diff --git a/headscale_api_client/schemas/v1RenameUserResponse.py b/headscale_api_client/schemas/v1RenameUserResponse.py new file mode 100644 index 0000000..1e223e3 --- /dev/null +++ b/headscale_api_client/schemas/v1RenameUserResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1User import v1User + + +class v1RenameUserResponse(BaseModel): + """ + None model + + """ + + user: Optional[v1User] = Field(alias="user", default=None) diff --git a/headscale_api_client/schemas/v1Route.py b/headscale_api_client/schemas/v1Route.py new file mode 100644 index 0000000..4fb5b2c --- /dev/null +++ b/headscale_api_client/schemas/v1Route.py @@ -0,0 +1,30 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1Route(BaseModel): + """ + None model + + """ + + id: Optional[str] = Field(alias="id", default=None) + + node: Optional[v1Node] = Field(alias="node", default=None) + + prefix: Optional[str] = Field(alias="prefix", default=None) + + advertised: Optional[bool] = Field(alias="advertised", default=None) + + enabled: Optional[bool] = Field(alias="enabled", default=None) + + isPrimary: Optional[bool] = Field(alias="isPrimary", default=None) + + createdAt: Optional[str] = Field(alias="createdAt", default=None) + + updatedAt: Optional[str] = Field(alias="updatedAt", default=None) + + deletedAt: Optional[str] = Field(alias="deletedAt", default=None) diff --git a/headscale_api_client/schemas/v1SetTagsResponse.py b/headscale_api_client/schemas/v1SetTagsResponse.py new file mode 100644 index 0000000..be86320 --- /dev/null +++ b/headscale_api_client/schemas/v1SetTagsResponse.py @@ -0,0 +1,14 @@ +from typing import * + +from pydantic import BaseModel, Field + +from .v1Node import v1Node + + +class v1SetTagsResponse(BaseModel): + """ + None model + + """ + + node: Optional[v1Node] = Field(alias="node", default=None) diff --git a/headscale_api_client/schemas/v1User.py b/headscale_api_client/schemas/v1User.py new file mode 100644 index 0000000..6037ef8 --- /dev/null +++ b/headscale_api_client/schemas/v1User.py @@ -0,0 +1,16 @@ +from typing import * + +from pydantic import BaseModel, Field + + +class v1User(BaseModel): + """ + None model + + """ + + id: Optional[str] = Field(alias="id", default=None) + + name: Optional[str] = Field(alias="name", default=None) + + createdAt: Optional[str] = Field(alias="createdAt", default=None) diff --git a/headscale_api_client/users.py b/headscale_api_client/users.py new file mode 100644 index 0000000..5caae4c --- /dev/null +++ b/headscale_api_client/users.py @@ -0,0 +1,33 @@ +from .model import HSAPICall +from headscale_api_client.schemas import (v1CreateUserRequest, + v1CreateUserResponse, + v1DeleteUserResponse, + v1ListUsersResponse, + v1GetUserResponse, + v1RenameUserResponse, + ) + + +class User(HSAPICall): + + objectPath = "user" + + def list(self) -> v1ListUsersResponse: + response = self.call('get') + return v1ListUsersResponse(**response.json()) + + def get(self, name: str) -> v1GetUserResponse: + response = self.call('get', call_path=name) + return v1GetUserResponse(**response.json()) + + def create(self, data: v1CreateUserRequest) -> v1CreateUserResponse: + response = self.call('post', data=data) + return v1CreateUserResponse(**response.json()) + + def delete(self, name: str) -> v1DeleteUserResponse: + response = self.call('delete', name) + return v1DeleteUserResponse(**response.json()) + + def rename(self, oldName: str, newName: str) -> v1RenameUserResponse: + response = self.call('post', call_path=f"{oldName}/rename/{newName}") + return v1RenameUserResponse(**response.json()) diff --git a/main.py b/main.py new file mode 100644 index 0000000..f0920a4 --- /dev/null +++ b/main.py @@ -0,0 +1,17 @@ +#! /usr/bin/env python3 +# vim:fenc=utf-8 +# +# Copyright © 2024 andre +# +# Distributed under terms of the MIT license. + +""" + +""" + +import headscale_api_client + +import os + +os.environ['HS_API_TOKEN']='09-Cd1WbZw.uohjzoBQ2x1Bf9fsu5lXjzK03oO8oX9Mkty8AhESOos' +os.environ['HS_SERVER']='https://headscale.arringo.co' diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..cb7d19b --- /dev/null +++ b/poetry.lock @@ -0,0 +1,330 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "annotated-types" +version = "0.7.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.8" +files = [ + {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, + {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, +] + +[[package]] +name = "certifi" +version = "2024.6.2" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.6" +files = [ + {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, + {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, +] + +[[package]] +name = "charset-normalizer" +version = "3.3.2" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-win32.whl", hash = "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-win32.whl", hash = "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-win_amd64.whl", hash = "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-win32.whl", hash = "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-win32.whl", hash = "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d"}, + {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, +] + +[[package]] +name = "idna" +version = "3.7" +description = "Internationalized Domain Names in Applications (IDNA)" +optional = false +python-versions = ">=3.5" +files = [ + {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, + {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, +] + +[[package]] +name = "pydantic" +version = "2.7.4" +description = "Data validation using Python type hints" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic-2.7.4-py3-none-any.whl", hash = "sha256:ee8538d41ccb9c0a9ad3e0e5f07bf15ed8015b481ced539a1759d8cc89ae90d0"}, + {file = "pydantic-2.7.4.tar.gz", hash = "sha256:0c84efd9548d545f63ac0060c1e4d39bb9b14db8b3c0652338aecc07b5adec52"}, +] + +[package.dependencies] +annotated-types = ">=0.4.0" +pydantic-core = "2.18.4" +typing-extensions = ">=4.6.1" + +[package.extras] +email = ["email-validator (>=2.0.0)"] + +[[package]] +name = "pydantic-core" +version = "2.18.4" +description = "Core functionality for Pydantic validation and serialization" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic_core-2.18.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:f76d0ad001edd426b92233d45c746fd08f467d56100fd8f30e9ace4b005266e4"}, + {file = "pydantic_core-2.18.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:59ff3e89f4eaf14050c8022011862df275b552caef8082e37b542b066ce1ff26"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a55b5b16c839df1070bc113c1f7f94a0af4433fcfa1b41799ce7606e5c79ce0a"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4d0dcc59664fcb8974b356fe0a18a672d6d7cf9f54746c05f43275fc48636851"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8951eee36c57cd128f779e641e21eb40bc5073eb28b2d23f33eb0ef14ffb3f5d"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4701b19f7e3a06ea655513f7938de6f108123bf7c86bbebb1196eb9bd35cf724"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e00a3f196329e08e43d99b79b286d60ce46bed10f2280d25a1718399457e06be"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:97736815b9cc893b2b7f663628e63f436018b75f44854c8027040e05230eeddb"}, + {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:6891a2ae0e8692679c07728819b6e2b822fb30ca7445f67bbf6509b25a96332c"}, + {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bc4ff9805858bd54d1a20efff925ccd89c9d2e7cf4986144b30802bf78091c3e"}, + {file = "pydantic_core-2.18.4-cp310-none-win32.whl", hash = "sha256:1b4de2e51bbcb61fdebd0ab86ef28062704f62c82bbf4addc4e37fa4b00b7cbc"}, + {file = "pydantic_core-2.18.4-cp310-none-win_amd64.whl", hash = "sha256:6a750aec7bf431517a9fd78cb93c97b9b0c496090fee84a47a0d23668976b4b0"}, + {file = "pydantic_core-2.18.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:942ba11e7dfb66dc70f9ae66b33452f51ac7bb90676da39a7345e99ffb55402d"}, + {file = "pydantic_core-2.18.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b2ebef0e0b4454320274f5e83a41844c63438fdc874ea40a8b5b4ecb7693f1c4"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a642295cd0c8df1b86fc3dced1d067874c353a188dc8e0f744626d49e9aa51c4"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f09baa656c904807e832cf9cce799c6460c450c4ad80803517032da0cd062e2"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:98906207f29bc2c459ff64fa007afd10a8c8ac080f7e4d5beff4c97086a3dabd"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:19894b95aacfa98e7cb093cd7881a0c76f55731efad31073db4521e2b6ff5b7d"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fbbdc827fe5e42e4d196c746b890b3d72876bdbf160b0eafe9f0334525119c8"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f85d05aa0918283cf29a30b547b4df2fbb56b45b135f9e35b6807cb28bc47951"}, + {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e85637bc8fe81ddb73fda9e56bab24560bdddfa98aa64f87aaa4e4b6730c23d2"}, + {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2f5966897e5461f818e136b8451d0551a2e77259eb0f73a837027b47dc95dab9"}, + {file = "pydantic_core-2.18.4-cp311-none-win32.whl", hash = "sha256:44c7486a4228413c317952e9d89598bcdfb06399735e49e0f8df643e1ccd0558"}, + {file = "pydantic_core-2.18.4-cp311-none-win_amd64.whl", hash = "sha256:8a7164fe2005d03c64fd3b85649891cd4953a8de53107940bf272500ba8a788b"}, + {file = "pydantic_core-2.18.4-cp311-none-win_arm64.whl", hash = "sha256:4e99bc050fe65c450344421017f98298a97cefc18c53bb2f7b3531eb39bc7805"}, + {file = "pydantic_core-2.18.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:6f5c4d41b2771c730ea1c34e458e781b18cc668d194958e0112455fff4e402b2"}, + {file = "pydantic_core-2.18.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2fdf2156aa3d017fddf8aea5adfba9f777db1d6022d392b682d2a8329e087cef"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4748321b5078216070b151d5271ef3e7cc905ab170bbfd27d5c83ee3ec436695"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:847a35c4d58721c5dc3dba599878ebbdfd96784f3fb8bb2c356e123bdcd73f34"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c40d4eaad41f78e3bbda31b89edc46a3f3dc6e171bf0ecf097ff7a0ffff7cb1"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:21a5e440dbe315ab9825fcd459b8814bb92b27c974cbc23c3e8baa2b76890077"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:01dd777215e2aa86dfd664daed5957704b769e726626393438f9c87690ce78c3"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b06beb3b3f1479d32befd1f3079cc47b34fa2da62457cdf6c963393340b56e9"}, + {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:564d7922e4b13a16b98772441879fcdcbe82ff50daa622d681dd682175ea918c"}, + {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:0eb2a4f660fcd8e2b1c90ad566db2b98d7f3f4717c64fe0a83e0adb39766d5b8"}, + {file = "pydantic_core-2.18.4-cp312-none-win32.whl", hash = "sha256:8b8bab4c97248095ae0c4455b5a1cd1cdd96e4e4769306ab19dda135ea4cdb07"}, + {file = "pydantic_core-2.18.4-cp312-none-win_amd64.whl", hash = "sha256:14601cdb733d741b8958224030e2bfe21a4a881fb3dd6fbb21f071cabd48fa0a"}, + {file = "pydantic_core-2.18.4-cp312-none-win_arm64.whl", hash = "sha256:c1322d7dd74713dcc157a2b7898a564ab091ca6c58302d5c7b4c07296e3fd00f"}, + {file = "pydantic_core-2.18.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:823be1deb01793da05ecb0484d6c9e20baebb39bd42b5d72636ae9cf8350dbd2"}, + {file = "pydantic_core-2.18.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ebef0dd9bf9b812bf75bda96743f2a6c5734a02092ae7f721c048d156d5fabae"}, + {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae1d6df168efb88d7d522664693607b80b4080be6750c913eefb77e34c12c71a"}, + {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f9899c94762343f2cc2fc64c13e7cae4c3cc65cdfc87dd810a31654c9b7358cc"}, + {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99457f184ad90235cfe8461c4d70ab7dd2680e28821c29eca00252ba90308c78"}, + {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18f469a3d2a2fdafe99296a87e8a4c37748b5080a26b806a707f25a902c040a8"}, + {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7cdf28938ac6b8b49ae5e92f2735056a7ba99c9b110a474473fd71185c1af5d"}, + {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:938cb21650855054dc54dfd9120a851c974f95450f00683399006aa6e8abb057"}, + {file = "pydantic_core-2.18.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:44cd83ab6a51da80fb5adbd9560e26018e2ac7826f9626bc06ca3dc074cd198b"}, + {file = "pydantic_core-2.18.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:972658f4a72d02b8abfa2581d92d59f59897d2e9f7e708fdabe922f9087773af"}, + {file = "pydantic_core-2.18.4-cp38-none-win32.whl", hash = "sha256:1d886dc848e60cb7666f771e406acae54ab279b9f1e4143babc9c2258213daa2"}, + {file = "pydantic_core-2.18.4-cp38-none-win_amd64.whl", hash = "sha256:bb4462bd43c2460774914b8525f79b00f8f407c945d50881568f294c1d9b4443"}, + {file = "pydantic_core-2.18.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:44a688331d4a4e2129140a8118479443bd6f1905231138971372fcde37e43528"}, + {file = "pydantic_core-2.18.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a2fdd81edd64342c85ac7cf2753ccae0b79bf2dfa063785503cb85a7d3593223"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:86110d7e1907ab36691f80b33eb2da87d780f4739ae773e5fc83fb272f88825f"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46387e38bd641b3ee5ce247563b60c5ca098da9c56c75c157a05eaa0933ed154"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:123c3cec203e3f5ac7b000bd82235f1a3eced8665b63d18be751f115588fea30"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dc1803ac5c32ec324c5261c7209e8f8ce88e83254c4e1aebdc8b0a39f9ddb443"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53db086f9f6ab2b4061958d9c276d1dbe3690e8dd727d6abf2321d6cce37fa94"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:abc267fa9837245cc28ea6929f19fa335f3dc330a35d2e45509b6566dc18be23"}, + {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:a0d829524aaefdebccb869eed855e2d04c21d2d7479b6cada7ace5448416597b"}, + {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:509daade3b8649f80d4e5ff21aa5673e4ebe58590b25fe42fac5f0f52c6f034a"}, + {file = "pydantic_core-2.18.4-cp39-none-win32.whl", hash = "sha256:ca26a1e73c48cfc54c4a76ff78df3727b9d9f4ccc8dbee4ae3f73306a591676d"}, + {file = "pydantic_core-2.18.4-cp39-none-win_amd64.whl", hash = "sha256:c67598100338d5d985db1b3d21f3619ef392e185e71b8d52bceacc4a7771ea7e"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:574d92eac874f7f4db0ca653514d823a0d22e2354359d0759e3f6a406db5d55d"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1f4d26ceb5eb9eed4af91bebeae4b06c3fb28966ca3a8fb765208cf6b51102ab"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77450e6d20016ec41f43ca4a6c63e9fdde03f0ae3fe90e7c27bdbeaece8b1ed4"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d323a01da91851a4f17bf592faf46149c9169d68430b3146dcba2bb5e5719abc"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43d447dd2ae072a0065389092a231283f62d960030ecd27565672bd40746c507"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:578e24f761f3b425834f297b9935e1ce2e30f51400964ce4801002435a1b41ef"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:81b5efb2f126454586d0f40c4d834010979cb80785173d1586df845a632e4e6d"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:ab86ce7c8f9bea87b9d12c7f0af71102acbf5ecbc66c17796cff45dae54ef9a5"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:90afc12421df2b1b4dcc975f814e21bc1754640d502a2fbcc6d41e77af5ec312"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:51991a89639a912c17bef4b45c87bd83593aee0437d8102556af4885811d59f5"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:293afe532740370aba8c060882f7d26cfd00c94cae32fd2e212a3a6e3b7bc15e"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b48ece5bde2e768197a2d0f6e925f9d7e3e826f0ad2271120f8144a9db18d5c8"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:eae237477a873ab46e8dd748e515c72c0c804fb380fbe6c85533c7de51f23a8f"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:834b5230b5dfc0c1ec37b2fda433b271cbbc0e507560b5d1588e2cc1148cf1ce"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e858ac0a25074ba4bce653f9b5d0a85b7456eaddadc0ce82d3878c22489fa4ee"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2fd41f6eff4c20778d717af1cc50eca52f5afe7805ee530a4fbd0bae284f16e9"}, + {file = "pydantic_core-2.18.4.tar.gz", hash = "sha256:ec3beeada09ff865c344ff3bc2f427f5e6c26401cc6113d77e372c3fdac73864"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + +[[package]] +name = "pydantic-settings" +version = "2.3.4" +description = "Settings management using Pydantic" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic_settings-2.3.4-py3-none-any.whl", hash = "sha256:11ad8bacb68a045f00e4f862c7a718c8a9ec766aa8fd4c32e39a0594b207b53a"}, + {file = "pydantic_settings-2.3.4.tar.gz", hash = "sha256:c5802e3d62b78e82522319bbc9b8f8ffb28ad1c988a99311d04f2a6051fca0a7"}, +] + +[package.dependencies] +pydantic = ">=2.7.0" +python-dotenv = ">=0.21.0" + +[package.extras] +toml = ["tomli (>=2.0.1)"] +yaml = ["pyyaml (>=6.0.1)"] + +[[package]] +name = "python-dotenv" +version = "1.0.1" +description = "Read key-value pairs from a .env file and set them as environment variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, + {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + +[[package]] +name = "requests" +version = "2.32.3" +description = "Python HTTP for Humans." +optional = false +python-versions = ">=3.8" +files = [ + {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"}, + {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"}, +] + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = ">=2,<4" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<3" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] + +[[package]] +name = "typing-extensions" +version = "4.12.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, +] + +[[package]] +name = "urllib3" +version = "2.2.2" +description = "HTTP library with thread-safe connection pooling, file post, and more." +optional = false +python-versions = ">=3.8" +files = [ + {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, + {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +h2 = ["h2 (>=4,<5)"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.11" +content-hash = "d6cbad8cd64ba63c62d1f3ab2dde75682d6a42c5b40808fd35615bccdf5fdd07" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b7320aa --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "headscale-api-client" +version = "0.1.0" +description = "Headscale API module" +authors = ["Andrea Mistrali "] +license = "BSD" +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.11" +requests = "^2.32.3" +pydantic = "^2.7.4" +pydantic-settings = "^2.3.4" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api"