Zone class - Platform - BlueCat Gateway - 24.3.3

Gateway Administration Guide

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

class bluecat.zone.Zone(api, api_entity, parent_view=None)

Bases: bluecat.dns.DNS

Instantiate a DNS zone object.

Parameters Description
api

API instance used by the entity to communicate with BAM.

api_entity

the entity returned by the BAM API.

ALLOW_QUERY = 'allow-query'

add_alias_record(name, linked_record, ttl=-1, properties='')

Add a new CNAME record for an existing host record. This method adds the record under a zone.

Parameters Description
name (str)

the name of the alias record you want to add to this zone.

linked_record (str)

The name of the record to which this alias will link.

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of alias_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

alias_record = zone.add_alias_record('test_alias', 'test_host_record.test_zone')

add_dns_deployment_option(dns_option, value, properties='')

Parameters Description
dns_option (str)

The name of the DNS option being added.

value (str)

The value being assigned to the option.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Returns: Instance of DNSOption added.

add_dns_deployment_role(server_interface, role_type, properties='')

Adds a DNS deployment role to a specified object.

Parameters Description
server_interface (Union[int, object])

The object ID/server interface object to which the role is to be added.

role_type (str)

The type of DNS role to be added. The type must be one of: NONE MASTER MASTER_HIDDEN SLAVE SLAVE_STEALTH FORWARDER STUB RECURSION AD_MASTER

properties (str, optional)

Adds object properties, including the view associated with this DNS deployment role and user-defined fields.

Return type: Entity

Returns: Added DNS deployment role object.

add_generic_record(name, record_type, rdata, ttl=-1, properties='')

Add a new Generic record of specified type.

Parameters Description
name (str)

the name of the generic record you want to add to this zone.

record_type (str)

The type of record being added. Valid settings for this parameter are the generic resource record types supported in Address Manager: A6, AAAA, AFSDB, APL, CERT, DNAME, DNSKEY, DS, ISDN, KEY, KX, LOC, MB, MG, MINFO, MR, NS, NSAP, PX, RP, RT, SINK, SSHFP, WKS, and X25.

rdata (str)

The data for the resource record in BIND format (for example, for A records, A 10.0.0.4).

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of generic_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

generic_record = zone.add_generic_record('test_generic_record', 'A', '10.0.0.222')

add_hinfo_record(name, cpu, os, ttl=-1, properties='')

Add a new Host Info HINFO record.

Parameters Description
name (str)

the name of the HINFO record you want to add to this zone.

cpu (str)

A string providing central processing unit information.

os (str)

A string providing operating system information.

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of host_info_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

hinfo_record = zone.add_hinfo_record('test_hinfo_record', 'cpu1', 'windows7')

add_host_record(name, addresses, ttl=-1, properties='')

Add a Host record.

Parameters Description
name (str)

the name of the host record you want to add to this zone.

addresses (str)

A list of comma-separated IP addresses (for example, 10.0.0.5,130.4.5.2).

ttl (int, optional)

The time-to-live value for the record. To ignore the ttl, set this value to -1.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of hostRecord.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

host_record = zone.add_host_record('new', ['172.27.19.102'])

add_mx_record(name, priority, linked_record_name, ttl=-1, properties='')

Add a new Mail Exchanger MX record. This method adds the record under a zone.

Parameters Description
name (str)

the name of the MX record you want to add to this zone.

priority (int)

Specifies which mail server to send clients to first when multiple matching MX records are present. Multiple MX records with equal priority values are referred to in a round-robin fashion.

linked_record_name (str)

The FQDN of the host record to which this MX record is linked.

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of mx_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

mx_record = zone.add_mx_record('test_name', 1, 'host_record.test.zone')

add_naptr_record(name, order, preference, service, regexp, replacement, flags, ttl=-1, properties='')

Add a new NAPTR record.

Parameters Description
name (str)

the name of the NAPTR record you want to add to this zone.

order (int)

Specifies the order in which NAPTR records are read if several are present and are possible matches. The lower ordervalue takes precedence.

preference (int)

Specifies the order in which NAPTR records are read if the ordervalues are the same in multiple records. The lower preferencevalue takes precedence.

service (str)

Specifies the service used for the NAPTR record. Valid settings for this parameter are listed in ENUM Services on page 192 in BAM API Guide.

regexp (str)

A regular expression, enclosed in double quotation marks, used to transform the client data. If a regular expression is not specified, a domain name must be specified in the replacement parameter.

