Adding upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
77504588ab
commit
6fd6eb426a
154 changed files with 7346 additions and 5000 deletions
|
@ -43,8 +43,7 @@ __all__ = ["Device"]
|
|||
|
||||
|
||||
class Device(httpx.AsyncClient):
|
||||
"""
|
||||
Represent the async JSON-RPC client that communicates with an Arista EOS device.
|
||||
"""Represent the async JSON-RPC client that communicates with an Arista EOS device.
|
||||
|
||||
This class inherits directly from the
|
||||
httpx.AsyncClient, so any initialization options can be passed directly.
|
||||
|
@ -63,8 +62,7 @@ class Device(httpx.AsyncClient):
|
|||
port: str | int | None = None,
|
||||
**kwargs: Any, # noqa: ANN401
|
||||
) -> None:
|
||||
"""
|
||||
Initialize the Device class.
|
||||
"""Initialize the Device class.
|
||||
|
||||
As a subclass to httpx.AsyncClient, the caller can provide any of those initializers.
|
||||
Specific parameters for Device class are all optional and described below.
|
||||
|
@ -111,8 +109,7 @@ class Device(httpx.AsyncClient):
|
|||
self.headers["Content-Type"] = "application/json-rpc"
|
||||
|
||||
async def check_connection(self) -> bool:
|
||||
"""
|
||||
Check the target device to ensure that the eAPI port is open and accepting connections.
|
||||
"""Check the target device to ensure that the eAPI port is open and accepting connections.
|
||||
|
||||
It is recommended that a Caller checks the connection before involving cli commands,
|
||||
but this step is not required.
|
||||
|
@ -124,7 +121,7 @@ class Device(httpx.AsyncClient):
|
|||
"""
|
||||
return await port_check_url(self.base_url)
|
||||
|
||||
async def cli( # noqa: PLR0913
|
||||
async def cli(
|
||||
self,
|
||||
command: str | dict[str, Any] | None = None,
|
||||
commands: Sequence[str | dict[str, Any]] | None = None,
|
||||
|
@ -136,8 +133,7 @@ class Device(httpx.AsyncClient):
|
|||
expand_aliases: bool = False,
|
||||
req_id: int | str | None = None,
|
||||
) -> list[dict[str, Any] | str] | dict[str, Any] | str | None:
|
||||
"""
|
||||
Execute one or more CLI commands.
|
||||
"""Execute one or more CLI commands.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
@ -199,7 +195,7 @@ class Device(httpx.AsyncClient):
|
|||
return None
|
||||
raise
|
||||
|
||||
def _jsonrpc_command( # noqa: PLR0913
|
||||
def _jsonrpc_command(
|
||||
self,
|
||||
commands: Sequence[str | dict[str, Any]] | None = None,
|
||||
ofmt: str | None = None,
|
||||
|
@ -264,8 +260,7 @@ class Device(httpx.AsyncClient):
|
|||
return cmd
|
||||
|
||||
async def jsonrpc_exec(self, jsonrpc: dict[str, Any]) -> list[dict[str, Any] | str]:
|
||||
"""
|
||||
Execute the JSON-RPC dictionary object.
|
||||
"""Execute the JSON-RPC dictionary object.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue