Enums

enum ampapi.enums_.AccessModeState(value)[source]

Related to Node: ADSModule.Network.AccessMode

Valid values are as follows:

via_target = <AccessModeState.via_target: 0>
direct_controller = <AccessModeState.direct_controller: 10>
bypass_controller = <AccessModeState.bypass_controller: 20>
enum ampapi.enums_.ADSModeState(value)[source]

Related to Node: ADSModule.ADS.Mode

Valid values are as follows:

not_set = <ADSModeState.not_set: 0>
controller = <ADSModeState.controller: 10>
hybrid = <ADSModeState.hybrid: 20>
target = <ADSModeState.target: 30>
stand_alone = <ADSModeState.stand_alone: 100>
enum ampapi.enums_.AMPDownloadMirrorState(value)[source]

Related to Node: ADSModule.ADS.DownloadMirror

Valid values are as follows:

us_central = <AMPDownloadMirrorState.us_central: '[Automatic]'>
eu_west = <AMPDownloadMirrorState.eu_west: ''>
us_central_texas = <AMPDownloadMirrorState.us_central_texas: 'US Central - Texas'>
enum ampapi.enums_.AMPInstanceState(value)[source]

Represents the state of an Instance and or Application inside an Instance.

Valid values are as follows:

undefined = <AMPInstanceState.undefined: -1>
stopped = <AMPInstanceState.stopped: 0>
pre_start = <AMPInstanceState.pre_start: 5>
configuring = <AMPInstanceState.configuring: 7>
starting = <AMPInstanceState.starting: 10>
ready = <AMPInstanceState.ready: 20>
restarting = <AMPInstanceState.restarting: 30>
stopping = <AMPInstanceState.stopping: 40>
preparing_for_sleep = <AMPInstanceState.preparing_for_sleep: 45>
sleeping = <AMPInstanceState.sleeping: 50>
waiting = <AMPInstanceState.waiting: 60>
installing = <AMPInstanceState.installing: 70>
updating = <AMPInstanceState.updating: 75>
awaiting_user_input = <AMPInstanceState.awaiting_user_input: 80>
failed = <AMPInstanceState.failed: 100>
suspended = <AMPInstanceState.suspended: 200>
maintenance = <AMPInstanceState.maintenance: 250>
indeterminate = <AMPInstanceState.indeterminate: 999>
enum ampapi.enums_.AMPTheme(value)[source]

Related to Node: Core.AMP.Theme

Valid values are as follows:

aura = <AMPTheme.aura: 'Aura'>
black = <AMPTheme.black: 'Black'>
tenth_anniversary = <AMPTheme.tenth_anniversary: 'TenthAnniversary'>
to_boldly_go = <AMPTheme.to_boldly_go: 'ToBoldlyGo'>
default = <AMPTheme.default: 'default'>
enum ampapi.enums_.ApplicationUpdatesState(value)[source]

Related to Node: steamcmdplugin.SteamUpdateSettings.UpdateCheckMethod

Valid values are as follows:

by_timestamp = <ApplicationUpdatesState.by_timestamp: 0>
by_build_id = <ApplicationUpdatesState.by_build_id: 1>
enum ampapi.enums_.AppStartupModeState(value)[source]

Related to Node: Core.AMP.AppStartupMode

Valid values are as follows:

do_nothing = <AppStartupModeState.do_nothing: 0>
update = <AppStartupModeState.update: 1>
start = <AppStartupModeState.start: 2>
update_and_start = <AppStartupModeState.update_and_start: 3>
unk = <AppStartupModeState.unk: 16>
unk2 = <AppStartupModeState.unk2: 32>
enum ampapi.enums_.ContainerMemoryPolicyState(value)[source]

An enumeration.

Valid values are as follows:

not_specified = <ContainerMemoryPolicyState.not_specified: 0>
reserve = <ContainerMemoryPolicyState.reserve: 100>
restrict = <ContainerMemoryPolicyState.restrict: 200>
enum ampapi.enums_.DefaultIPBindingState(value)[source]

Related to Node: ADSModule.Network.DockerExternalIPBinding, ADSModule.Network.DefaultAppIPBinding, ADSModule.Network.DefaultIPBinding

Valid values are as follows:

ipv4_loopback = <DefaultIPBindingState.ipv4_loopback: '127.0.0.1'>
enp42s0 = <DefaultIPBindingState.enp42s0: '192.168.4.50'>
any_ipv4_address = <DefaultIPBindingState.any_ipv4_address: '0.0.0.0'>
any_ipv6_address = <DefaultIPBindingState.any_ipv6_address: '::'>
enum ampapi.enums_.LoggingLevelState(value)[source]

Related to Node: Core.Monitoring.LogLevel

Valid values are as follows:

