IPAM¶
Networks, network containers, network views, IP addresses, VLANs, RIRs, super-hosts. Accessed via client.ipam.
Service¶
IpamService ¶
Entry point for NIOS IPAM resources. Each resource is lazily constructed.
Initialise IpamService with an authenticated HTTP client.
Source code in src/ibx_nios_sdk/ipam/_service.py
networkview
cached
property
¶
Entry point for NIOS IPAM network view resources.
network
cached
property
¶
Entry point for NIOS IPAM IPv4 network resources.
networkcontainer
cached
property
¶
Entry point for NIOS IPAM IPv4 network container resources.
networktemplate
cached
property
¶
Entry point for NIOS IPAM IPv4 network template resources.
ipv4address
cached
property
¶
Entry point for NIOS IPAM IPv4 address resources.
ipv6network
cached
property
¶
Entry point for NIOS IPAM IPv6 network resources.
ipv6networkcontainer
cached
property
¶
Entry point for NIOS IPAM IPv6 network container resources.
ipv6networktemplate
cached
property
¶
Entry point for NIOS IPAM IPv6 network template resources.
ipv6address
cached
property
¶
Entry point for NIOS IPAM IPv6 address resources.
bulkhost
cached
property
¶
Entry point for NIOS IPAM bulk host resources.
bulkhostnametemplate
cached
property
¶
Entry point for NIOS IPAM bulk host name template resources.
discovery_discoverytask
cached
property
¶
Entry point for NIOS network discovery task resources.
network_discovery
cached
property
¶
Entry point for NIOS network discovery result resources.
superhost
cached
property
¶
Entry point for NIOS IPAM superhost resources.
superhostchild
cached
property
¶
Entry point for NIOS IPAM superhost child resources.
hostnamerewritepolicy
cached
property
¶
Entry point for NIOS IPAM hostname rewrite policy resources.
rir
cached
property
¶
Entry point for NIOS Regional Internet Registry (RIR) resources.
rir_organization
cached
property
¶
Entry point for NIOS RIR organization resources.
ipam_statistics
cached
property
¶
Entry point for NIOS IPAM statistics resources.
Resources¶
BulkhostResource ¶
Bases: WapiResource[Bulkhost]
Manage NIOS IPAM bulk 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
BulkhostnametemplateResource ¶
Bases: WapiResource[Bulkhostnametemplate]
Manage NIOS IPAM bulk host name templates.
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
DiscoverytaskResource ¶
Bases: WapiResource[Discoverytask]
Manage NIOS network discovery tasks.
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
HostnamerewritepolicyResource ¶
Bases: WapiResource[Hostnamerewritepolicy]
Manage NIOS IPAM hostname rewrite policy configurations.
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
IpamStatisticsResource ¶
Bases: WapiResource[IpamStatistics]
Access NIOS IPAM 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
Ipv4addressResource ¶
Bases: WapiResource[Ipv4address]
Manage NIOS IPAM IPv4 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
Ipv6addressResource ¶
Bases: WapiResource[Ipv6address]
Manage NIOS IPAM IPv6 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
Ipv6networkResource ¶
Bases: WapiResource[Ipv6network]
Manage NIOS IPAM IPv6 network 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 IPv6 network.
Calls the WAPI next_available_ip function on the given IPv6 network ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference for the IPv6 network
(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/ipam/_ipv6network.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
Ipv6networkcontainerResource ¶
Bases: WapiResource[Ipv6networkcontainer]
Manage NIOS IPAM IPv6 network containers with next_available_network 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_network
async
¶
next_available_network(ref: str, *, cidr: int, num: int = 1, exclude: list[str] | None = None) -> dict[str, Any]
Carve out the next available IPv6 network(s) from this IPv6 container.
Calls the WAPI next_available_network function on the given container ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference for the IPv6 network container
(e.g., |
required |
cidr
|
int
|
The prefix length for the new IPv6 network (e.g., 64 for /64). |
required |
num
|
int
|
Number of networks to allocate. Defaults to 1. |
1
|
exclude
|
list[str] | None
|
Optional list of IPv6 network CIDRs 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 networks are available. |
Source code in src/ibx_nios_sdk/ipam/_ipv6networkcontainer.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
Ipv6networktemplateResource ¶
Bases: WapiResource[Ipv6networktemplate]
Manage NIOS IPAM IPv6 network templates.
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
NetworkResource ¶
Bases: WapiResource[Network]
Manage NIOS IPAM IPv4 network 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 IPv4 network.
Calls the WAPI next_available_ip function on the given network ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference for the network (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/ipam/_network.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
NetworkDiscoveryResource ¶
Bases: WapiResource[NetworkDiscovery]
Access NIOS network discovery results (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
NetworkcontainerResource ¶
Bases: WapiResource[Networkcontainer]
Manage NIOS IPAM IPv4 network containers with next_available_network 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_network
async
¶
next_available_network(ref: str, *, cidr: int, num: int = 1, exclude: list[str] | None = None) -> dict[str, Any]
Carve out the next available network(s) from this IPv4 container.
Calls the WAPI next_available_network function on the given container ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
The WAPI object reference for the network container
(e.g., |
required |
cidr
|
int
|
The prefix length for the new network (e.g., 24 for /24). |
required |
num
|
int
|
Number of networks to allocate. Defaults to 1. |
1
|
exclude
|
list[str] | None
|
Optional list of network CIDRs 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 networks are available. |
Source code in src/ibx_nios_sdk/ipam/_networkcontainer.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
NetworktemplateResource ¶
Bases: WapiResource[Networktemplate]
Manage NIOS IPAM IPv4 network templates.
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
NetworkviewResource ¶
Bases: WapiResource[Networkview]
Manage NIOS IPAM network view 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
RirResource ¶
Bases: WapiResource[Rir]
Manage NIOS Regional Internet Registry (RIR) configuration.
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
RirOrganizationResource ¶
Bases: WapiResource[RirOrganization]
Manage NIOS RIR organizations.
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
SuperhostResource ¶
Bases: WapiResource[Superhost]
Manage NIOS IPAM superhost 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
SuperhostchildResource ¶
Bases: WapiResource[Superhostchild]
Manage NIOS IPAM superhost child 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
VlanResource ¶
Bases: WapiResource[Vlan]
Manage NIOS VLAN 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
VlanrangeResource ¶
Bases: WapiResource[Vlanrange]
Manage NIOS VLAN range 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
VlanviewResource ¶
Bases: WapiResource[Vlanview]
Manage NIOS VLAN view 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",
)