Skip to content

SitesClient

armis_sdk.clients.sites_client.SitesClient

Bases: BaseEntityClient

A client for interacting with sites.

The primary entity for this client is Site.

Methods:

Name Description
create

Create a Site.

delete

Delete a Site.

get

Get a Site by its ID.

hierarchy

Create a hierarchy of the tenant's sites, taking into account the parent-child relationships.

list

List all the tenant's sites.

update

Update a site's properties.

create(site) async

Create a Site.

Parameters:

Name Type Description Default
site Site

The site to create.

required

Returns:

Type Description
Site

The same site as the input with the addition of id.

Example

Example:

import asyncio

from armis_sdk.clients.sites_client import SitesClient
from armis_sdk.entities.site import Site


async def main():
    sites_client = SitesClient()
    site_to_create = Site(name="my site")
    print(await sites_client.create(site_to_create))


asyncio.run(main())
Will output:
Site(id=1, name="my site")

delete(site) async

Delete a Site.

Parameters:

Name Type Description Default
site Site

The site to delete.

required
Example

Example:

import asyncio

from armis_sdk.clients.sites_client import SitesClient
from armis_sdk.entities.site import Site


async def main():
    sites_client = SitesClient()
    site = Site(id=1)
    await sites_client.delete(site)


asyncio.run(main())

get(site_id) async

Get a Site by its ID.

Parameters:

Name Type Description Default
site_id int

The ID of the site to get.

required

Returns:

Type Description
Site

A Site object.

Example

Example:

import asyncio

from armis_sdk.clients.sites_client import SitesClient


async def main():
    sites_client = SitesClient()
    print(await sites_client.get("1"))


asyncio.run(main())
Will output:
Site(id=1)

hierarchy() async

Create a hierarchy of the tenant's sites, taking into account the parent-child relationships.

Returns:

Type Description
list[Site]

A list of Site objects, that are themselves not children of any other site.

list[Site]

Each site has a .children property that includes its direct children.

Example

import asyncio

from armis_sdk.clients.sites_client import SitesClient


async def main():
    sites_client = SitesClient()
    print(await sites_client.hierarchy())


asyncio.run(main())
Will output this structure (depending on the actual data):
1
2
3
4
5
6
7
8
9
[
    Site(
        id=1,
        children=[
            Site(id=3),
        ],
    ),
    Site(id=2),
]

list() async

List all the tenant's sites. This method takes care of pagination, so you don't have to deal with it.

Returns:

Type Description
AsyncIterator[Site]

An (async) iterator of Site object.

Example

import asyncio

from armis_sdk.clients.sites_client import SitesClient


async def main():
    sites_client = SitesClient()
    async for site in sites_client.list()
        print(site)

asyncio.run(main())
Will output:
Site(id=1)
Site(id=2)

update(site) async

Update a site's properties.

Parameters:

Name Type Description Default
site Site

The site to update.

required

Raises:

Type Description
ResponseError

If an error occurs while communicating with the API.

Example
import asyncio

from armis_sdk.clients.sites_client import SitesClient
from armis_sdk.entities.site import Site


async def main():
    sites_client = SitesClient()
    site = Site(id=1, location="new location")
    await sites_client.update(site)


asyncio.run(main())