Skip to content

Enrichment classes

nexthink_api.Enrichment

Classes necessary to represent and manipulate objects used in the Nexthink Enrichment API.

NxtBadRequestResponse

Bases: BaseModel

Error response when ALL objects in the request contain errors.

Attributes

status : Literal Literal value "error" representing the status of the response. errors : list[NxtIndividualObjectError] List containing NxtIndividualObjectError instances with a minimum length of 1.

status: Literal['error'] = Field(default='error') class-attribute instance-attribute

errors: conlist(NxtIndividualObjectError, min_length=1) instance-attribute

NxtEnrichment

Bases: BaseModel

Enrichment class.

Enrichment composed of the identification information of the desired object and the fields to be enriched (names and values).

Attributes
    identification : List[NxtIdentification])
        List containing one NxtIdentification object for identification purposes.
    fields : List[NxtField]
        List of NxtField objects to be enriched.

identification: conlist(NxtIdentification, min_length=1, max_length=1) instance-attribute

fields: conlist(NxtField, min_length=1) instance-attribute

NxtEnrichmentRequest

Bases: BaseModel

Objects to be enriched (with desired fields and values) and domain (configurable) .

Attributes
enrichments : list[NxtEnrichment]
    A list of NxtEnrichment objects to be enriched.
domain : str
    The domain for the enrichment process. For information and tracking purposes mainly

enrichments: conlist(NxtEnrichment, min_length=1, max_length=5000) instance-attribute

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

NxtError

Bases: BaseModel

hold an Error with a message and a code.

Attributes

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

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

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

NxtField

Bases: BaseModel

Enrichment information for the given object, composed of the name of field to be enriched and the desired value.

Ensures constraints on the 'name' attribute based on the presence of '#' character. Raises ValueError if constraints are violated. Converts 'name' attribute to a string when converting to a dictionary.

value: Union[str, int] instance-attribute

custom_value: str = Field(default=None, exclude=True, repr=False) class-attribute instance-attribute

name(value: NxtFieldName) -> str

Return the value of the 'name' attribute when converting to a dictionary.

Parameters

value : NxtFieldName Enum from which we must get the name

Returns
str
    The value of the 'name' attribute.

check_name() -> Self

Validate the 'name' attribute of the model after it has been instantiated.

if value contains '#', then customValue must be specified. if value doesn't contain '#', then customValue must not be None.

Raises
ValueError
    If condition on 'customValue' is violated.
Returns
Self: The instance of the model.

get_field_name(name: NxtFieldName) -> str

Format the Enrichment field name with custom value if required.

Parameters

name : NxtFieldName Field to Enrich.

Returns
str
    The Enrich field value, followed by # and custom value for custom Field.

NxtFieldName

Bases: str, Enum

Enumeration class for various field names related to virtualization and custom entities.

DESKTOP_POOL = 'device/device/virtualization/desktop_pool' class-attribute instance-attribute

HOSTNAME = 'device/device/virtualization/hostname' class-attribute instance-attribute

HYPERVISOR_NAME = 'device/device/virtualization/hypervisor_name' class-attribute instance-attribute

TYPE = 'device/device/virtualization/type' class-attribute instance-attribute

ENVIRONMENT_NAME = 'device/device/virtualization/environment_name' class-attribute instance-attribute

DESKTOP_BROKER = 'device/device/virtualization/desktop_broker' class-attribute instance-attribute

DISK_IMAGE = 'device/device/virtualization/disk_image' class-attribute instance-attribute

LAST_UPDATE = 'device/device/virtualization/last_update' class-attribute instance-attribute

CUSTOM_DEVICE = 'device/device/#{}' class-attribute instance-attribute

CUSTOM_USER = 'user/user/#{}' class-attribute instance-attribute

CUSTOM_BINARY = 'binary/binary/#{}' class-attribute instance-attribute

CUSTOM_PACKAGE = 'package/package/#{}' class-attribute instance-attribute

NxtForbiddenResponse

Bases: BaseModel

Error response when no permissions.

Attributes

message : str Message describing the error.

message: str instance-attribute

NxtIdentification

Bases: BaseModel

IdentIdentification info for the given object, including the field name and its value.

Attributes
name : NxtIdentificationName
    The name of the identification field.
value : str
    The value used to identify the object.

value: str instance-attribute

name(value: NxtIdentificationName) -> str

Serialize the 'name' field when used in JSON.

Parameters

value : NxtIdentificationName Name of the field to be used to identify the object.

Returns
str
    string value of the name field

validate_name(value: Union[str, NxtIdentificationName]) -> NxtIdentificationName classmethod

Convert value to NxtIdentification if needed.

Parameters

value : Union [str, NxtIdentificationName] Name of the field to be used to identify the object.

Returns
NxtIdentificationName
    Name of the field to be used to identify the object.

check_non_empty(v: str) -> str classmethod

Ensure value is not empty.

Parameters

v : str value to be used to identify the object.

Returns
str
    string value of the name field.
Raises
ValueError
     if value is empty.

NxtIdentificationName

Bases: str, Enum

Enumeration for allowed identification field names.

DEVICE_DEVICE_NAME = 'device/device/name' class-attribute instance-attribute

DEVICE_DEVICE_UID = 'device/device/uid' class-attribute instance-attribute

USER_USER_SID = 'user/user/sid' class-attribute instance-attribute

USER_USER_UID = 'user/user/uid' class-attribute instance-attribute

USER_USER_UPN = 'user/user/upn' class-attribute instance-attribute

BINARY_BINARY_UID = 'binary/binary/uid' class-attribute instance-attribute

PACKAGE_PACKAGE_UID = 'package/package/uid' class-attribute instance-attribute

NxtIndividualObjectError

Bases: BaseModel

Error for an individual object, composed of identification information about the object and the list of errors.

Attributes
identification : [NxtIdentification]
    List containing a single NxtIdentification instance.
errors : list[NxtError]
    List containing NxtError instances.
model_config : ConfigDict
    Configuration dictionary allowing arbitrary types.

identification: conlist(NxtIdentification, min_length=1, max_length=1) = Field(default_factory=lambda: [NxtIdentification(name=NxtIdentificationName(value='default_name'), value='default_value')]) class-attribute instance-attribute

errors: conlist(NxtError, min_length=1) = Field(default_factory=lambda: [NxtError(message='default_message', code='default_value')]) class-attribute instance-attribute

model_config = ConfigDict(arbitrary_types_allowed=True) class-attribute instance-attribute

NxtPartialSuccessResponse

Bases: BaseModel

Partial success response when some of the objects in the request contain errors but other objects are processed.

Attributes
status  : Literal["partial_success"]
    Indicates the status of the response as 'partial_success'.
errors : list[NxtIndividualObjectError]
    List containing NxtIndividualObjectError instances representing the errors in the request.

status: Literal['partial_success'] = Field(default='partial_success') class-attribute instance-attribute

errors: conlist(NxtIndividualObjectError, min_length=1) instance-attribute

NxtSuccessResponse

Bases: BaseModel

Response when ALL objects have been processed correctly.

Attributes
status : Literal["success"]
    Indicate the success status of the response.

status: Literal['success'] = Field(default='success') class-attribute instance-attribute