PAM360 Python SDK documentation
All Entities Examples
Quickstart
SDK Client Registration
from com.manageengine.pam360.sdk.services.service_configuration import ServiceConfiguration
from com.manageengine.pam360.sdk.services.registration_utility import ClientRegistrationManager
host_name = "hostname"
port_no = 8282
# provide certificate_path when using self-signed certificate
# it is not required when using CA certificate
config = ServiceConfiguration(
host=host_name,
port=port_no,
certificate_path=r"path/to/certificate.pem"
)
# providing client name is optional
sdk_client = "python sdk client"
sdk_policy_token = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
# registration
registration_manager = ClientRegistrationManager(config)
registration_manager.register(
registration_token=sdk_policy_token,
client_name=sdk_client
)
# Check if SDK Client is registered
print("SDK Registration Status: ", registration_manager.is_registered())
Entities Creation
from com.manageengine.pam360.sdk.services.pam_service import PAMService
from com.manageengine.pam360.sdk.services.service_configuration import ServiceConfiguration
host_name = "hostname"
port_no = 8282
# provide certificate_path when using self-signed certificate
# it is not required when using CA certificate
config = ServiceConfiguration(
host=host_name,
port=port_no,
certificate_path=r"path\to\certificate.pem"
)
user_api_token = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
# PAMService is the entry point to all entities
service = PAMService(
service_config=config,
user_token=user_api_token
)
# Entity is the entry point to all entity-related operations
user_entity = service.get_user_instance()
resource_entity = service.get_resource_instance()
account_entity = service.get_account_instance()
resource_group_entity = service.get_resource_group_instance()
access_control_entity = service.get_access_control_instance()
password_entity = service.get_password_instance()
audit_entity = service.get_audit_instance()
Sample Code
import logging
from com.manageengine.pam360.sdk.exception.pam_exception import SDKError
from com.manageengine.pam360.sdk.services.pam_service import PAMService
from com.manageengine.pam360.sdk.services.service_configuration import ServiceConfiguration
app_logger = logging.getLogger(__name__)
try:
pam_host_name = 'CHEST11F-H07'
pam_server_port = 8282
# provide certificate_path when using self-signed certificate
# otherwise, not required for CA certificate
config = ServiceConfiguration(
host=pam_host_name,
port=pam_server_port,
certificate_path=r"path\to\self-signed-certificate.pem"
)
restapi_token = "########-####-####-####-############"
# PAMService is the entry point to all entities
service = PAMService(service_config=config, user_token=restapi_token)
# Entity is the entry point to all entity-related operations
# In this case, Password Entity
password_entity = service.get_password_instance()
# Get Password of an Account under a Resource
resource = "ad-services2k19"
account = "sysadmin"
password = password_entity.get_password_account(resource_name=resource, account_name=account)
print(f"Password of {account} Account under {resource} Resource is {password}")
except SDKError as ex:
app_logger.error(ex)