DNS API

For details on how to use dns, see Using OpenStack DNS

The DNS Class

The dns high-level interface is available through the dns member of a Connection object. The dns member will only be added if the service is detected.

DNS Zone Operations

class openstack.dns.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
zones(**query)

Retrieve a generator of zones

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • name: Zone Name field.

  • type: Zone Type field.

  • email: Zone email field.

  • status: Status of the zone.

  • ttl: TTL field filter.abs

  • description: Zone description field filter.

Returns:

A generator of zone Zone instances.

create_zone(**attrs)

Create a new zone from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Zone, comprised of the properties on the Zone class.

Returns:

The results of zone creation.

Return type:

Zone

get_zone(zone)

Get a zone

Parameters:

zone – The value can be the ID of a zone or a Zone instance.

Returns:

Zone instance.

Return type:

Zone

delete_zone(zone, ignore_missing=True, delete_shares=False)

Delete a zone

Parameters:
  • zone – The value can be the ID of a zone or a Zone instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone does not exist. When set to True, no exception will be set when attempting to delete a nonexistent zone.

  • delete_shares (bool) – When True, delete the zone shares along with the zone.

Returns:

Zone been deleted

Return type:

Zone

find_zone(name_or_id, ignore_missing=True)

Find a single zone

Parameters:
  • name_or_id – The name or ID of a zone

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone does not exist. When set to True, no exception will be set when attempting to delete a nonexistent zone.

Returns:

Zone

abandon_zone(zone, **attrs)

Abandon Zone

Parameters:

zone – The value can be the ID of a zone to be abandoned or a ZoneExport instance.

Returns:

None

xfr_zone(zone, **attrs)

Trigger update of secondary Zone

Parameters:

zone – The value can be the ID of a zone to be abandoned or a ZoneExport instance.

Returns:

None

Recordset Operations

class openstack.dns.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
recordsets(zone=None, **query)

Retrieve a generator of recordsets

Parameters:
  • zone – The optional value can be the ID of a zone or a Zone instance. If it is not given all recordsets for all zones of the tenant would be retrieved

  • query (dict) –

    Optional query parameters to be sent to limit the resources being returned.

    • name: Recordset Name field.

    • type: Type field.

    • status: Status of the recordset.

    • ttl: TTL field filter.

    • description: Recordset description field filter.

Returns:

A generator of zone (Recordset) instances

create_recordset(zone, **attrs)

Create a new recordset in the zone

Parameters:
  • zone – The value can be the ID of a zone or a Zone instance.

  • attrs (dict) – Keyword arguments which will be used to create a Recordset, comprised of the properties on the Recordset class.

Returns:

The results of zone creation

Return type:

Recordset

update_recordset(recordset, **attrs)

Update Recordset attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Recordset, comprised of the properties on the Recordset class.

Returns:

The results of zone creation

Return type:

Recordset

get_recordset(recordset, zone)

Get a recordset

Parameters:
  • zone – The value can be the ID of a zone or a Zone instance.

  • recordset – The value can be the ID of a recordset or a Recordset instance.

Returns:

Recordset instance

Return type:

Recordset

delete_recordset(recordset, zone=None, ignore_missing=True)

Delete a zone

Parameters:
  • recordset – The value can be the ID of a recordset or a Recordset instance.

  • zone – The value can be the ID of a zone or a Zone instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone does not exist. When set to True, no exception will be set when attempting to delete a nonexistent zone.

Returns:

Recordset instance been deleted

Return type:

Recordset

Zone Import Operations

class openstack.dns.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
zone_imports(**query)

Retrieve a generator of zone imports

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • zone_id: Zone I field.

  • message: Message field.

  • status: Status of the zone import record.

Returns:

A generator of zone ZoneImport instances.

create_zone_import(**attrs)

Create a new zone import from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a ZoneImport, comprised of the properties on the ZoneImport class.

Returns:

The results of zone creation.

Return type:

ZoneImport

get_zone_import(zone_import)

Get a zone import record

Parameters:

zone – The value can be the ID of a zone import or a ZoneImport instance.

Returns:

ZoneImport instance.

Return type:

ZoneImport

delete_zone_import(zone_import, ignore_missing=True)

Delete a zone import

Parameters:
  • zone_import – The value can be the ID of a zone import or a ZoneImport instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone does not exist. When set to True, no exception will be set when attempting to delete a nonexistent zone.

Returns:

None

Zone Export Operations

class openstack.dns.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
zone_exports(**query)

Retrieve a generator of zone exports

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • zone_id: Zone I field.

  • message: Message field.

  • status: Status of the zone import record.

Returns:

A generator of zone ZoneExport instances.

create_zone_export(zone, **attrs)

Create a new zone export from attributes

Parameters:
  • zone – The value can be the ID of a zone to be exported or a ZoneExport instance.

  • attrs (dict) – Keyword arguments which will be used to create a ZoneExport, comprised of the properties on the ZoneExport class.

Returns:

The results of zone creation.

Return type:

ZoneExport

get_zone_export(zone_export)

Get a zone export record

Parameters:

zone – The value can be the ID of a zone import or a ZoneExport instance.

Returns:

ZoneExport instance.

