a4i 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- a4i/__init__.py +84 -0
- a4i/__main__.py +8 -0
- a4i/cli.py +836 -0
- a4i/client.py +593 -0
- a4i/completion.py +310 -0
- a4i/config.py +78 -0
- a4i/daemon.py +252 -0
- a4i/diff.py +250 -0
- a4i/dry_run.py +141 -0
- a4i/errors.py +123 -0
- a4i/ipc.py +328 -0
- a4i/mcp/__init__.py +21 -0
- a4i/mcp/guides.py +308 -0
- a4i/mcp/server.py +230 -0
- a4i/mcp/tools.py +562 -0
- a4i/merge.py +224 -0
- a4i/metadata/__init__.py +170 -0
- a4i/metadata/classes.txt +15637 -0
- a4i/metadata/model.idx +17864 -0
- a4i/metadata/model.jsonl +17864 -0
- a4i/metadata/rn_formats.txt +2806 -0
- a4i/metadata/search.txt +17864 -0
- a4i/mo.py +394 -0
- a4i/output.py +490 -0
- a4i/query.py +182 -0
- a4i/session.py +590 -0
- a4i/transport.py +100 -0
- a4i-0.0.1.dist-info/METADATA +247 -0
- a4i-0.0.1.dist-info/RECORD +32 -0
- a4i-0.0.1.dist-info/WHEEL +4 -0
- a4i-0.0.1.dist-info/entry_points.txt +2 -0
- a4i-0.0.1.dist-info/licenses/LICENSE +21 -0
a4i/__init__.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""a4i - a CLI for the Cisco ACI (APIC) REST API, and the library behind it.
|
|
2
|
+
|
|
3
|
+
import a4i
|
|
4
|
+
|
|
5
|
+
with a4i.Client("apic1.example.com") as client:
|
|
6
|
+
client.login("admin", password)
|
|
7
|
+
data = client.get("fvTenant", kind="class", query_target="subtree")
|
|
8
|
+
|
|
9
|
+
async with a4i.AsyncClient("apic1.example.com") as client:
|
|
10
|
+
await client.login("admin", password)
|
|
11
|
+
data = await client.get("fvTenant", kind="class", query_target="subtree")
|
|
12
|
+
|
|
13
|
+
The names below are resolved on first use rather than imported here. Reaching
|
|
14
|
+
:class:`~a4i.client.Client` pulls in the whole request and comparison stack,
|
|
15
|
+
which costs more than a whole shell completion -- and completion runs through
|
|
16
|
+
this package on every tab press. ``__version__`` is held back for the same
|
|
17
|
+
reason: reading it takes importlib.metadata, which alone costs more than the
|
|
18
|
+
completion it would be paid for.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from typing import TYPE_CHECKING
|
|
24
|
+
|
|
25
|
+
if TYPE_CHECKING:
|
|
26
|
+
# Redundant aliases: these exist for a type checker and an IDE, which cannot
|
|
27
|
+
# follow __getattr__ below. Nothing is imported at run time.
|
|
28
|
+
__version__: str
|
|
29
|
+
|
|
30
|
+
from a4i.client import AsyncClient as AsyncClient
|
|
31
|
+
from a4i.client import Client as Client
|
|
32
|
+
from a4i.errors import A4iError as A4iError
|
|
33
|
+
from a4i.errors import ApicError as ApicError
|
|
34
|
+
from a4i.errors import NotLoggedInError as NotLoggedInError
|
|
35
|
+
from a4i.errors import ReadOnlyError as ReadOnlyError
|
|
36
|
+
from a4i.errors import SessionExpiredError as SessionExpiredError
|
|
37
|
+
from a4i.mo import Change as Change
|
|
38
|
+
|
|
39
|
+
# What __version__ reads when the package is not installed, which is what an
|
|
40
|
+
# uninstalled source tree looks like to importlib.metadata.
|
|
41
|
+
_FALLBACK_VERSION = "0.0.1"
|
|
42
|
+
|
|
43
|
+
# Public name -> the module it lives in.
|
|
44
|
+
_EXPORTS = {
|
|
45
|
+
"Client": "a4i.client",
|
|
46
|
+
"AsyncClient": "a4i.client",
|
|
47
|
+
"Change": "a4i.mo",
|
|
48
|
+
"A4iError": "a4i.errors",
|
|
49
|
+
"ApicError": "a4i.errors",
|
|
50
|
+
"NotLoggedInError": "a4i.errors",
|
|
51
|
+
"ReadOnlyError": "a4i.errors",
|
|
52
|
+
"SessionExpiredError": "a4i.errors",
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
__all__ = ["__version__", *_EXPORTS]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def __getattr__(name: str) -> object:
|
|
59
|
+
if name == "__version__":
|
|
60
|
+
# The version is whatever the build recorded, which hatch-vcs takes from
|
|
61
|
+
# the git tag, so nothing here has to be bumped for a release.
|
|
62
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
63
|
+
|
|
64
|
+
resolved: object
|
|
65
|
+
try:
|
|
66
|
+
resolved = version("a4i")
|
|
67
|
+
except PackageNotFoundError:
|
|
68
|
+
resolved = _FALLBACK_VERSION
|
|
69
|
+
globals()[name] = resolved
|
|
70
|
+
return resolved
|
|
71
|
+
|
|
72
|
+
module = _EXPORTS.get(name)
|
|
73
|
+
if module is None:
|
|
74
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
75
|
+
import importlib
|
|
76
|
+
|
|
77
|
+
value = getattr(importlib.import_module(module), name)
|
|
78
|
+
# Cached in the module's own namespace, so the lookup happens once.
|
|
79
|
+
globals()[name] = value
|
|
80
|
+
return value
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def __dir__() -> list[str]:
|
|
84
|
+
return sorted(__all__)
|