mstrio > server > environment

class mstrio.server.environment.Environment(connection)

Bases: object

Browse 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.

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 with values of selected project’ settings.

Return type:

DataFrame

create_project(name, description=None, force=False)

Create a new project on the environment.

Parameters:
  • name (str) – Name of Project.

  • description (str | None) – Description of Application.

  • force (bool) – If True, overrides the prompt.

Return type:

Project | None

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()
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:

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