debug = <LoggingLevelState.debug: 0>
info = <LoggingLevelState.info: 10>
chat = <LoggingLevelState.chat: 11>
notice = <LoggingLevelState.notice: 20>
warning = <LoggingLevelState.warning: 30>
error = <LoggingLevelState.error: 40>
activity = <LoggingLevelState.activity: 5>
fatal = <LoggingLevelState.fatal: 50>
event = <LoggingLevelState.event: 7>
audit = <LoggingLevelState.audit: 8>
enum ampapi.enums_.PortAssignmentState(value)[source]

Related to Node: ADSModule.Network.PortAssignment

Valid values are as follows:

include_allowed_ports_only = <PortAssignmentState.include_allowed_ports_only: 0>
allow_all_except_excluded = <PortAssignmentState.allow_all_except_excluded: 1>
enum ampapi.enums_.PostCreateActionsState(value)[source]

The action the Instance will take after creation. Used in dataclass parameters.

Valid values are as follows:

do_nothing = <PostCreateActionsState.do_nothing: 0>
start_instance = <PostCreateActionsState.start_instance: 1>
start_and_update = <PostCreateActionsState.start_and_update: 2>
full_startup = <PostCreateActionsState.full_startup: 3>
every_time = <PostCreateActionsState.every_time: 16>
enum ampapi.enums_.PostCreateState(value)[source]

Represents the state of the API call ADSModule/DeployTemplate Related to Node: ADSModule.Defaults.DefaultPostCreate

Valid values are as follows:

do_nothing = <PostCreateState.do_nothing: 0>
update_once = <PostCreateState.update_once: 1>
update_always = <PostCreateState.update_always: 2>
update_and_start_once = <PostCreateState.update_and_start_once: 3>
update_and_start_always = <PostCreateState.update_and_start_always: 4>
start_always = <PostCreateState.start_always: 5>
enum ampapi.enums_.ReleaseStreamState(value)[source]

Related to Node: ADSModule.Defaults.DefaultReleaseStream

Valid values are as follows:

lts = <ReleaseStreamState.lts: 5>
mainline = <ReleaseStreamState.mainline: 10>
preview = <ReleaseStreamState.preview: 15>
development = <ReleaseStreamState.development: 20>
enum ampapi.enums_.TwoFactoryModeState(value)[source]

Related to Node: Core.Security.TwoFactorMode

Valid values are as follows:

optional = <TwoFactoryModeState.optional: 0>
required = <TwoFactoryModeState.required: 1>

Types

These are all TypedDicts

class ampapi.types_.ActionSpec[source]

ads_module: dict[str, Any]

file_manager_plugin: dict[str, Any]

email_sender_plugin: dict[str, Any]

common_core_plugin: dict[str, Any]

core: dict[str, Any]

class ampapi.types_.APISpec[source]

analytics_plugin: dict[str, APISPecEndpointData]

common_core_plugin: dict[str, APISPecEndpointData]

email_sender_plugin: dict[str, APISPecEndpointData]

file_manager_plugin: dict[str, APISPecEndpointData]

local_file_backup_plugin: dict[str, APISPecEndpointData]

minecraft_module: dict[str, APISPecEndpointData]

class ampapi.types_.APISPecEndpointData[source]

description: str

is_complex_type: bool

parameters: APISpecEndpointParameters

return_type_name: str

returns: str

class ampapi.types_.APISpecEndpointParameters[source]

description: str

name: str

option: bool

param_enum_values: str

type_name: str

class ampapi.types_.BukkitCategories[source]

id: int

name: str

class ampapi.types_.Consumes[source]

description: str

input_type: str

name: str

value_type: str

enum_values: NotRequired[str]

class ampapi.types_.MethodsData[source]

id: str

name: str

description: str

consumes: list[Consumes]

class ampapi.types_.ParameterMapping[source]

user: NotRequired[str]

reason: NotRequired[str]

class ampapi.types_.PermissionNode[source]

name: str

node: str

display_name: str

description: str

children: list[PermissionNode]

class ampapi.types_.ScheduleDataData[source]

available_methods: list[MethodsData]

available_triggers: list[TriggersData]

populated_triggers: list[TriggersData]

class ampapi.types_.TriggersData[source]

id: str

description: str

emits: list[str]

enabled_state: int

tasks: list[TriggerTasksData]

type: str

trigger_type: str

last_execute_error: NotRequired[bool]

last_error_reason: NotRequired[str]

class ampapi.types_.TriggerTasksData[source]

id: str

task_method_name: str

parameter_mapping: ParameterMapping

enabled_state: int

locked: bool

created_by: str

order: int

class ampapi.types_.MCUserData[source]

name: str

uuid: str

Data Modules

class ampapi.modules.APIParams(url: str, user: str, password: str, use_2fa: bool = False, token: str = '')[source]

A class to hold Login information for the AMP API.

Note

The url must be relative to the machine running the API and the machine must be able to connect to AMP.