replacement (str)

Specifies a domain name as an alternative to the regexp. This parameter replaces client data with a domain name.

flags (list[str])

An optional parameter used to set flag values for the record.

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of naptr_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

naptr_record = zone.add_naptr_record('test_naptr', order=1, preference=1, service='voice_tel',
                                     regexp='*', replacement=TEST_ZONE, flags='' )

add_raw_deployment_option(option_type, raw_data, properties='')

Parameters Description
option_type (str)

the option types for Raw Deployment Options, the Three options are DNS_RAW, DHCP_RAW, DHCPV6_RAW.

raw_data (Any)

the raw option value for the deployment option.

properties (str, optional)

the properties of the raw option, if it is an DNSRawOption you need to set server in properties

Return type: Entity

Returns: Returns an instance of the type DNSOption that represents the DNS deployment option.

add_resource_record(name, record_type, rdata, ttl=-1, properties='')

Generic method for adding resource records of any type.

Parameters Description
name (str)

the name of the resource record you want to add to this zone.

record_type (str)

The type of record being added. Supported types using this method: AliasRecord HINFORecord HostRecord MXRecord TXTRecord

rdata (str)

The data for the resource record in BIND format (for example, for A records, A 10.0.0.4). You can specify either a single IPv4 or IPv6 address for the record.

ttl (int, optional)

The time-to-live value for the record.

properties (str, optional)

Adds object properties, including user-defined fields.

Return type: Entity

Returns: An instance of the resource record type that was added.

Example:

api = g.user.get_api()              # get api object
configuration_name = 'test_config'  # configuration name
view_name = 'test_view'             # view name
zone_name = 'test_zone'             # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

resource_record = zone.add_resource_record('test_name', zone.AliasRecord, 10.0.0.2)

add_srv_record(name, priority, port, weight, linked_record_name, ttl=-1, properties='')

Add a new SRV record.

This method adds the record under a zone.

Parameters Description
name (str)

the name of the SRV record you want to add to this zone.

port (int)

The TCP/UDP port on which the service is available.

weight (int)

If two matching SRV records within a zone have equal priority, the weight value is checked. If the weight value for one object is higher than the other, the record with the highest weight has its resource records returned first.

linked_record_name (str)

The FQDN of the host record to which this SRV record is linked.

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of srv_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

srv_record = zone.add_srv_record('test_srv_record', 1, 500, 1, 'test_host_record.test_zone')

add_text_record(name, txt, ttl=-1, properties='')

Warning:

This method has been deprecated, use add_txt_record instead.

Add a new text record. This method adds the record under a zone.

Parameters Description
name (str)

the name of the text record you want to add to this zone.

txt (str)

The text data for the record.

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of text_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

text_record = zone.add_text_record('test_text_record', 'example')

add_txt_record(name, txt, ttl=-1, properties='')

Add a new text record. This method adds the record under a zone.

Parameters Description
name (str)

the name of the text record you want to add to this zone.

txt (str)

The text data for the record.

ttl (int, optional)

The time-to-live value for the record. TTL is ignored by default.

properties (str, optional)

Adds object properties, including comments and user-defined fields.

Return type: Entity

Returns: An instance of text_record.

Example:

api = g.user.get_api()                  # get api object
configuration_name = 'test_config'      # configuration name
view_name = 'test_view'                 # view name
zone_name = 'test_zone'                 # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

text_record = zone.add_txt_record('test_text_record', 'example')

add_zone(absolute_name, deployable=False, template=0, **kwargs)

Adds DNS zones.

You can use . (dot) characters to create the top level domain and subzones.

Parameters Description
absolute_name (str)

Fully qualified name of the DNS zone to add (eg. example.com).

deployable (bool, optional)

Boolean. Default is False.

template (int, optional)

ID of the associated network template.

kwargs

Keyword arguments of user-defined fields and values.

Return type: Entity

Returns: Zone instance of the new DNS zone.

assign_or_update_template(template_id, zone_template_reapply_mode='')

Assigns, updates, or removes DNS zone and IPv4 network templates. Also specifies the reapply mode for various properties of the template.

Parameters Description
template_id (int)

The object ID of the DNS zone template or IPv4 network template. To remove a template, set this value to 0 (zero).

zone_template_reapply_mode (str, optional)

The reapply mode for zone in the template. The possible values are update, ignore, and overwrite. ignore is the default value.

Example:

