Entity class - Platform - BlueCat Gateway - 24.3.3

Gateway Administration Guide

ft:locale
en-US
Product name
BlueCat Gateway
Version
24.3.3

Click a link to jump to the indicated section.

class bluecat.entity.Entity(api, api_entity, ver='')

Bases: bluecat.api_object.APIObject

Instantiate an entity. Entities are hashable and comparable with the = operator.

Parameters Description
api

API instance used by the entity to communicate with BAM.

api_entity

The entity returned by the BAM API.

ACL = 'ACL'

AliasRecord = 'AliasRecord'

Configuration = 'Configuration'

CustomOptionDef = 'CustomOptionDef'

DHCP4Range = 'DHCP4Range'

DHCP6Range = 'DHCP6Range'

DHCPDeploymentRole = 'DHCPDeploymentRole'

DHCPMatchClass = 'DHCPMatchClass'

DHCPRawOption = 'DHCP_RAW'

DHCPServiceOption = 'DHCPServiceOption'

DHCPSubClass = 'DHCPSubClass'

DHCPV4ClientOption = 'DHCPV4ClientOption'

DHCPV6ClientOption = 'DHCPV6ClientOption'

DHCPV6RawOption = 'DHCPV6_RAW'

DHCPV6ServiceOption = 'DHCPV6ServiceOption'

DNS = 'DNS'

DNSOption = 'DNSOption'

DNSRawOption = 'DNS_RAW'

DNSSECSigningPolicy = 'DNSSECSigningPolicy'

DenyMACPool = 'DenyMACPool'

DeploymentRole = 'DNSDeploymentRole'

DeploymentScheduler = 'DeploymentScheduler'

Device = 'Device'

DeviceSubtype = 'DeviceSubtype'

DeviceType = 'DeviceType'

Entity = 'Entity'

EnumNumber = 'EnumNumber'

EnumZone = 'EnumZone'

ExternalHostRecord = 'ExternalHostRecord'

GenericRecord = 'GenericRecord'

HINFORecord = 'HINFORecord'

HostRecord = 'HostRecord'

IP4Address = 'IP4Address'

IP4Block = 'IP4Block'

IP4IPGroup = 'IP4IPGroup'

IP4Network = 'IP4Network'

IP4NetworkTemplate = 'IP4NetworkTemplate'

IP4ReconciliationPolicy = 'IP4ReconciliationPolicy'

IP6Address = 'IP6Address'

IP6Block = 'IP6Block'

IP6Network = 'IP6Network'

InterfaceID = 'InterfaceID'

InternalRootZone = 'InternalRootZone'

Kerberos = 'Kerberos'

KerberosRealm = 'KerberosRealm'

LDAP = 'LDAP'

Location = 'Location'

MACAddress = 'MACAddress'

MACPool = 'MACPool'

MXRecord = 'MXRecord'

NAPTRRecord = 'NAPTRRecord'

NetworkInterface = 'NetworkInterface'

NetworkServerInterface = 'NetworkServerInterface'

PublishedServerInterface = 'PublishedServerInterface'

RPZone = 'RPZone'

Radius = 'Radius'

RecordWithLink = 'RecordWithLink'

ResponsePolicy = 'ResponsePolicy'

SRVRecord = 'SRVRecord'

Server = 'Server'

StartOfAuthority = 'StartOfAuthority'

TFTPDeploymentRole = 'TFTPDeploymentRole'

TFTPFile = 'TFTPFile'

TFTPFolder = 'TFTPFolder'

TFTPGroup = 'TFTPGroup'

TSIGKey = 'TSIGKey'

TXTRecord = 'TXTRecord'

Tag = 'Tag'

TagGroup = 'TagGroup'

User = 'User'

UserGroup = 'UserGroup'

VendorClientOption = 'VendorClientOption'

VendorOptionDef = 'VendorOptionDef'

VendorProfile = 'VendorProfile'

View = 'View'

VirtualInterface = 'VirtualInterface'

Zone = 'Zone'

ZoneTemplate = 'ZoneTemplate'

add_access_right(recipient_id, value, overrides='', properties='')

Parameters Description
recipient_id (int)

The object ID of the user or user group the access right is applied to.

value (str)

The value of the access right being added.

overrides (str, optional)

A list of type-specific overrides.

properties (str, optional)