Warning

**DO NOT SET OR UPDATE**-> APIParams._sessions.

url

The URL to access the Web GUI panel home page/login page.

Type:

str

user

The AMP User name to login to the Web Panel.

Type:

str

password

The AMP User password to login to the Web Panel.

Type:

str

use_2fa

To use TOTP 2 Factor Authentication, default is False.

Type:

bool

token

The 2 Factor Authentication Token Code to generate a TOTP code, default is “”

Type:

str

class ampapi.modules.ActionResult(status: bool, reason: str | None = None, result: str | None = None)[source]

Represents the JSON response data from most API Endpoints.

status

If the API call was successful.

Type:

bool

reason

If status is False this will typically have a str response.

Type:

Union[str, None]

result

If status is True this will contain data related to the API call.

Type:

Union[str, None]

class ampapi.modules.ActionResultError(status: bool, reason: str, result: Exception | str)[source]

Represents the _call_api() response if an error happens during runtime.

status

If the API call was successful, typically this is False.

Type:

bool

reason

The reason for the failure in a generic manner.

Type:

str

result

The Exception or result of the Error that occured and what it means.

Type:

Union[str, Exception]

result_type

Typically a string representation of the result to know what the Exception was.

Type:

Any

class ampapi.modules.AnalyticsCountryData(country: str, display_session_time: str, session_count: int, session_time_percent: float, total_session_time: float, unique_player_count: int, unique_player_percent: float, session_percent: float = <factory>)[source]

Represents the JSON response data from country_data.

country

The country code; similar to the ISO 3166-1 Alpha-2 format.

Type:

str

display_session_time

The current display’s session time per country.

Type:

str

session_count

The current number of sessions per country.

Type:

int

session_time_percent

UNK

Type:

float

total_session_time

The total session time per country.

Type:

float

unique_player_count

The unique player count per country.

Type:

int

unique_player_percent

The unique player percent out of all countries.

Type:

int

session_percent

The percent of total sessions related to this country.

Type:

int

class ampapi.modules.AnalyticsFilter(country: str, first_session: bool | None = None, meta: Any | None = None, username: str | None = None, user_id: str | None = None)[source]

A dataclass to handle filtering for get_analytics_summary(), pass this dataclass in as the filter_

Note

Simply create this class and fill out either username, user_id and or country.

Note

The country must be in ISO 3166-1 Alpha-2 format

country

The country to filter by.

Type:

str

first_session

Whether or not to filter by first session only, defaults to None.

Type:

Union[bool, None]

meta

UNK

Type:

Union[Any, None]

username

The username to filter by, defaults to None.

Type:

Union[str , None]

user_id

The user_id to filter by, currently using the username attribute, defaults to None.

Type:

Union[str, None]

class ampapi.modules.AnalyticsStats(name: str, description: str, current: int | str | float, display_value: int | str | float, difference: int | str | float, previous: int | str | float)[source]

Represents the JSON response data from AnalyticsSummary.stats.

Note

  • [“Total Sessions”, “Unique Users”, “New Users”, “Total Session Time”, “Bounce Rate”, “Session Duration”, “Sessions Per User”, “Longest Session”]

  • Bounce Rate = “Sessions where the user joined and then quickly left again.”

name

The Name of the current AnalyticsStats

Type:

str

description

The description of AnalyticsStats.name that is being tracked!

Type:

str

current

Represents the actual value; similar to display_value but in a raw representation. - Could be seconds, minutes or a count value depending on the description.

Type:

Union[int, float]

display_value

The value being displayed on the Analytics Summary Page after formatting.

Type:

Union[int, str, float]

difference

Has values such as “Infinity”, 0, and 0.0.

Type:

Union[int, str, float]

previous

UNK

Type:

Union[int, str, float]

class ampapi.modules.AnalyticsSummary(busiest_time: dict[str, int | str] = <factory>, country_data: list[~ampapi.modules.AnalyticsCountryData] = <factory>, graph_data: list[dict[str, int | str]] = <factory>, is_demo: bool = False, quietest_time: dict[str, int | str] = <factory>, stats: list[~ampapi.modules.AnalyticsStats] = <factory>, top_players: list[~ampapi.modules.AnalyticsTopPlayers] = <factory>)[source]

Represents the JSON response data from get_analytics_summary().

busiest_time

UNK, default is a list.

Type:

dict[str, Union[int, str]]

country_data

The Country information for the summary, default is a list.

Type:

list[AnalyticsCountryData]

graph_data

The Data displayed on the Web UI panel Analytics Menu, default is a list.

Type:

list[dict[str, Union[int, str]]]

is_demo

UNK, default is False.

Type:

bool

quietest_time

UNK, default is a dict.

Type:

dict[str, Union[int, str]]

stats

The Analytics Stats of the summary, default is a list.

