DHCP¶
Ranges, fixed addresses, shared networks, leases, DHCP filters, option spaces, failover. Accessed via client.dhcp.
Service¶
DhcpService ¶
Entry point for NIOS DHCP resources. Each resource is lazily constructed.
Initialise DhcpService with an authenticated HTTP client.
Source code in src/ibx_nios_sdk/dhcp/_service.py
rangetemplate
cached
property
¶
Entry point for NIOS DHCP range template resources.
ipv6range
cached
property
¶
Entry point for NIOS DHCPv6 range resources.
ipv6rangetemplate
cached
property
¶
Entry point for NIOS DHCPv6 range template resources.
orderedranges
cached
property
¶
Entry point for NIOS DHCP ordered ranges resources.
fixedaddress
cached
property
¶
Entry point for NIOS DHCP fixed address resources.
fixedaddresstemplate
cached
property
¶
Entry point for NIOS DHCP fixed address template resources.
ipv6fixedaddress
cached
property
¶
Entry point for NIOS DHCPv6 fixed address resources.
ipv6fixedaddresstemplate
cached
property
¶
Entry point for NIOS DHCPv6 fixed address template resources.
sharednetwork
cached
property
¶
Entry point for NIOS DHCP shared network resources.
ipv6sharednetwork
cached
property
¶
Entry point for NIOS DHCPv6 shared network resources.
filterfingerprint
cached
property
¶
Entry point for NIOS DHCP fingerprint filter resources.
filtermac
cached
property
¶
Entry point for NIOS DHCP MAC address filter resources.
filternac
cached
property
¶
Entry point for NIOS DHCP NAC filter resources.
filteroption
cached
property
¶
Entry point for NIOS DHCP option filter resources.
filterrelayagent
cached
property
¶
Entry point for NIOS DHCP relay agent filter resources.
ipv6filteroption
cached
property
¶
Entry point for NIOS DHCPv6 option filter resources.
dhcpoptiondefinition
cached
property
¶
Entry point for NIOS DHCP option definition resources.
dhcpoptionspace
cached
property
¶
Entry point for NIOS DHCP option space resources.
ipv6dhcpoptiondefinition
cached
property
¶
Entry point for NIOS DHCPv6 option definition resources.
ipv6dhcpoptionspace
cached
property
¶
Entry point for NIOS DHCPv6 option space resources.
dhcpfailover
cached
property
¶
Entry point for NIOS DHCP failover association resources.
fingerprint
cached
property
¶
Entry point for NIOS DHCP fingerprint resources.
macfilteraddress
cached
property
¶
Entry point for NIOS DHCP MAC filter address resources.
roaminghost
cached
property
¶
Entry point for NIOS DHCP roaming host resources.
dhcp_statistics
cached
property
¶
Entry point for NIOS DHCP statistics resources.
Resources¶
DhcpStatisticsResource ¶
Bases: WapiResource[DhcpStatistics]
Access NIOS DHCP statistics (read-only aggregate view).
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
DhcpfailoverResource ¶
Bases: WapiResource[Dhcpfailover]
Manage NIOS DHCP failover association objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
DhcpoptiondefinitionResource ¶
Bases: WapiResource[Dhcpoptiondefinition]
Manage NIOS DHCP option definition objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
DhcpoptionspaceResource ¶
Bases: WapiResource[Dhcpoptionspace]
Manage NIOS DHCP option space objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FilterfingerprintResource ¶
Bases: WapiResource[Filterfingerprint]
Manage NIOS DHCP fingerprint filter objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FiltermacResource ¶
Bases: WapiResource[Filtermac]
Manage NIOS DHCP MAC address filter objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FilternacResource ¶
Bases: WapiResource[Filternac]
Manage NIOS DHCP NAC filter objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FilteroptionResource ¶
Bases: WapiResource[Filteroption]
Manage NIOS DHCP option filter objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FilterrelayagentResource ¶
Bases: WapiResource[Filterrelayagent]
Manage NIOS DHCP relay agent filter objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FingerprintResource ¶
Bases: WapiResource[Fingerprint]
Manage NIOS DHCP fingerprint objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FixedaddressResource ¶
Bases: WapiResource[Fixedaddress]
Manage NIOS DHCP fixed address objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
FixedaddresstemplateResource ¶
Bases: WapiResource[Fixedaddresstemplate]
Manage NIOS DHCP fixed address template objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6dhcpoptiondefinitionResource ¶
Bases: WapiResource[Ipv6dhcpoptiondefinition]
Manage NIOS DHCPv6 option definition objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6dhcpoptionspaceResource ¶
Bases: WapiResource[Ipv6dhcpoptionspace]
Manage NIOS DHCPv6 option space objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6filteroptionResource ¶
Bases: WapiResource[Ipv6filteroption]
Manage NIOS DHCPv6 option filter objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6fixedaddressResource ¶
Bases: WapiResource[Ipv6fixedaddress]
Manage NIOS DHCPv6 fixed address objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6fixedaddresstemplateResource ¶
Bases: WapiResource[Ipv6fixedaddresstemplate]
Manage NIOS DHCPv6 fixed address template objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6rangeResource ¶
Bases: WapiResource[Ipv6range]
Manage NIOS DHCPv6 range objects with next_available_ip support.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
next_available_ip
async
¶
Return the next available IPv6 address(es) within this DHCPv6 range.
Calls the WAPI next_available_ip function on the given IPv6 range ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference for the DHCPv6 range
(e.g., |
required |
num
|
int
|
Number of IPv6 addresses to allocate. Defaults to 1. |
1
|
exclude
|
list[str] | None
|
Optional list of IPv6 addresses to exclude from consideration. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict[str, Any]
|
A dict with key |
|
Example |
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
WapiRequestError
|
If the WAPI call fails or no IPs are available. |
Source code in src/ibx_nios_sdk/dhcp/_ipv6range.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6rangetemplateResource ¶
Bases: WapiResource[Ipv6rangetemplate]
Manage NIOS DHCPv6 range template objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
Ipv6sharednetworkResource ¶
Bases: WapiResource[Ipv6sharednetwork]
Manage NIOS DHCPv6 shared network objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
LeaseResource ¶
Bases: WapiResource[Lease]
Access NIOS DHCP lease objects (read-only).
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
MacfilteraddressResource ¶
Bases: WapiResource[Macfilteraddress]
Manage NIOS DHCP MAC filter address objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
OrderedrangesResource ¶
Bases: WapiResource[Orderedranges]
Manage NIOS DHCP ordered ranges objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
RangeResource ¶
Bases: WapiResource[Range]
Manage NIOS DHCP IPv4 range objects with next_available_ip support.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
next_available_ip
async
¶
Return the next available IP address(es) within this DHCP range.
Calls the WAPI next_available_ip function on the given range ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference for the DHCP range
(e.g., |
required |
num
|
int
|
Number of IP addresses to allocate. Defaults to 1. |
1
|
exclude
|
list[str] | None
|
Optional list of IP addresses to exclude from consideration. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict[str, Any]
|
A dict with key |
|
Example |
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
WapiRequestError
|
If the WAPI call fails or no IPs are available. |
Source code in src/ibx_nios_sdk/dhcp/_range.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
RangetemplateResource ¶
Bases: WapiResource[Rangetemplate]
Manage NIOS DHCP range template objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
RoaminghostResource ¶
Bases: WapiResource[Roaminghost]
Manage NIOS DHCP roaming host objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)
Source code in src/ibx_nios_sdk/_resource.py
SharednetworkResource ¶
Bases: WapiResource[Sharednetwork]
Manage NIOS DHCP shared network objects.
Initialize the resource with an HTTP client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HttpClient
|
The :class: |
required |
Source code in src/ibx_nios_sdk/_resource.py
list_page
async
¶
list_page(*, page_id: str | None = None, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> tuple[list[TModel], str | None]
Fetch a single page of WAPI results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_id
|
str | None
|
Continuation token from a previous response. Pass |
None
|
max_results
|
int
|
Maximum number of records per page (WAPI
|
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields to add on top of
|
None
|
**filters
|
Any
|
Field-level filters using kwarg conventions (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
list[TModel]
|
A |
str | None
|
model instances; |
tuple[list[TModel], str | None]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for WAPI errors. |
Example
Fetch the first two pages manually::
rows, next_id = await resource.list_page(max_results=100)
if next_id:
more, _ = await resource.list_page(page_id=next_id)
Source code in src/ibx_nios_sdk/_resource.py
list ¶
list(*, max_results: int = 1000, return_fields: list[str] | None = None, return_fields_plus: list[str] | None = None, **filters: Any) -> AsyncPageIterator[TModel]
Return an auto-paginated async iterator over all matching objects.
Fetches pages on demand as the caller iterates. Use await .all()
on the returned iterator to collect every record into a list at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_results
|
int
|
Maximum records per page (WAPI |
1000
|
return_fields
|
list[str] | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
list[str] | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AsyncPageIterator[TModel]
|
class: |
AsyncPageIterator[TModel]
|
validated model instances across all pages. |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support reads of this object type. Raised by this call, not by the first iteration. |
Example
Iterate lazily::
async for record in resource.list(name="example"):
print(record.ref)
Collect all at once::
records = await resource.list(comment__like="prod").all()
Source code in src/ibx_nios_sdk/_resource.py
find_one
async
¶
find_one(*, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None, **filters: Any) -> TModel | None
Return the first matching object, or None if no match is found.
Requests at most one result (max_results=1) to minimise data
transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
**filters
|
Any
|
Field-level filters (see :func: |
{}
|
Returns:
| Type | Description |
|---|---|
TModel | None
|
The first matching validated model instance, or |
TModel | None
|
WAPI returns an empty result set. |
Raises:
| Type | Description |
|---|---|
NiosError
|
Or a subclass for WAPI errors. |
Example
Look up a record by name::
record = await resource.find_one(name="foo.example.com")
if record is None:
print("not found")
Source code in src/ibx_nios_sdk/_resource.py
get
async
¶
get(ref: str, *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Fetch a single WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference string (e.g.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the requested object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support reads of this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Fetch a record by ref::
record = await resource.get("record:a/ZG5z...:1.2.3.4/default")
print(record.ipv4addr)
Source code in src/ibx_nios_sdk/_resource.py
create
async
¶
create(obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Create a new WAPI object and return the populated model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict containing the fields
for the new object. |
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance for the newly created object, populated |
TModel
|
with the fields requested via |
Raises:
| Type | Description |
|---|---|
UnsupportedOperationError
|
If WAPI does not support creating this object type. |
ConflictError
|
If the object already exists. |
BadRequestError
|
If the request body contains invalid fields. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Create an A record::
record = await resource.create(
{"name": "host.example.com", "ipv4addr": "1.2.3.4"}
)
print(record.ref)
Source code in src/ibx_nios_sdk/_resource.py
update
async
¶
update(ref: str, obj: BaseModel | dict[str, Any], *, return_fields: _StrList | None = None, return_fields_plus: _StrList | None = None) -> TModel
Update an existing WAPI object and return the refreshed model.
Sends a PUT request with _return_as_object=1. Read-only fields
listed in _readonly_fields are stripped from the payload
automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to update. |
required |
obj
|
BaseModel | dict[str, Any]
|
A Pydantic model instance or plain dict of fields to update.
|
required |
return_fields
|
_StrList | None
|
Exact list of fields to return; mutually exclusive
with |
None
|
return_fields_plus
|
_StrList | None
|
Extra fields on top of |
None
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object no longer exists in NIOS. |
UnsupportedOperationError
|
If WAPI does not support updating this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Change the comment on a host record::
updated = await resource.update(
"record:host/ZG5z...",
{"comment": "updated by SDK"},
)
Source code in src/ibx_nios_sdk/_resource.py
delete
async
¶
Delete a WAPI object by its _ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the object to delete. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
str
|
differ from the input |
str
|
the input |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotFoundError
|
If the object does not exist in NIOS. |
UnsupportedOperationError
|
If WAPI does not support deleting this object type. |
NiosError
|
Or a subclass for other WAPI errors. |
Example
Delete an A record::
deleted_ref = await resource.delete("record:a/ZG5z...:1.2.3.4/default")
Source code in src/ibx_nios_sdk/_resource.py
call_function
async
¶
Call a WAPI function on a specific object or on the object type.
Uses POST /<ref>?_function=<name> when ref is provided, or
POST /<wapi_type>?_function=<name> for type-level functions.
None kwarg values are excluded from the request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str | None
|
WAPI object reference, or |
required |
function
|
str
|
WAPI function name (e.g. |
required |
**kwargs
|
Any
|
Function arguments passed as the POST body. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The parsed JSON response body from the function call as a dict |
dict[str, Any]
|
(empty dict if the WAPI returns no body). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Find the next available IP in a network::
result = await resource.call_function(
"network/ZG5z...",
"nextavailableip",
num=1,
)
print(result["ips"])
Source code in src/ibx_nios_sdk/_resource.py
set_extattrs
async
¶
Set extensible attributes on a WAPI object.
Wraps kwarg key/value pairs into the WAPI extattrs nested shape
({"<name>": {"value": <val>}}) and delegates to
:meth:update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
WAPI object reference string identifying the target object. |
required |
**kwargs
|
Any
|
Extensible-attribute name/value pairs to set (e.g.
|
{}
|
Returns:
| Type | Description |
|---|---|
TModel
|
A validated model instance reflecting the object's state after the |
TModel
|
update. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NiosError
|
Or a subclass for WAPI errors. |
Example
Tag a host record with a site attribute::
updated = await resource.set_extattrs(
"record:host/ZG5z...",
Site="NYC",
Owner="ops-team",
)