The Address Manager v9.3.0 API introduces the ability to create user-defined links between IP address, IP network, or block in Address Manager. A user-defined link is a logical link between any two objects in Address Manager. You can create a user-defined link between objects in the same configuration or between objects in different configurations. This section includes the new Python API wrappers for User-defined Links API in BlueCat Gateway. For more details on the User-Defined Links API methods in BAM, refer to the Address Manager v9.3.0 API Guide.
add_user_defined_link
(definition:
bluecat_libraries.address_manager.api.models.UDLDefinition)
Add a new user-defined link definition.
Parameter | Description |
---|---|
definition (UDLDefinition, required) | The user-defined link to add |
from bluecat_libraries.address_manager.api import Client
definition = UDLDefinition(
linkType='<unique-UDL-type-name>',
displayName='<UDL-display-name>',
sourceEntityTypes'=["IP4Ranged", "IP4Network"],
destinationEntityTypes=["IP4Ranged", "IP4Block"],
)
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.add_user_defined_link(definition)
New in version 21.5.1
delete_user_defined_link
(link_type: str)
Delete the user-defined link definition.
Parameter | Description |
---|---|
link_type (str, required) | The link type that identifies a user-defined link definition |
from bluecat_libraries.address_manager.api import Client
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.delete_user_defined_link('<unique-UDL-type-name>')
New in version 21.5.1
get_linked_entities
(entity_id: int, linked_type: str,
start=0, count=10) →
typing.List[bluecat_libraries.address_manager.api.models.APIEntity)
Return a list of entities containing the entities linked to a specified entity. The list is empty if there are no linked entities.
Parameter | Description |
---|---|
entity_id (int, required) | The object ID of the entity to return linked entities for |
linked_type (str, required) | The type of linked entities to return. This value must be one of the types listed in Object types |
start (int, required) | Indicates where in the list of returned objects to start returning objects. The list begins at an index of 0 |
count (int, required) | The maximum number of objects to return. The default value is 10 |
Returns: A list of entities linked to the specified entity.
Return type: list[APIEntity]
Example:from bluecat_libraries.address_manager.api import Client
from bluecat_libraries.address_manager.constants import ObjectType
linked_type = ObjectType.HOST_RECORD.value
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
entities = client.get_linked_entities(<entity_id>, <linked_type>, 0, 10)
for entity in entities:
print(entity['id'])
New in version 21.5.1
get_linked_entities_ex
(relationship:
bluecat_libraries.address_manager.api.models.UDLRelationship) →
typing.List[int]
Return a list of entity IDs linked using the given link type to the given source or destination entity ID.
Parameter | Description |
---|---|
relationship (UDLRelationship, required) | The link type that identifies a user-defined link definition |
Returns: A list of IDs of the linked entities.
Return type: list[int]
Example:from bluecat_libraries.address_manager.api import Client
relationship = UDLRelationship(
linkType="UniqueLinkTypeName",
sourceEntityId=256021,
)
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
linked_ids = client.get_linked_entities_ex(relationship)
print(linked_ids)
New in version 21.5.1
get_user_defined_link
(link_type: str='') ->
typing.List[bluecat_libraries.address_manager.api.models.UDLDefinition]
Return a list of link definitions from the user-defined link type. Return all link definitions when no link type is specified.
Parameter | Description |
---|---|
link_type (str, optional) | The link type that identifies a user-defined link definition |
Returns: A list of link definitions from the user-defined link definition.
Return type: list[UDLDefinition]
Example:from bluecat_libraries.address_manager.api import Client
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
udls = client.get_user_defined_link('<unique-UDL-type-name>')
for udl in udls:
print(udl.get('linkType'))
New in version 21.5.1
link_entities
(entity1_id: int, entity2_id: int, properties:
dict = None)
Establish a link between the two specified Address Manager entities.
Parameter | Description |
---|---|
entity1_id (int, required) | The object ID of the first entity in the pair of linked entities |
entity2_id (int, required) | The object ID of the second entity in the pair of linked entities |
properties (dict, optional) | Adds object properties, including user-defined fields |
from bluecat_libraries.address_manager.api import Client
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.link_entities(<entity1_id>, <entity2_id>, <properties>)
New in version 21.5.1
link_entities_ex
(relationship:
bluecat_libraries.address_manager.api.models.UDLRelationship)
Establish a link between the specified source and destination Address Manager entities.
Parameter | Description |
---|---|
relationship (UDLRelationship, required) | The link type that identifies a user-defined link definition |
from bluecat_libraries.address_manager.api import Client
relationship = UDLRelationship(
linkType="UniqueLinkTypeName",
sourceEntityId=256021,
destinationEntityId=256023,
)
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.link_entities_ex(relationship)
New in version 21.5.1
unlink_entities
(entity1_id: int, entity2_id: int, properties:
dict = None)
Remove the link between the two specified Address Manager entities.
Parameter | Description |
---|---|
entity1_id (int, required) | The object ID of the first entity in the pair of linked entities |
entity2_id (int, required) | The object ID of the second entity in the pair of linked entities |
properties (dict, optional) | Adds object properties, including user-defined fields |
from bluecat_libraries.address_manager.api import Client
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.unlinkEntities(<entity1_id>, <entity2_id>, <properties>)
New in version 21.5.1
unlink_entities_ex
(relationship:
bluecat_libraries.address_manager.api.models.UDLRelationship)
Remove the link between the specified source and destination Address Manager entities.
Parameter | Description |
---|---|
relationship (UDLRelationship, required) | The link type that identifies a user-defined link definition |
from bluecat_libraries.address_manager.api import Client
relationship = UDLRelationship(
linkType="UniqueLinkTypeName",
sourceEntityId=256021,
destinationEntityId=256023,
)
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.unlink_entities_ex(relationship)
New in version 21.5.1
update_user_defined_link
(definition:
bluecat_libraries.address_manager.api.models.UDLDefinition)
Update a user-defined link for an object type.
Parameter | Description |
---|---|
definition (UDLDefinition, required) | The user-defined link to update |
from bluecat_libraries.address_manager.api import Client
definition = UDLDefinition(
linkType='<unique-UDL-type-name>',
displayName='<UDL-display-name>',
sourceEntityTypes'=["IP4Ranged", "IP4Network"],
destinationEntityTypes=["IP4Ranged", "IP4Block"],
)
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.update_user_defined_link(definition)
New in version 21.5.1