A string including the following options:

  1. workflowLevel

  2. deploymentAllowed

  3. quickDeploymentAllowed

Return type: int

Returns: Object ID of a created Access Right.

add_as_child_to(parent_id, refresh=True)

Add the current object as child to a parent entity.

Note:

This method uses addEntity from Address Manager API. It is a generic method for adding entities. However, it does not allow all types. For the supported options, please refer to the Address Manager API Guide for the specific version.

Parameters Description
parent_id (int)

ID of the parent entity.

refresh (bool, optional)

Indicates whether the current object’s fields (and overall state) should be refreshed with the values from BAM once the addition occurs. Defaults to True.

Return type: int

Returns: ID that the object receives once added in BlueCat Address Manager.

Example:

api = g.user.get_api()     # a user-aware bluecat.api.API instance
configuration_id = 100001  # ID of a Configuration
configuration = api.get_entity_by_id(configuration_id)

key = TSIGKey(api)
key.name = "master1"
key.algorithm = "hmac-sha512"
key.length = 512
key.generated = True

id = key.add_as_child_to(configuration.id, refresh=True)

New in version 20.3.1.

delete()

Delete the entity from the BAM database.

get_access_right(recipient_id)

Get an AccessRight for this entity for a specific user or a user group.

Parameters Description
recipient_id (int)

The object ID of the user or user group the access right is applied to.

Returns: An AccessRight object.

get_access_rights()

Get an iterator for all access rights for an Entity.

Return type: Iterator

Returns: An iterator for all access rights of an Entity.

get_child_by_name(name, entity_type)

Get a specific named immediate child entity of a given type.

Return type: Entity

get_children_of_type(entity_type)

Get all the immediate children of an entity of the given type.

Parameters Description
entity_type (str)

Entity type to search for

Return type: Iterator

Returns: Generator object iterating over all children of specified type.

get_deployment_roles(types=None)

Get deployment roles for the entity.

Parameters Description
types (list, optional)

An optional list of deployment role types (documented in the deployment_role class). If the list is empty all types are returned.

Return type: list

get_entities_by_name(name, entity_type, start=0, count=100)

Get entities (of certain type) with a specified name that are children of the current entity.

Parameters Description
name (str)

Name of the requested entities.

entity_type (str)

Type of the requested entities.

start (int, optional)

Beginning position in a complete list of results. Useful for pagination. Defaults to 0.

count (int, optional)

Number of requested elements. Useful for pagination. Defaults to 100.

Return type: Iterator

Returns: A generator over a sequence of instances of the corresponding entity type.

Raises:

BAMException – There is an error in communicating with BAM or the request cannot be serviced by BAM. For example bad input parameters.

Example:

Obtain a view from a configuration entity.

from bluecat.constants import EntityType

configuration_name = 'Sandbox'  # name of parent configuration
name = 'DMZ West'               # name you search by
api = g.user.get_api()          # a user-aware bluecat.api.API instance
configuration = api.get_configuration(configuration_name)

entities = configuration.get_entities_by_name(name, EntityType.VIEW, start=0, count=10)

for entity in entities:
    print(entity)

get_id()

Get the BAM ID of an entity.

Return type: int

get_linked_entities(entity_type)

Get all the linked entities of a given type

Return type: Iterator

Returns: Iterator for a given type entities.

get_name()

Get the BAM name of the entity.

Return type: str

get_parent()

Get the parent entity or None if the entity is at the top of the hierarchy.

Return type: Entity

get_parent_configuration()

Walk up the entity hierarchy and return the Configuration entity; if none was found, returns None; if starting entity is configuration, returns itself.

Return type: Iterator

Returns: An iterator of parent configuration objects

get_parent_of_type(entity_type)

Walk up the entity hierarchy and return the first parent entity of the given type or, if none was found, raise PortalException.

Return type: Entity

get_type()

Get the BAM type of the entity.

Return type: str

get_url()

Get URL

Return type: str

property id

Get the BAM ID of the entity.

Return type: int

is_null()

Is this the null entity? (ID == 0).

Return type: bool

property name

Get the BAM name of the entity.

Return type: str

refresh()

Downloads an updated object from BAM.

set_name(new_name)

Set the BAM name of the entity.

to_json()

Change to JSON

Return type: dict

property type

Entity type of the entity object.

Return type: str

update()

Persist any changes to the entity to the BAM database.