Return type:

ZoneExport

get_zone_export_text(zone_export)

Get a zone export record as text

Parameters:

zone – The value can be the ID of a zone import or a ZoneExport instance.

Returns:

ZoneExport instance.

Return type:

ZoneExport

delete_zone_export(zone_export, ignore_missing=True)

Delete a zone export

Parameters:
  • zone_export – The value can be the ID of a zone import or a ZoneExport instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone does not exist. When set to True, no exception will be set when attempting to delete a nonexistent zone.

Returns:

None

FloatingIP Operations

class openstack.dns.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
floating_ips(**query)

Retrieve a generator of recordsets

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • name: Recordset Name field.

  • type: Type field.

  • status: Status of the recordset.

  • ttl: TTL field filter.

  • description: Recordset description field filter.

Returns:

A generator of floatingips (FloatingIP) instances

get_floating_ip(floating_ip)

Get a Floating IP

Parameters:

floating_ip – The value can be the ID of a floating ip or a FloatingIP instance. The ID is in format “region_name:floatingip_id”

Returns:

FloatingIP instance.

Return type:

FloatingIP

update_floating_ip(floating_ip, **attrs)

Update floating ip attributes

Parameters:
  • floating_ip – The id or an instance of FloatingIP.

  • attrs (dict) – attributes for update on FloatingIP.

Return type:

FloatingIP

Zone Transfer Operations

class openstack.dns.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
zone_transfer_requests(**query)

Retrieve a generator of zone transfer requests

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • status: Status of the recordset.

Returns:

A generator of transfer requests (ZoneTransferRequest) instances

get_zone_transfer_request(request)

Get a ZoneTransfer Request info

Parameters:

request – The value can be the ID of a transfer request or a ZoneTransferRequest instance.

Returns:

Zone transfer request instance.

Return type:

ZoneTransferRequest

create_zone_transfer_request(zone, **attrs)

Create a new ZoneTransfer Request from attributes

Parameters:
  • zone – The value can be the ID of a zone to be transferred or a ZoneExport instance.

  • attrs (dict) – Keyword arguments which will be used to create a ZoneTransferRequest, comprised of the properties on the ZoneTransferRequest class.

Returns:

The results of zone transfer request creation.

Return type:

ZoneTransferRequest

update_zone_transfer_request(request, **attrs)

Update ZoneTransfer Request attributes

Parameters:
Return type:

ZoneTransferRequest

delete_zone_transfer_request(request, ignore_missing=True)

Delete a ZoneTransfer Request

Parameters:
  • request – The value can be the ID of a zone transfer request or a ZoneTransferRequest instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone does not exist. When set to True, no exception will be set when attempting to delete a nonexistent zone.

Returns:

None

zone_transfer_accepts(**query)

Retrieve a generator of zone transfer accepts

Parameters:

query (dict) –

Optional query parameters to be sent to limit the resources being returned.

  • status: Status of the recordset.

Returns:

A generator of transfer accepts (ZoneTransferAccept) instances

get_zone_transfer_accept(accept)

Get a ZoneTransfer Accept info

Parameters:

request – The value can be the ID of a transfer accept or a ZoneTransferAccept instance.

Returns:

Zone transfer request instance.

Return type:

ZoneTransferAccept

create_zone_transfer_accept(**attrs)

Create a new ZoneTransfer Accept from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a ZoneTransferAccept, comprised of the properties on the ZoneTransferAccept class.

Returns:

The results of zone transfer request creation.

Return type:

ZoneTransferAccept

Zone Share Operations

class openstack.dns.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
zone_shares(zone, **query)

Retrieve a generator of zone sharess

Parameters:
  • zone – The zone ID or a Zone instance

  • query (dict) –

    Optional query parameters to be sent to limit the resources being returned.

    • target_project_id: The target project ID field.

Returns:

A generator of zone shares ZoneShare instances.

get_zone_share(zone, zone_share)

Get a zone share

Parameters:
  • zone – The value can be the ID of a zone or a Zone instance.

  • zone_share – The zone_share can be either the ID of the zone share or a ZoneShare instance that the zone share belongs to.

Returns:

ZoneShare instance.

Return type:

ZoneShare

find_zone_share(zone, zone_share_id, ignore_missing=True)

Find a single zone share

Parameters:
  • zone – The value can be the ID of a zone or a Zone instance.

  • zone_share_id – The zone share ID

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone share does not exist. When set to True, None will be returned when attempting to find a nonexistent zone share.

Returns:

ZoneShare

create_zone_share(zone, **attrs)

Create a new zone share from attributes

Parameters:
  • zone – The zone ID or a Zone instance

  • attrs (dict) – Keyword arguments which will be used to create a ZoneShare, comprised of the properties on the ZoneShare class.

Returns:

The results of zone share creation

Return type:

ZoneShare

delete_zone_share(zone, zone_share, ignore_missing=True)

Delete a zone share

Parameters:
  • zone – The zone ID or a Zone instance

  • zone_share – The zone_share can be either the ID of the zone share or a ZoneShare instance that the zone share belongs to.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the zone share does not exist. When set to True, no exception will be set when attempting to delete a nonexistent zone share.

Returns:

None