Skip to content

Response manager

nexthink_api.Models

List of classes available in the module.

NxtRegionName

Bases: str, Enum

List of regions for Nexthink servers.

us = 'us' class-attribute instance-attribute

eu = 'eu' class-attribute instance-attribute

pac = 'pac' class-attribute instance-attribute

meta = 'meta' class-attribute instance-attribute

NxtSettings

Bases: BaseModel

Configuration class for Nexthink API.

This class is used by client during initialization.

Attributes
instance : str
    The name of the Nexthink instance.
region : NxtRegionName
    The region of the Nexthink instance.
infinity_base_uri : HttpUrl
    The base URI of the Nexthink API.
token_url : HttpUrl
    The URL of the token endpoint.
proxies : Optional[dict]
    A dictionary of proxies to use for the requests. Defaults to None.
Note
  • if proxy are not provided, it will try to detect proxies from environment variables
  • if no proxy are detected, it will disable the proxy
  • false value disable the proxy

base_url: Final = 'https://{instance}.api.{region}.nexthink.cloud' class-attribute instance-attribute

instance: str = Field(min_length=1) class-attribute instance-attribute

region: NxtRegionName instance-attribute

infinity_base_uri: HttpUrl = Field(init=False, default=None) class-attribute instance-attribute

token_url: HttpUrl = Field(init=False, default=None) class-attribute instance-attribute

proxies: Optional[Union[Dict[str, str], bool]] = None class-attribute instance-attribute

set_infinity_base_uri(values: dict) -> dict classmethod

Set the base URI of the Nexthink API.

Parameters
values : dict
    class attributes in dict format
Returns
dict
    The validated and updated attributes in dict format.
Raises
ValueError
    If instance or region are not provided.

set_settings_init() -> Self

Finish the initialization of the settings object when class is instantiated.

Returns
NxtSettings
    the instantiated class

NxtEndpoint

Bases: str, Enum

Endpoint list of the Nexthink API.

Enrichment: Final[str] = '/api/v1/enrichment/data/fields' class-attribute instance-attribute

Act: Final[str] = '/api/v1/act/execute' class-attribute instance-attribute

Engage: Final[str] = '/api/v1/euf/campaign/trigger' class-attribute instance-attribute

Workflow: Final[str] = '/api/v1/workflow/execute' class-attribute instance-attribute

Nql: Final[str] = '/api/v1/nql/execute' class-attribute instance-attribute

NqlV2: Final[str] = '/api/v2/nql/execute' class-attribute instance-attribute

NqlExport: Final[str] = '/api/v1/nql/export' class-attribute instance-attribute

NqlStatus: Final[str] = '/api/v1/nql/status' class-attribute instance-attribute

Token: Final[str] = '/api/v1/token' class-attribute instance-attribute

get_api_name(path: str) -> Optional[str] classmethod

Get the API name from the path.

Parameters
path : str
    path to the API.
Returns
Optional[str]
    The name of the API or None if path is not in the Endpoints list.

NxtTokenRequest

Bases: BaseModel

Model for an OAuth Authentication request on the Nexthink API.

Attributes
data (Dict[str, str]):
    Header for requesting the Token

data: Dict[str, str] = Field(default={'grant_type': 'client_credentials'}, frozen=True) class-attribute instance-attribute

get_request_header() -> dict

Return the header for requesting the token.

Returns
dict(str, str):
    Header for requesting the Token

NxtInvalidTokenRequest

Bases: BaseModel

Error when authentication has failed.

Attributes
code: str
    Error code
message: str
    Message with the description of the error

code: str = Field(min_length=1, default=401) class-attribute instance-attribute

message: str = Field(min_length=1, default='Unauthorized - invalid authentication credentials') class-attribute instance-attribute

NxtTokenResponse

Bases: BaseModel

Nexthink API Token answer.

Attributes
token_type : str
    The type of the token.
expires_in : int
    The expiration time of the token.
access_token str
    The access token.
scope : str
    The scope of the token.

token_type: Annotated[str, Field(min_length=1)] instance-attribute

expires_in: Annotated[int, Field(ge=0)] instance-attribute

access_token: Annotated[str, Field(min_length=1)] instance-attribute

scope: Annotated[str, Field(min_length=1)] instance-attribute