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
- get_zone(zone)
Get a 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 toTrue
, no exception will be set when attempting to delete a nonexistent zone.
- Returns:
Zone been deleted
- Return type:
- update_zone(zone, **attrs)
Update zone attributes
- 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 toTrue
, 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:
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
- create_recordset(zone, **attrs)
Create a new recordset in the zone
- update_recordset(recordset, **attrs)
Update Recordset attributes
- get_recordset(recordset, zone)
Get a 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 toTrue
, no exception will be set when attempting to delete a nonexistent zone.
- Returns:
Recordset instance been deleted
- Return type:
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:
- 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:
- 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