Type:

list[AnalyticsStats]

top_players

The TOP players from the summary, default is a list.

Type:

list[AnalyticsTopPlayers]

class ampapi.modules.AnalyticsTopPlayers(display_session_time: str, percent: float, total_session_time: float, username: str)[source]

Represents the JSON Response data from top_players.

display_session_time

Display the session time.

Type:

str

percent

The percent of how much this value in comparison to total_session_time.

Type:

float

total_session_time

The total amount of session time the user has for the day.

Type:

float

username

The name of the session user. Like an IGN.

Type:

str

class ampapi.modules.Backup(created_automatically: bool, description: str, id: str, module_name: str, name: str, source_os: int, sticky: bool, stored_locally: bool, stored_remotely: bool, taken_by: str, total_size_bytes: int, timestamp: str)[source]

Represents the JSON response data from ADSModule.get_backups().

created_automatically

If the backup was created by a Scheduled Task.

Type:

bool

description

The description for the backup, if any.

Type:

str

id

The backup GUID.

Type:

str

module_name

What type of Instance that created the backup. eg. Minecraft, ADS, Generic

Type:

str

name

The name of the backup.

Type:

str

source_os

Unsure. I believe there is an ENUM correlation for which int value is which type of OS

Type:

int

sticky

If the Backup is Sticky.

Type:

bool

stored_locally

If the backup is local or not.

Type:

bool

stored_remotely

If the backup is stored in S3/Cloud or similar.

Type:

bool

taken_by

Who created the backup.

Type:

str

total_size_bytes

The total size of the backup is bytes.

Type:

int

timestamp

The timestamp comes in as ISO format and converts it into a datetime object.

Type:

datetime

class ampapi.modules.BuildInfo(major: int, minor: int, revision: int, minor_revision: int = 0, major_revision: int | None = None, build: int | None = None)[source]

Tied to the class attribute for UpdateInfo.build

Note

  • Currently has a converter function v2.6.0.0

  • __repr__ has been overridden to display in a joined string with build at the end.

major

The major version number of the AMP build.

Type:

int

minor

The minor version number of the AMP build.

Type:

int

revision

The revision number of the AMP build.

Type:

int

minor_revision

The minor revision number of the AMP build.

Type:

int

build

The build number, defaults to None.

Type:

Union[int, None]

classmethod to_dataclass(data: str, sep: str = '.') str | BuildInfo[source]

Parse a string type of the Version into a dataclass.

Note

Assumes structure is "2.6.0.0"

Parameters:
  • data (str) – The string type of the Version to parse.

  • sep (str) – The separator to split the string by.

Returns:

Returns the built dataclass if it succeeds. Otherwise you will get the data passed in back.

Return type:

str | AMPVersionInfo

class ampapi.modules.ConsoleEntries(contents: str, source: str, type: str, timestamp: str)[source]

Represents the JSON response data from Updates.console_entries.

contents

The contents of the console entry.

Type:

str

source

The source of the console entry. eg “Server thread/INFO, …”

Type:

str

type

The type of message. eg “Console, Chat, Error, …

Type:

str

timestamp

The timestamp comes in as ISO format and __post_init__() converts it into a datetime object.

Type:

str | datetime

class ampapi.modules.Controller(id: int, disabled: bool, is_remote: bool, platform: PlatformInfo, datastores: list[dict[str, str | int]], creates_in_containers: bool, can_create: bool, available_instances: list[Instance], available_ips: list[str], tags: list[str], url: str, last_updated: str, instance_id: str = '0', state: AMPInstanceState = AMPInstanceState.undefined, fitness: Fitness | None = None, friendly_name: str = 'None', state_reason: str = '', description: str = '', tags_list: list[str] | None = None)[source]

Represents the JSON response data for an AMP Controller Instance.

Note

See ADSModule.get_instances(include_self = True)() making the first instance “typically” the Controller Instance. aka ADS01.

Note

Similar to what you see when you log into AMP web GUI and see the Instances list. This attribute is cached and will require calling get_instances() to access the API converted class objects. * See the AMPControllerInstance.instances attribute.

id

UNK

Type:

int

disabled

If the Controller is Disabled or not.

Type:

bool

is_remote

If the Controller is remote or not.

Type:

bool

platform

Platform information related to the Instance.

Type:

PlatformInfo

datastores

The Datastores that the Controller has access to.

Type:

list[dict[str, Union[str, int]]]

creates_in_containers

The Controller will create the Instances in containers.

Type:

bool

can_create

If the Controller can create Instances or not.

Type:

bool

available_instances

A list of AMP Instances the Controller/ADS has permissions to see.

Type:

list[Instance]

available_ips

The list of available IPs the Controller/Instance has.

Type:

list[str]

tags

The tags related to the Controller/Instance.

Type:

list[str]

url

