mstrio > server > environment¶
- class mstrio.server.environment.Environment(connection)¶
Bases:
objectBrowse and manage Projects on the environment. List loaded projects, nodes (servers) and compare project settings on the environment. Browse and modify I-Server settings.
- Parameters:
connection (Connection)
- connection¶
A Strategy One connection object.
- server_settings¶
Intelligence Server settings object.
- nodes¶
List of I-Server nodes and their properties.
- node_names¶
List of I-Server node names.
- __init__(connection)¶
Initialize Environment object.
- Parameters:
connection (
Connection) – Strategy One connection object returned by connection.Connection().
- compare_settings(projects=None, show_diff_only=False)¶
Compare project’ settings to the first project in the provided list.
- Parameters:
projects (list of names or project objects, optional) – List of project objects or names to be compared. First element of list is the one to which the rest is compared. If None, all projects on the environment will be compared.
show_diff_only (bool, optional) – Whether to display all settings or only different from first project in list.
- Returns:
DataFrame– Dataframe with values of selected project’ settings.- Return type:
DataFrame
- create_project(name, description=None, force=False, async_request=False)¶
Create a new project on the environment.
- Parameters:
name (str) – Name of the new project.
description (str, optional) – Description of the new project.
force (bool, optional) – Whether to skip confirmation prompt. Defaults to False.
async_request (bool, optional) – Whether to create the project asynchronously (not wait for it before returning). Defaults to False.
- Returns:
The created Project object (unless prompted to abort or create asynchronously).
- Return type:
- delete_server_element_cache()¶
Delete element cache for all projects on the environment.
- Return type:
None
- delete_server_object_cache()¶
Delete object cache for all projects on the environment.
- Return type:
None
- fetch_settings()¶
Fetch the current server settings from the environment.
- Return type:
None
- fetch_storage_service()¶
Fetch the current configuration for Storage Service from the environment.
- Return type:
None
- is_cluster()¶
Checks if the Environment is a cluster (aka has more than 1 node).
- is_loaded(project=None, project_id=None, project_name=None)¶
Check if project is loaded, by passing project ID or name, returns True or False.
- Parameters:
project (Project | str, optional) – Project object or ID or name specifying the project. May be used instead of project_id or project_name.
project_id (str, optional) – Project ID
project_name (str, optional) – Project name
- Returns:
True if project is loaded, False otherwise.
- Return type:
bool
- list_fences(to_dictionary=False, limit=None, **filters)¶
Get list of fences.
- Parameters:
to_dictionary (bool, optional) – If True returns dicts, by default (False) returns objects.
limit (int, optional) – limit the number of elements returned. If None (default), all objects are returned.
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘rank’]
- Returns:
list[Fence] |list[dict] – A list of content group objects or dictionaries representing them.- Return type:
list[Fence] | list[dict]
- list_loaded_projects(to_dictionary=False, **filters)¶
Return list of all loaded project objects or project dicts if to_dictionary=True that the user has access to. Optionally filter the Projects by specifying the filters keyword arguments.
- Parameters:
to_dictionary (
bool) – If True, returns list of project dicts**filters – Available filter parameters: [‘acg’, ‘id’, ‘name’, ‘status’, ‘alias’, ‘description’, ‘date_created’, ‘date_modified’, ‘owner’]
- Return type:
list[Project] |list[dict]
- list_nodes(project=None, project_id=None, project_name=None, node_name=None)¶
Return a list of I-Server nodes and their properties. Optionally filter by project or node_name.
- Parameters:
project (Project | str, optional) – Project object or ID or name specifying the project. May be used instead of project_id or project_name.
project_id (str, optional) – Project ID
project_name (str, optional) – Project name
node_name (str, optional) – Name of node
- Return type:
list[dict]
- list_projects(to_dictionary=False, limit=None, **filters)¶
Return list of project objects or project dicts if to_dictionary=True. Optionally filter the Projects by specifying the filters keyword arguments.
- Parameters:
to_dictionary (
bool) – If True returns list of project dicts.limit (
int|None) – limit the number of elements returned. If None, all objects are returned.**filters – Available filter parameters: [‘name’, ‘id’, ‘description’, ‘date_created’, ‘date_modified’, ‘owner’].
- Return type:
list[Project] |list[dict]
- purge_all_change_journals(comment=None, timestamp=None)¶
- Purge change journal entries for all projects on the environment
including configuration change journal entries.
Note
Only change journal entries older than a week can be purged.
- Parameters:
comment (str, optional) – Comment for the purge action.
timestamp (str, datetime, optional) – Timestamp for purging entries. If string, must be in ‘MM/DD/YYYY HH:MM:SS AM/PM’ format. If datetime object, will be converted to required format. Entries before this timestamp will be purged. If not provided, all entries will be purged.
- Return type:
None
- purge_configuration_change_journals(comment=None, timestamp=None)¶
Purge configuration change journal entries.
Note
Only change journal entries older than a week can be purged.
- Parameters:
comment (str, optional) – Comment for the purge action.
timestamp (str, datetime, optional) – Timestamp for purging entries. If string, must be in ‘MM/DD/YYYY HH:MM:SS AM/PM’ format. If datetime object, will be converted to required format. Entries before this timestamp will be purged. If not provided, all entries will be purged.
- Return type:
None
- update_settings()¶
Update the current server settings saved in the ServerSettings object.
- update_storage_service(storage_type=None, alias=None, location=None, s3_region=None, aws_access_id=None, aws_secret_key=None, azure_storage_account_name=None, azure_secret_key=None, gcs_service_account_key=None, skip_validation=False, validate_only=False)¶
Update the storage service configuration on the environment. If new values aren’t provided for any parameter, the config stored in the object will be used.
- Parameters:
storage_type (StorageType, optional) – Type of storage service.
alias (str, optional) – Alias of the storage configuration,
location (str, optional) – Storage location, e.g. bucket name for S3, absolute path of folder for File System
s3_region (str, optional) – S3 bucket region
aws_access_id (str, optional) – Access ID for AWS S3
aws_secret_key (str, optional) – Access key for AWS S3
azure_storage_account_name (str, optional) – Account name for Azure
azure_secret_key (str, optional) – Access key for Azure
skip_validation (
bool) – Whether to skip validation of the storage service configuration prior to updating.validate_only (
bool) – If True, validate the configuration without updating.gcs_service_account_key (str | None)
- Return type:
None
- property ldap_batch_import: LDAPBatchImport¶
Engine handling LDAP Batch Import for this Environment.
- property node_names: list[str]¶
- property nodes: list[dict]¶
- property pa_statistics: PAStatisticsEnvLevel¶
Engine handling PA Statistics operations for this Environment.
- property server_settings: ServerSettings¶
ServerSettings object storing I-Server settings.
Settings can be listed by using list_properties() method. Settings can be modified directly by settings the values in the object.
- property storage_service: StorageService¶
StorageService object with configuration of the Storage Service. object.
- class mstrio.server.environment.LDAPBatchImport(parent)¶
Bases:
objectClass for handling LDAP batch import operations.
This class is used to perform batch import operations on LDAP directories.
Note
It is not intended to be used directly. Use Environment.ldap_batch_import instead.
- Parameters:
parent (Environment)
- enum ImportStatus(value)¶
Bases:
EnumValid values are as follows:
- NO_IMPORT = <ImportStatus.NO_IMPORT: 'No import'>¶
- IN_PROGRESS = <ImportStatus.IN_PROGRESS: 'In progress'>¶
- FINISHED = <ImportStatus.FINISHED: 'Finished'>¶
- CANCELED = <ImportStatus.CANCELED: 'Canceled'>¶
- ERROR = <ImportStatus.ERROR: 'Error'>¶
- UNKNOWN = <ImportStatus.UNKNOWN: 'Unknown'>¶
- __init__(parent)¶
Initialize LDAPBatchImport object.
- Parameters:
parent (
Environment) – Environment object to which this import belongs.
- check_status()¶
Check the status of the LDAP batch import operation.
- Returns:
The current status of the import operation.
- Return type:
- get_status_data()¶
Get the status data of the LDAP batch import operation.
- Returns:
The status data of the import operation.
- Return type:
dict
- start()¶
Start the LDAP batch import operation.
- Returns:
- True if the import operation was started successfully,
False otherwise.
- Return type:
bool
- stop()¶
Stop the LDAP batch import operation.
- Returns:
True if the import operation was stopped successfully,
- Return type:
bool
- property status: ImportStatus¶
Get the current status of the LDAP batch import operation.
This value is cached. If you want to check the current server status, use check_status() method.
- Returns:
The current status of the import operation.
- Return type:
- class mstrio.server.environment.PAStatisticsEnvLevel(parent)¶
Bases:
objectClass for handling PA Statistics operations at the Environment level.
Note
It is not intended to be used directly. Use Environment.pa_statistics instead.
- Parameters:
parent (Environment)
- class RepositoryInfo(repository_id, pa_project_id)¶
Bases:
Dictable- Parameters:
repository_id (str)
pa_project_id (str)
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (
bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates an object from a dictionary. The dictionary’s keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of an object that should be created.
source (Dict[str, Any]) – A dictionary from which an object will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (
bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- to_dict(camel_case=True, whitelist_keys=None, skip_private_keys=False)¶
Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.
- Parameters:
camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.
whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.
skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.
- Returns:
- A dictionary representation of object’s attributes and values.
By default, the dictionary keys are in camel case.
- Return type:
dict
-
pa_project_id:
str¶
-
repository_id:
str¶
- class TelemetryConfig(basic_stats=None, client_telemetry=None, detailed_rep_jobs=None, detailed_doc_jobs=None, job_sql=None, columns_tables=None, mobile_clients=None, mobile_manipulation=None, mobile_client_location=None)¶
Bases:
Dictable- Parameters:
basic_stats (bool | None)
client_telemetry (bool | None)
detailed_rep_jobs (bool | None)
detailed_doc_jobs (bool | None)
job_sql (bool | None)
columns_tables (bool | None)
mobile_clients (bool | None)
mobile_manipulation (bool | None)
mobile_client_location (bool | None)
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (
bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates an object from a dictionary. The dictionary’s keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of an object that should be created.
source (Dict[str, Any]) – A dictionary from which an object will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (
bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- to_dict(camel_case=True, whitelist_keys=None, skip_private_keys=False)¶
Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.
- Parameters:
camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.
whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.
skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.
- Returns:
- A dictionary representation of object’s attributes and values.
By default, the dictionary keys are in camel case.
- Return type:
dict
-
basic_stats:
bool|None= None¶
-
client_telemetry:
bool|None= None¶
-
columns_tables:
bool|None= None¶
-
detailed_doc_jobs:
bool|None= None¶
-
detailed_rep_jobs:
bool|None= None¶
-
job_sql:
bool|None= None¶
-
mobile_client_location:
bool|None= None¶
-
mobile_clients:
bool|None= None¶
-
mobile_manipulation:
bool|None= None¶
- class TelemetryConnections(servers, protocol=Protocol.PLAINTEXT)¶
Bases:
Dictable- Parameters:
servers (list[str])
protocol (str | Protocol)
- enum Protocol(value)¶
Bases:
AutoUpperNameValid values are as follows:
- PLAINTEXT = <Protocol.PLAINTEXT: 'PLAINTEXT'>¶
- SASL_PLAINTEXT = <Protocol.SASL_PLAINTEXT: 'SASL_PLAINTEXT'>¶
- SASL_SSL = <Protocol.SASL_SSL: 'SASL_SSL'>¶
- SSL = <Protocol.SSL: 'SSL'>¶
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (
bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates an object from a dictionary. The dictionary’s keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of an object that should be created.
source (Dict[str, Any]) – A dictionary from which an object will be constructed.
connection (Connection, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.
with_missing_value (
bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- to_dict(camel_case=True, whitelist_keys=None, skip_private_keys=False)¶
Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.
- Parameters:
camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.
whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.
skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.
- Returns:
- A dictionary representation of object’s attributes and values.
By default, the dictionary keys are in camel case.
- Return type:
dict
-
servers:
list[str]¶
- disable_basic_telemetry_for_all_projects()¶
Disables client telemetry and basic statistics for all projects on the environment.
- Return type:
None
- enable_basic_telemetry_for_all_projects()¶
Enables client telemetry and basic statistics for all projects on the environment.
- Return type:
None
- get_repository_info()¶
Retrieves repository information from the I-Server.
- Returns:
- An object containing repository ID and
PA Project ID.
- Return type:
- get_telemetry_basic_configurations()¶
Retrieves the telemetry basic configurations for all projects from the I-Server.
- Returns:
- A dictionary containing telemetry
configuration details for each project.
- Return type:
dict[str, TelemetryConfig]
- get_telemetry_connections_info()¶
Retrieves the telemetry connections information from the I-Server.
- Returns:
- An object containing telemetry connections
information.
- Return type:
- get_telemetry_connections_validation_info(connections_data=None)¶
Retrieves the telemetry connections validation information from the I-Server.
- Parameters:
connections_data (TelemetryConnections | dict, optional) – The telemetry connections information to validate. If not provided, the current telemetry connections information will be fetched and validated. Must contain servers (list of server addresses) and protocol (connection protocol, either as a string or as a Protocol enum value).
- Return type:
dict[str, dict]
Example
` # Valid "servers" data -> <host:port> servers = ["host.com:9092"] `- Returns:
- A dictionary containing validation results for the
telemetry connections information. It contains server as key and validation result as value.
- Return type:
dict[str, dict]
- Parameters:
connections_data (TelemetryConnections | dict | None)
- update_repository_info(new_info)¶
Updates the repository information on the I-Server.
- Parameters:
new_info (RepositoryInfo | dict) – New repository information. Both repository_id and pa_project_id must be provided, either as a RepositoryInfo object or as a dictionary with keys repository_id and pa_project_id.
- Return type:
None
- update_telemetry_connections_info(new_data)¶
Updates the telemetry connections information on the I-Server.
- Parameters:
new_data (TelemetryConnections | dict) – New telemetry connections information. Must contain servers (list of server addresses) and protocol (connection protocol, either as a string or as a Protocol enum value. protocol is optional and defaults to Protocol.PLAINTEXT).
- Return type:
None
Example
` # Valid "servers" data -> <host:port> servers = ["host.com:9092"] `
- validate_telemetry_connections(connections_data=None)¶
Tests telemetry connections by sending the provided configuration to the server and checking connectivity.
- Parameters:
connections_data (TelemetryConnections | dict, optional) – The telemetry connections information to validate. If not provided, the current telemetry connections information will be fetched and validated. Must contain servers (list of server addresses) and protocol (connection protocol, either as a string or as a Protocol enum value).
- Return type:
dict[str, bool]
Example
` # Valid "servers" data -> <host:port> servers = ["host.com:9092"] `- Returns:
- A dictionary containing server as key and a boolean
indicating whether the connection was successful as value.
- Return type:
dict[str, bool]
- Parameters:
connections_data (TelemetryConnections | dict | None)