Failover API client - BlueCat Python Library - 22.4.1

BlueCat Python Library Guide

Locale
English
Product name
BlueCat Python Library
Version
22.4.1

class bluecat_libraries.address_manager.failover_api.Client(url:str, cert, verify=True)

Bases: bluecat_libraries.http_client.client.Client

A client for calling the Failover API of Address Manager.

The Failover API is a service configuration in Address Manager that can enable an externally automated failover when the primary Address Manager fails.

Parameters Description
url(str) The base URL of BAM’s Failover service.
cert(tuple) Path to an SSL client certificate. The first item being the path to the certificate file and the second item is the key.
verify(bool or str) Whether to verify the server’s TLS certificate. If a string is passed, it is treated as a path to a CA bundle to use. Defaults to True.

New in version 21.5.1.

get_v1_health(timeout:Optional[int]=None)

Return the health status of Address Manager. This API can be called on primary, secondary, or standalone Address Manager servers.

Parameters Description
timeout(int, optional) The timeout of this request in milliseconds.

Returns: Returns the health status of Address Manager.

Return type: dict

Example:

from bluecat_libraries.address_manager.failover_api import Client

client_cert = ('client_certificate.crt', 'key.pem')
server_cert = 'server_certificate.crt'
with Client(url='https://<bam_address>:8444', cert=client_cert, verify=server_cert) as client:
    data = client.get_v1_health()
print(data)

New in version 21.5.1.

put_v1_managed_servers_takeover()

Notify all DNC/DHCP Servers controlled by the old primary Address Manager server of the new primary Address Manager server.

Returns: list

Example:

from bluecat_libraries.address_manager.failover_api import Client

client_cert = ('client_certificate.crt', 'key.pem')
server_cert = 'server_certificate.crt'
with Client(url='https://<bam_address>:8444', cert=client_cert, verify=server_cert) as client:
    data = client.put_v1_managed_servers_takeover()
print(data)

New in version 21.5.1.

put_v1_managed_servers_takeover_by_id(server_id:int)

Notify a single DNC/DHCP Server controlled by the old primary Address Manager server of the new primary Address Manager server.

Parameters Description
server_id(int) The ID of the DNS/DHCP Server.

Returns: object

Example:

from bluecat_libraries.address_manager.failover_api import Client

client_cert = ('client_certificate.crt', 'key.pem')
server_cert = 'server_certificate.crt'
server_id = 123
with Client(url='https://<bam_address>:8444', cert=client_cert, verify=server_cert) as client:
    data = client.put_v1_managed_servers_takeover_by_id(server_id)
print(data)

New in version 21.5.1.

put_v1_promote()

Promote a secondary Address Manager server in the cluster to primary.

Returns: Returns the health status of Address Manager if successful.

Return type: str

Example:

from bluecat_libraries.address_manager.failover_api import Client

client_cert = ('client_certificate.crt', 'key.pem')
server_cert = 'server_certificate.crt'
with Client(url='https://<bam_address>:8444', cert=client_cert, verify=server_cert) as client:
    result = client.put_v1_promote()
print(result)

New in version 21.5.1.