Entity class - Platform - BlueCat Gateway - 20.1.1

Gateway Administration Guide

Locale
English (United States)
Product name
BlueCat Gateway
Version
20.1.1

The entity class wraps up BAM API entities and provides methods common across all types. The class include ‘constants’ naming those types.

class 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= 'DHCPRawOption'

DHCPServiceOption= 'DHCPServiceOption'

DHCPSubClass= 'DHCPSubClass'

DHCPV4ClientOption= 'DHCPV4ClientOption'

DHCPV6ClientOption= 'DHCPV6ClientOption'

DHCPV6RawOption= 'DHCPV6RawOption'

DHCPV6ServiceOption= 'DHCPV6ServiceOption'

DNSOption= 'DNSOption'

DNSRawOption= 'DNSRawOption'

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'

delete()

Delete the entity from the BAM database.

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

Parameter Description
recipient_id The object ID of the user or user group the access right is applied to
value The value of the access right being added.
overrides A list of type-specific overrides.
properties

A string including the following options:

  1. workflowLevel
  2. deploymentAllowed
  3. quickDeploymentAllowed

Returns: Object ID of the created Access Right.

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.

Parameter Description
recipient_id 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.

get_child_by_name(name, entity_type)

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

get_children_of_type(entity_type)

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

Parameter Description
entity_type Entity type to search for.

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

get_deployment_roles(types=None)

Get deployment roles for the entity.

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

get_entities_by_name(name, entity_name, start='0, count=DEFAULT_BAM_API_PAGE_SIZE'')

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

Parameter Description
name (string, required) Name of the requested entities.
entity_type (string, required) Type of the requested entities. The value should be a valid EntityType constant.
start (integer, optional) Beginning position in a complete list of results. Useful for pagination. Defaults to 0.
count (integer, optional) Number of requested elements. Useful for pagination. Defaults to 100.

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

Return type: generator
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)

get_id()

Get the BAM ID of an entity.

get_linked_entities(entity_type)

Get all the linked entities of a given type.

Returns: Iterator for a given type entities.

get_name()

Get the BAM name of the entity.

get_parent()

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

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.

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.

get_type()

Get the BAM type of the entity.

get_url()

Get URL.

is_null()

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

link_entity(entity_id, properties='')

ink caller Entity object with another whose ID is ‘entity_id’. This method can be called by any side of a linking relationship between Entity objects.

Parameters Description
entity_id The ID of the Entity object to be linked, or to link.
properties Adds object properties, including user-defined fields.

Returns: The caller Entity object.

name

Get the BAM name of the entity.

refresh()

Downloads an updated object from BAM.

set_name(new_name)

Set the BAM name of the entity.

update()

Persist any changes to the entity to the BAM database.