| Name | aiotruenas-client JSON | 
            
| Version | 
                  0.10.0
                   
                  JSON | 
            
 | download  | 
            
| home_page |   | 
            
| Summary | A Python client library for the TrueNAS API | 
            | upload_time | 2023-04-10 04:10:22 | 
            | maintainer |  | 
            
            | docs_url | None | 
            | author | Shawn Wilsher | 
            
            | requires_python | <4,>3.8 | 
            
            
            | license |  | 
            | keywords | 
                 | 
            | VCS | 
                
                    | 
                
            
            | bugtrack_url | 
                
                 | 
             
            
            | requirements | 
                
                  No requirements were recorded.
                
             | 
            
| Travis-CI | 
                
                   No Travis.
                
             | 
            | coveralls test coverage | 
                
                   No coveralls.
                
             | 
        
        
            
            

# Python Module for TrueNAS Websocket API
This python module utilizes the [TrueNAS Websocket API](https://www.truenas.com/docs/hub/additional-topics/api/websocket_api.html) to get state from a TrueNAS instance.
## Installation
```
pip install aiotruenas-client
```
## Usage
```python
from aiotruenas_client import CachingMachine as TrueNASMachine
machine = await TrueNASMachine.create(
    "hostname.of.machine",
    api_key="someapikey"
)
datasets = await machine.get_datasets()
disks = await machine.get_disks()
jails = await machine.get_jails()
pools = await machine.get_pools()
vms = await machine.get_vms()
```
Alternatively, a username and password may also be supplied.
### `Machine`
Object representing a TrueNAS instance.
### `Dataset`
Available from `machine.datasets`, contains information about the datasets on the pools on the machine.
### `Disk`
Available from `machine.disks`, contains information about the disks attached to the machine.
### `Jail`
Available from `machine.jails`, contains information about the jails available on the machine.
### `Pool`
Available from `machine.pools`, contains information about the ZFS pools known to the machine.
### `VirturalMachine`
Available from `machine.vms`, contains information about the virtural machines available on the machine.
Each instance has the following methods availabe:
- `vm.start`
- `vm.stop`
- `vm.restart`
## Development
### Setup
```
python3.8 -m venv .venv
source .venv/bin/activate
# Install Requirements
pip install -r requirements.txt
# Install Dev Requirements
pip install -r requirements-dev.txt
# One-Time Install of Commit Hooks
pre-commit install
```
### Working With Methods & Subscriptions
When adding support for a new object, or updating existing code, it can be useful to see the raw response from the
TrueNAS machine from time to time. In order to help do that easily, you can drop a `.auth.yaml` file in the root of
the repository, with the following content:
```yaml
host: "some.host.name"
api_key: "someapikey"
```
Use `scripts/invoke_method.py` to call a method:
```
python scripts/invoke_method.py disk.query
```
Use `scripts/subscribe.py` to subscribe to a topic:
```
python scripts/subscribe.py reporting.realtime
```
Run either with -h to see additional options.
### Testing
Tests are run with `pytest`.
            
         
        Raw data
        
            {
    "_id": null,
    "home_page": "",
    "name": "aiotruenas-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<4,>3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Shawn Wilsher",
    "author_email": "me@shawnwilsher.com",
    "download_url": "https://files.pythonhosted.org/packages/4d/2c/dccc5df35587b4afe9f209f37eb606cffc199d71bf9b6d8ba92b41127a92/aiotruenas-client-0.10.0.tar.gz",
    "platform": null,
    "description": "\n\n\n# Python Module for TrueNAS Websocket API\n\nThis python module utilizes the [TrueNAS Websocket API](https://www.truenas.com/docs/hub/additional-topics/api/websocket_api.html) to get state from a TrueNAS instance.\n\n## Installation\n\n```\npip install aiotruenas-client\n```\n\n## Usage\n\n```python\nfrom aiotruenas_client import CachingMachine as TrueNASMachine\n\nmachine = await TrueNASMachine.create(\n    \"hostname.of.machine\",\n    api_key=\"someapikey\"\n)\ndatasets = await machine.get_datasets()\ndisks = await machine.get_disks()\njails = await machine.get_jails()\npools = await machine.get_pools()\nvms = await machine.get_vms()\n```\n\nAlternatively, a username and password may also be supplied.\n\n### `Machine`\n\nObject representing a TrueNAS instance.\n\n### `Dataset`\n\nAvailable from `machine.datasets`, contains information about the datasets on the pools on the machine.\n\n### `Disk`\n\nAvailable from `machine.disks`, contains information about the disks attached to the machine.\n\n### `Jail`\n\nAvailable from `machine.jails`, contains information about the jails available on the machine.\n\n### `Pool`\n\nAvailable from `machine.pools`, contains information about the ZFS pools known to the machine.\n\n### `VirturalMachine`\n\nAvailable from `machine.vms`, contains information about the virtural machines available on the machine.\n\nEach instance has the following methods availabe:\n\n- `vm.start`\n- `vm.stop`\n- `vm.restart`\n\n## Development\n\n### Setup\n\n```\npython3.8 -m venv .venv\nsource .venv/bin/activate\n\n# Install Requirements\npip install -r requirements.txt\n\n# Install Dev Requirements\npip install -r requirements-dev.txt\n\n# One-Time Install of Commit Hooks\npre-commit install\n```\n\n### Working With Methods & Subscriptions\n\nWhen adding support for a new object, or updating existing code, it can be useful to see the raw response from the\nTrueNAS machine from time to time. In order to help do that easily, you can drop a `.auth.yaml` file in the root of\nthe repository, with the following content:\n\n```yaml\nhost: \"some.host.name\"\napi_key: \"someapikey\"\n```\n\nUse `scripts/invoke_method.py` to call a method:\n\n```\npython scripts/invoke_method.py disk.query\n```\n\nUse `scripts/subscribe.py` to subscribe to a topic:\n\n```\npython scripts/subscribe.py reporting.realtime\n```\n\nRun either with -h to see additional options.\n\n### Testing\n\nTests are run with `pytest`.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python client library for the TrueNAS API",
    "version": "0.10.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b92e9bb45f42866d4689e96404d7742a402f2e0d71b4271840048d1f2fac6ab2",
                "md5": "7cb94a18f0820c08336546235e2d375a",
                "sha256": "3eccb1ffeca9d01dd4ca4ce0fb8c92490b7c070729d6e1f8c40066f9fa2351d9"
            },
            "downloads": -1,
            "filename": "aiotruenas_client-0.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7cb94a18f0820c08336546235e2d375a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>3.8",
            "size": 25056,
            "upload_time": "2023-04-10T04:10:21",
            "upload_time_iso_8601": "2023-04-10T04:10:21.048191Z",
            "url": "https://files.pythonhosted.org/packages/b9/2e/9bb45f42866d4689e96404d7742a402f2e0d71b4271840048d1f2fac6ab2/aiotruenas_client-0.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d2cdccc5df35587b4afe9f209f37eb606cffc199d71bf9b6d8ba92b41127a92",
                "md5": "fe1b3de35681b8fbda08569f1ee85635",
                "sha256": "edb35e29cf89f0b94f11ccbd52ac1d029738cb5c6454cb4f309d7ce71ee19728"
            },
            "downloads": -1,
            "filename": "aiotruenas-client-0.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fe1b3de35681b8fbda08569f1ee85635",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>3.8",
            "size": 17210,
            "upload_time": "2023-04-10T04:10:22",
            "upload_time_iso_8601": "2023-04-10T04:10:22.752498Z",
            "url": "https://files.pythonhosted.org/packages/4d/2c/dccc5df35587b4afe9f209f37eb606cffc199d71bf9b6d8ba92b41127a92/aiotruenas-client-0.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-10 04:10:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "aiotruenas-client"
}