DNS API

The DNS Service 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 otcextensions.sdk.register_otc_extensions(conn) method is called.

Zone Operations

class otcextensions.sdk.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. * zone_type: Zone Type * marker: pagination marker * limit: pagination limit * offset: pagination offset

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 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.

Returns

Zone been deleted

Return type

Zone

update_zone(zone, **attrs)

Update zone attributes

Parameters
  • zone – The id or an instance of Zone

  • attrs (dict) – attributes for update on Zone

Return type

Zone

find_zone(name_or_id, ignore_missing=True, **attrs)

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

None

add_router_to_zone(zone, **router)

Add router(VPC) to private zone

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

  • router – The parameter router_id is mandatory

Returns

updater instance of Router

Return type

Router

remove_router_from_zone(zone, **router)

Remove router(VPC) from private zone

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

  • router – The parameter router_id is mandatory

Returns

updater instance of Router

Return type

Router

nameservers(zone)

list nameservers of Zone

Parameters

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

Returns

list of otcextensions.sdk.dns.v2.nameserver.NameServer instance

Return type

NameServer

Recordset Operations

class otcextensions.sdk.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 which belongs to zone

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

  • query (dict) – Optional query parameters to be sent to limit the resources being returned. * marker: pagination marker * limit: pagination limit

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.

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

PTR Records Operations

class otcextensions.sdk.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 FloatingIP PTR records

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

set_floating_ip(floating_ip, **attrs)

Set a Floating IP PTR record

Parameters

floating_ip – the Floating IP ID

Returns

FloatingIP PTR record.

Return type

FloatingIP

unset_floating_ip(floating_ip)

Unset a Floating IP PTR record

Parameters

floating_ip – ID for the floatingip associated with the project.

Returns

FloatingIP PTR record.

Return type

FloatipgIP