The BlueCat Library API provides access to BlueCat Address Manager functionality that can be used outside of BlueCat Address Manager and BlueCat Gateway — that is, without the need for Gateway. It contains a set of wrapper classes that abstract functionality available from the Address Manager API Client, as well as other Address Manager and BDDS functions.
Use the BlueCat Libraries APIs when building automation solutions that don't need access to the BlueCat Gateway UI.
Accessing the BlueCat Library API
To access the API in your scripts, import the appropriate libraries, then create an instance of the Client class of the type that you need. You can then reference API methods, functions, subclasses, and so on from that Client instance as needed.
The following Clients and Modules are available:
bluecat_libraries.address_manager.api: This Client class provides access to the main Address Manager Client API. It lets you perform Address Manager and Gateway actions that don't require a UI.
bluecat_libraries.address_manager.failover_api: The Failover class provides access to the Failover API. The Failover API is a service configuration in Address Manager that lets you build an externally automated failover process when the primary instance of Address Manager fails.
bluecat_libraries.address_manager.api.models: The models module includes classes and methods for working with data models for BlueCat Address Manager object types.
bluecat_libraries.address_manager.constants: Some of the inputs and outputs from the Address Manager API use fixed values for certain fields. The constants class contains enumerated values to help work with data you send to and acquire from Address Manager.
# Print the names and addresses of servers under a given BlueCat Address Manager (BAM) configuration. from bluecat_libraries.address_manager.api import Client from bluecat_libraries.address_manager.constants import ObjectType from bluecat_libraries.http_client.exceptions import ErrorResponse with Client(<bam_url>) as client: client.login(<username>, <password>) try: config = client.get_entity_by_name(0, <config_name>, ObjectType.CONFIGURATION) if config is None: print("No configuration found with the given name.") else: servers = client.get_entities(config["id"], ObjectType.SERVER) for server in servers: print(server["name"], server["properties"]["servicesIPv4Address"]) except ErrorResponse as e: # `client.get_entity_by_name()` and `client.get_entities()` call BAM endpoints so either may # result in an error response. print(e.message) client.logout()