api = g.user.get_api()              # get api object
configuration_name = 'test_config'  # configuration name
view_name = 'test_view'             # view name
zone_name = 'test_zone'             # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)
template_id = 10231

zone.assign_or_update_template(template_id, zone_template_reapply_mode='update')

get_alias_record(name)

Get an alias record.

Parameters Description
name (str)

The name of the alias record to get.

Return type: Entity

Returns: An instance of alias_record.

get_configuration()

Return the parent Configuration object.

Return type: Entity

get_deployment_options(option_types, server)

Get deployment Option for the entity.

Parameters Description
option_types (list)

the Deployment option type you would like to search, Includes

  • DNSOption

  • DNSRawOption

  • DHCPRawOption

  • DHCPV6RawOption

  • DHCPV4ClientOption

  • DHCPV6ClientOption

  • DHCPServiceOption

  • DHCPV6ServiceOption

  • VendorClientOption

  • StartOfAuthority

server (Any)

the server which the deployment option is attached to, there are 3 options:

  • >0—returns only the options that are linked to the specified server ID.

  • <0—returns all options regardless of the server ID specified.

  • =0—returns only the options that are linked to all servers.

Return type: list

get_dns_deployment_option(dns_option, server)

Parameters Description
dns_option (str)

The name of the DNS option.

server (Any)

Specifies the server to which this option is assigned.

Return type: Entity

Returns: Returns an instance of the type DNSOption that represents the DNS deployment option.

get_dns_deployment_role(server_interface)

Retrieves a DNS deployment role from a specified object.

Parameters Description
server_interface (Union[int, object])

The object ID/server interface object to which the DNS deployment role is assigned.

Return type: Entity

get_full_name()

Get absolute name.

Return type: str

Returns: The absolute name of the zone.

get_generic_record(name)

Get a generic record.

Parameters Description
name (str)

The name of the generic record to get.

Return type: Entity

Returns: An instance of generic_record.

get_hinfo_record(name)

Get a host info record.

Parameters Description
name (str)

The name of the HINFO record to get.

Return type: Entity

Returns: An instance of host_info_record.

get_host_record(name)

Get a host record.

Parameters Description
name (str)

The name of the host record to get.

Return type: Entity

Returns: An instance of hostRecord.

get_ksk(ksk_format)

Gets the Key Signing Key (KSK) associated to a zone

Parameters Description
ksk_format (str)

The KSK return type. The accepted formats are TRUST_ANCHOR, DNS_KEY, and DS_RECORD.

Example:

import constants.DNSSECKeyFormats

api = g.user.get_api()              # get api object
configuration_name = 'test_config'  # configuration name
view_name = 'test_view'             # view name
zone_name = 'test_zone'             # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)

ksk = zone.get_ksk(constants.DNSSECKeyFormats.TRUST_ANCHOR)

Return type: list[str]

Returns: List of KSKs in string format.

get_mx_record(name)

Get a MX record.

Parameters Description
name (str)

The name of the MX record to get.

Return type: Entity

Returns: An instance of mx_record.

get_naptr_record(name)

Get a NAPTR record.

Parameters Description
name (str)

The name of the NAPTR record to get.

Return type: Entity

Returns: An instance of naptr_record.

get_resource_record(absolute_name, resource_type)

Get a resource record of the specified type.

Parameters Description
absolute_name (str)

The FQDN of the resource record to get.

resource_type (str)

The type of resource record to get.

Return type: Entity

Returns: An instance of the specified resource record type.

get_server_interface_id()

Return type: int

Returns: Server Interface Id.

get_service()

Return type: str

Returns: DeploymentServices enum service type.

get_srv_record(name)

Get a SRV record.

Parameters Description
name (str)

The name of the SRV record to get.

Return type: Entity

Returns: An instance of srv_record.

get_text_record(name)

Get a text record.

Parameters Description
name (str)

The name of the text record to get.

Return type: Entity

Returns: An instance of text_record.

get_zone(name)

Get an immediate child zone by name without dot character.

Parameters Description
name (str)

Name of the child zone.

Return type: Entity

Returns: Instance of the child zone or None.

get_zones()

Get all immediate child zones.

Return type: Iterator

Returns: Iterator for Zone entities.

get_zones_by_hint(hint)

Search for zones by hint under the parent zone. Returns an array of maximum 10 elements of accessible zones under the parent zone.

Parameters Description
hint (str)

Partial or full name of zone to find.

Return type: list

Returns: FQDN list of any zones that match the given hint as data in list format