The URL for the Controller/Instance.

Type:

str

last_updated

The last_updated comes in as ISO format and Controller`__post_init__() converts it into a datetime object.

Type:

Union[str, datetime]

instance_id

The Controller/Instance ID tied to the Instance, default is “0”.

Type:

str

state

The state the Controller/Instance is in. See enum AMPInstanceState, default is AMPInstanceState.UNDEFINED.

Type:

AMPInstanceState

fitness

UNK.

Type:

Union[Fitness, None]

friendly_name

The Controller/Instance friendly name, default is “None”.

Type:

str

state_reason

UNK, default is “”.

Type:

str

description

Controller/Instance description, default is “”.

Type:

str

tags_list

The list of tags related to the Controller/Instance if any, default is None.

Type:

Union[list[str]]

class ampapi.modules.CreateInstance(target_ads_instance: str, friendly_name: str, module: str, new_instance_id: str = '', instance_name: str = '', ip_binding: str = '192.168.0.1', port_number: int = 8001, admin_username: str = '', admin_password: str = '', provision_settings: dict[str, str] = <factory>, auto_configure: bool = False, post_create: ~ampapi.enums_.PostCreateActionsState = PostCreateActionsState.do_nothing, start_on_boot: bool = False, display_image_source: str = '', target_datastore: int = 0, group: str | None = None)[source]

Represents the JSON response data from ADSModule.create_instance() function call.

Note

Unsure if this port_number respects port ranges of the ADS or not.

target_ads_instance

The Target instance ID to tie this Instance to.

Type:

str

friendly_name

The Instance friendly name, this is what you see in the web GUI.

Type:

str

module

The Instance module it will use.

Type:

str

new_instance_id

UNK

Type:

str

instance_name

The name for the Instance, similar to friendly_name.

Type:

str

ip_binding

The IP to assign to the Instance. See Controller.available_ips.

Type:

str

port_number

The Port to assign to the Instance.

Type:

int

admin_username

UNK

Type:

str

admin_password

The password for the admin_username.

Type:

str

provision_settings

UNK

Type:

dict[str, str]

auto_configure

When enabled, all settings other than the module, target and friendly_name are ignored and replaced with automatically generated values

Type:

bool

post_create

The action to take after creating the instance, defaults to do_nothing

Type:

PostCreateActionsState

start_on_boot

If the instance starts on boot or not, default is False.

Type:

bool

display_image_source

If the instance has a banner to display, you can define it here, default is “”.

Type:

str

target_datastore
The Datastore ID to create this Instance on.
Type:

int

class ampapi.modules.DeploymentTemplate(id: int, name: str, description: str, module: str, template_instance: Any, template_role: str, template_base_app: str, clone_role_into_user: bool, zip_overlay_path: str, match_datastore_tags: bool, settings_mappings: dict[str, str], tags: list[str], start_on_boot: bool = False)[source]

Used for ADSModule.update_deployment_template() function call.

Note

Your pre-created data structure to be parsed for the required API parameters.

clone_role_into_user

Clone the template_role to the users of this template.

Type:

bool

description

The description of the deployment template.

Type:

str

id

The ID of the deployment template.

Type:

int

module

The AMP Instance module type. eg. “Generic”, “Minecraft”

Type:

str

name

The deployment template name.

Type:

str

template_base_app

The application that is template is used for.

Type:

str

template_instance

UNK

Type:

Any

template_role

The template role name, similar to the AMP User Roles.

Type:

str

match_datastore_tags

To force match the datastore tags; if any.

Type:

bool

settings_mappings

A dictionary of setting mappings.

Type:

dict[str, str]

start_on_boot

If the Instance should start on ADS01/Controller boot or not, default is False.

Type:

bool

tags

The list of tags to assign to the template or that belong to the template.

Type:

list[str]

zip_overlay_path

To zip the overlay path.

Type:

bool

to_dict() dict[str, Any][source]

As the function name implies; converts the class to a dict.

Returns:

Returns the class attributes in a key, value paired dict.

Return type:

dict[str, Any]

class ampapi.modules.Directory(is_directory: bool, is_virtual_directory: bool, filename: str, size_bytes: int, is_downloadable: bool, is_editable: bool, is_archive: bool, is_excluded_from_backups: bool, created: str, modified: str)[source]

Represents the JSON response data from FileManagerPlugin.get_directory_listing()

is_directory

If the path is a directory.

Type:

bool

is_virtual_directory

If the path is a virtual directory.

Type:

bool

filename

The name of the file or directory.

Type:

str

size_bytes

The size of the file/directory in bytes.

Type:

int

is_downloadable

If the file can be downloaded.

Type:

bool

is_editable

If the file can be edited.

Type:

bool

is_archive

If the file is an archive.

Type:

bool

is_excluded_from_backups

If the file is excluded from backups.

Type:

bool

created

The time the file/directory was created.

Type:

str | datetime

modified

The time the file/directory was last modified.

Type:

str | datetime

class ampapi.modules.FileChunk(base_64_data: str, bytes_length: int)[source]

Represents the JSON response data from FileManagerPlugin.get_file_chunk()

base_64_data

The base64 encoded string of the file chunk.

Type:

str

bytes_length

The length of the file chunk in bytes.

Type:

int

class ampapi.modules.Fitness(available: bool, total_services: int, free_ram_mb: int, free_disk_mb: int, cpu_service_ratio: float, thread_queue_length: int, load_avg: float, remaining_instance_slots: int, score: float, score_description: str, score_zero_factors: list[Any])[source]

Represents the JSON response data for Instance.fitness attribute.

available

If the Instance is available to create more services or not.

Type:

bool

total_services

The total number of services running on the Instance.

Type:

int

free_ram_mb

The amount of free RAM on the Instance.

Type:

int

free_disk_mb

The amount of free disk space on the Instance.

Type:

int

cpu_service_ratio

The ratio of CPU usage to the number of services running on the Instance.

Type:

float

thread_queue_length

The length of the thread queue on the Instance.

Type:

int

load_avg

The load average on the Instance.

Type:

float

remaining_instance_slots

The number of remaining Instance slots on the License.

Type:

int

score

The score of the Instance.

Type:

float

score_description

A summary of the “remaining slots” aka the number of Instances you have left to create. * Includes the amount of “Free Ram” and “CPU Ratio”.

Type:

str

score_zero_factors

A list of factors that determine the score of the Instance.

Type:

list[Any]

class ampapi.modules.Instance(application_endpoints: list[dict[str, str]], app_state: AMPInstanceState, container_memory_mb: int, container_memory_policy: ContainerMemoryPolicyState, daemon: bool, daemon_autostart: bool, deployment_args: dict[str, str], disk_usage_mb: int, exclude_from_firewall: bool, friendly_name: str, ip: str, instance_id: str, instance_name: str, is_container_instance: bool, is_https: bool, management_mode: int, module: str, port: str, release_stream: int, running: bool, suspended: bool, target_id: str, amp_version: str | dict | BuildInfo | None = None, container_cpus: float = 0.0, tags: list | None = None, module_display_name: str = '', metrics: Metric | None = None, display_image_source: str = '', description: str = '', _instance_offline: str = 'The requested instance is not available at this time.')[source]

Represents the JSON response data for ADSModule.get_instance() or a list of these from ADSModule.get_instances().

application_endpoints

The list of application endpoints for the Instance.

Type:

list[dict[str, str]]

app_state

The state of the application.

Type:

AMPInstanceState

container_memory_mb

The amount of memory allocated to the container in MB.

Type:

int

container_memory_policy

The memory policy of the Instance.

Type:

ContainerMemoryPolicyState

daemon

If the Instance is a daemon.

Type:

bool

daemon_autostart

If the Instance should be autostart on boot.

Type:

bool

deployment_args

The deployment arguments of the Instance.

Type:

dict[str, str]

disk_usage_mb

The disk usage of the Instance in MB.

Type:

int

exclude_from_firewall

If the Instance should be excluded from the firewall.

Type:

bool

friendly_name

The friendly name of the Instance.

Type:

str

ip

The IP address of the Instance.

Type:

str

instance_id

The Instance GUID.

Type:

str

instance_name

The Instance name.

Type:

str

is_container_instance

If the Instance is a container instance.

Type:

bool

is_https

If the Instance is using HTTPS.

Type:

bool

management_mode

The management mode of the Instance.

Type:

int

module

The module of the Instance.

Type:

str

port

The port of the Instance.

Type:

str

release_stream

The release stream of the Instance.

Type:

int

running

If the Instance is running.

Type:

bool

suspended

If the Instance is suspended.

Type:

bool

target_id

The target ID of the Instance.

Type:

str

amp_version

The version of the AMP, default is None.

Type:

Union[str, dict, AMPVersionInfo, None]

container_cpus

The amount of CPU cores allocated to the container, default is 0.0.

Type:

float

tags

The list of tags of the Instance, default is None.

Type:

Union[None, list]

module_display_name

The display name of the module, default is “”.

Type:

str

metrics

The metrics of the Instance, default is None.

Type:

Union[Metric, None]

display_image_source

The source of the display image, default is “”.

Type:

str

description

The description of the Instance, default is “”.

Type:

str

static online(func: Callable[Concatenate[D, T], Coroutine[None, None, F]]) Callable[Concatenate[D, T], Coroutine[None, None, F]][source]

Checks the running property and raises ConnectionError if the attribute is equal to “False”.

Raises:

ConnectionError – The requested instance is not currently running at this time.

class ampapi.modules.InstanceDatastore(id: int, friendly_name: str, description: str, directory: str, soft_limit_mb: int, priority: int, tags: list[str], is_internal: bool, instance_limit: str = '0', active: bool = True, current_usage_mb: int = -1, sanitized_name: str = 'None')[source]

Represents a the class object to be used in ADSModule.add_datastore()

Warning

AMP must have read/write/execute access to the directory specified in the Directory parameter.

Note

This class is also used in ADSModule.update_datastore(), ADSModule.get_datastores(), ADSModule.get_datastore()

Parameters:
  • id (int) – The ID of the datastore.

  • friendly_name (str) – The friendly name of the datastore.

  • description (str) – The description of the datastore.

  • directory (str) – The on-disk location where instances will be stored. Changing this will not affect existing instances, only newly created ones.

  • soft_limit_mb (int) – Datastores that reach or exceed this limit in total size will not be considered as deployment targets. This is only a soft limit and does not prevent instances on this datastore from using more space.

  • priority (int) – Instances with a lower priority number are preferred over those with a higher number, all other factors being equal.

  • tags (list[str]) – A list of tags to apply to the datastore.

  • is_internal (bool) – If the datastore is internal.

  • instance_limit (str) – The maximum number of instances that can be provisioned on this datastore, defaults to 0 for unlimited.

  • active (bool) – Deactivating a datastore prevents new instances from being provisioned to it, defaults to True.

  • current_usage_mb (int) – The current usage of the datastore in megabytes, defaults to -1.

  • sanitized_name (str) – The sanitized name of the datastore, defaults to “None”.

class ampapi.modules.MCUser(name: str, uuid: str)[source]

Represents the JSON response data from MinecraftModule.mc_get_whitelist().

name

The username.

Type:

str

uuid

The Minecraft UUID.

Type:

str

class ampapi.modules.Messages(age_minutes: int, expired: bool, id: str, message: str, source: str)[source]

Represents a Message from the dataclass attribute Updates.messages

age_minutes

The age of the message in minutes.

Type:

int

expired

Whether the message has expired.

Type:

bool

id

The message ID.

Type:

str

message

The message.

Type:

str

source

The source of the message.

Type:

str

class ampapi.modules.Metric(active_users: MetricsData | None = None, cpu_usage: MetricsData | None = None, memory_usage: MetricsData | None = None)[source]

Represents the JSON response data for AppStatus.metrics and Instance.metrics.

active_users

The active users data.

Type:

Union[MetricsData, None]

cpu_usage

The cpu usage data.

Type:

Union[MetricsData, None]

memory_usage

The memory usage data.

Type:

Union[MetricsData, None]

class ampapi.modules.MetricsData(raw_value: int, max_value: int, percent: int, units: str, color: str | None = None, color2: str | None = None, color3: str | None = None)[source]

Represents the JSON response data for each of the attributes of Metrics.

raw_value

The raw value, or the current value of the field.

Type:

int

max_value

The max value the field can have.

Type:

int

percent

The percent of usage in relation to the max_value.

Type:

int

units

The unit of measurement for the field.

Type:

str

color

Color number 1 if applicable..

Type:

Union[None, str]

color2

Color number 2 if applicable.

Type:

Union[None, str]

color3

Color number 3 if applicable.

Type:

Union[None, str]

class ampapi.modules.Player(uuid: str = '', name: str = '')[source]

Represents a single player connected to a server.

uuid

The UUID of the player.

Type:

str

name

The name of the player.

Type:

str

uuid: str

Alias for field number 0

name: str

Alias for field number 1

class ampapi.modules.Players(data: dict[str, str])[source]

Represents the JSON response data from get_user_list().

Note

The print out of this dataclass can be long depending on the number of players connected due to separation by newline.

sorted

A sorted list of Player objects by name.

Type:

list[Player]

get_player(name_or_uuid: str) list[Player][source]

Search for a player by their name or UUID.

Parameters:

name_or_uuid (str) – The players name or UUID.

Returns:

A list of Player objects matching the search string.

Return type:

list[Player]

class ampapi.modules.Role(id: str, is_default: bool, name: str, description: str, hidden: bool, permissions: list[str], members: list[str], is_instance_specific: bool, is_common_role: bool, disable_edits: bool)[source]

Represents the JSON response data from Core.get_role().

id

The ID of the AMP role.

Type:

str

is_default

If the AMP role is the default role or not.

Type:

bool

name

The name of the AMP role.

Type:

str

description

The description of the AMP role.

Type:

str

hidden

If the AMP role is hidden or not.

Type:

bool

permissions

The list of permissions the AMP role has.

Type:

list[str]

members

The list of AMP users who have the role.

Type:

list[str]

is_instance_specific

If the AMP role is only for a specific instance or not.

Type:

bool

is_common_role

If the AMP role is common or not.

Type:

bool

disable_edits

If the AMP role can be edited by users with the role or not.

Type:

bool

class ampapi.modules.RunningTask(is_primary_task: bool, start_time: str, id: str, name: str, description: str, hide_from_ui: bool, fast_dismiss: bool, last_update_pushed: str, progress_percent: float, is_cancellable: bool, origin: str, is_indeterminate: bool, state: int, status: str)[source]

Represents the JSON response data from functions that return RunningTask.

is_primary_task

If the task is the primary task or not.

Type:

bool

start_time

The start time of the task.

Type:

str

id

The ID of the task.

Type:

str

name

The name of the task.

Type:

str

description

The description of the task.

Type:

str

hide_from_ui

If the task is hidden from the UI or not.

Type:

bool

fast_dismiss

If the task is fast dismiss or not.

Type:

bool

last_update_pushed

The last update pushed of the task.

Type:

str

progress_percent

The progress percent of the task.

Type:

float

is_cancellable

If the task is cancellable or not.

Type:

bool

origin

The origin of the task.

Type:

str

is_indeterminate

If the task is indeterminate or not.

Type:

bool

state

The state of the task.

Type:

int

status

The status of the task.

Type:

str

class ampapi.modules.ScheduleData(available_methods: list[~ampapi.modules.Methods] = <factory>, available_triggers: list[~ampapi.modules.Triggers] = <factory>, populated_triggers: list[~ampapi.modules.Triggers] = <factory>)[source]

Represents the JSON response data from Core.get_schedule_data().

available_methods

The available methods.

Type:

list[Methods]

available_triggers

The available triggers.

Type:

list[Triggers]

populated_triggers

The populated triggers.

Type:

list[Triggers]

class ampapi.modules.Session(source: str, session_id: str, username: str, session_type: str, start_time: str, last_activity: str)[source]

Represents the JSON response data from Core.get_active_amp_sessions().

source

The source of the session.

Type:

str

session_id

The ID of the session.

Type:

str

username

The username the session belongs to.

Type:

str

session_type

The type of the session.

Type:

str

start_time

The start time of the session.

Type:

datetime

last_activity

The last time the session was active.

Type:

datetime

class ampapi.modules.Status(state: AMPInstanceState, uptime: str, metrics: Metric | None = None)[source]

Represents the JSON response data from Core.get_updates()

state

The state of the AMP Instance.

Type:

AMPInstanceState

uptime

The up time of the Instance, in Days, Hours, Minutes, Seconds format. 00:00:00:00

Type:

str

metrics

The Metrics data related to the Instance if any, default is None.

Type:

Union[Metric, None]

class ampapi.modules.TriggerID(data: list[TriggersData])[source]

Used for a multitude of functions all related to Triggers and their IDs.

Simply access the respective attribute and the unique GUID for that AMPInstance Trigger ID will be returned.

class ampapi.modules.Updates(console_entries: list[~ampapi.modules.ConsoleEntries], status: ~ampapi.modules.Status, messages: list[~ampapi.modules.Messages], ports: list[~ampapi.modules.Port] = <factory>, tasks: list[~ampapi.modules.RunningTask] = <factory>)[source]

Represents the JSON response data from Core.get_updates().

console_entries

The list of entries in the console.

Type:

list[ConsoleEntries]

status

The status of the Server.

Type:

Status

messages

The list of messages the Instance or Server has.

Type:

list[Messages]

ports

The list of ports the Server is listening/using, default is an empty list.

Type:

list[Port], optional

tasks

The list of tasks the Server is running, default is an empty list.

Type:

list[RunningTask] , optional

class ampapi.modules.User(cannot_change_password: bool, disable: bool, gravatar_hash: str, id: str, is_ldap_user: bool, is_super_user: bool, is_two_factor_enabled: bool, must_change_password: bool, name: str, password_expires: bool, permissions: list[str], roles: list[str], email_address: str, last_login: str)[source]

Represents the JSON response data from the function Core.get_all_amp_user_info() or Core.get_amp_user_info()

cannot_change_password

If the user cannot change their password or not.

Type:

bool

disable

If the user is disabled or not.

Type:

bool

gravatar_hash

The gravatar hash of the user.

Type:

str

id

The ID of the user.

Type:

str

is_ldap_user

If the user is an LDAP user or not.

Type:

bool

is_super_user

If the user has the Super User role or not.

Type:

bool

is_two_factor_enabled

If the user has 2FA enabled or not.

Type:

bool

must_change_password

If the user must change their password or not when they log in next.

Type:

bool

name

The name of the user.

Type:

str

password_expires

If the user password expires or not when they log in next.

Type:

bool

permissions

The list of permissions the user has.

Type:

list[str]

roles

The list of AMP roles the user has.

Type:

list[str]

email_address

The email address of the user.

Type:

str

last_login

The last login date of the user.

Type:

datetime