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: session.Session, *, service_type: str | None = None, service_name: str | None = None, interface: str | None = None, region_name: str | None = None, endpoint_override: str | None = None, version: str | None = None, auth: plugin.BaseAuthPlugin | None = None, user_agent: str | None = None, connect_retries: int | None = None, logger: logging.Logger | None = None, allow: dict[str, ty.Any] | None = None, additional_headers: collections.abc.MutableMapping[str, str] | None = None, client_name: str | None = None, client_version: str | None = None, allow_version_hack: bool | None = None, global_request_id: str | None = None, min_version: str | None = None, max_version: str | None = None, default_microversion: str | None = None, status_code_retries: int | None = None, retriable_status_codes: list[int] | None = None, raise_exc: bool | None = None, rate_limit: float | None = None, concurrency: int | None = None, connect_retry_delay: float | None = None, status_code_retry_delay: float | None = None, statsd_client: statsd_client.StatsClient | None = None, statsd_prefix: str | None = None, prometheus_counter: prometheus_client.Counter | None = None, prometheus_histogram: prometheus_client.Histogram | None = None, influxdb_config: dict[str, ty.Any] | None = None, influxdb_client: influxdb_client.InfluxDBClient | None = None)
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: session.Session, *, service_type: str | None = None, service_name: str | None = None, interface: str | None = None, region_name: str | None = None, endpoint_override: str | None = None, version: str | None = None, auth: plugin.BaseAuthPlugin | None = None, user_agent: str | None = None, connect_retries: int | None = None, logger: logging.Logger | None = None, allow: dict[str, ty.Any] | None = None, additional_headers: collections.abc.MutableMapping[str, str] | None = None, client_name: str | None = None, client_version: str | None = None, allow_version_hack: bool | None = None, global_request_id: str | None = None, min_version: str | None = None, max_version: str | None = None, default_microversion: str | None = None, status_code_retries: int | None = None, retriable_status_codes: list[int] | None = None, raise_exc: bool | None = None, rate_limit: float | None = None, concurrency: int | None = None, connect_retry_delay: float | None = None, status_code_retry_delay: float | None = None, statsd_client: statsd_client.StatsClient | None = None, statsd_prefix: str | None = None, prometheus_counter: prometheus_client.Counter | None = None, prometheus_histogram: prometheus_client.Histogram | None = None, influxdb_config: dict[str, ty.Any] | None = None, influxdb_client: influxdb_client.InfluxDBClient | None = None)
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: session.Session, *, service_type: str | None = None, service_name: str | None = None, interface: str | None = None, region_name: str | None = None, endpoint_override: str | None = None, version: str | None = None, auth: plugin.BaseAuthPlugin | None = None, user_agent: str | None = None, connect_retries: int | None = None, logger: logging.Logger | None = None, allow: dict[str, ty.Any] | None = None, additional_headers: collections.abc.MutableMapping[str, str] | None = None, client_name: str | None = None, client_version: str | None = None, allow_version_hack: bool | None = None, global_request_id: str | None = None, min_version: str | None = None, max_version: str | None = None, default_microversion: str | None = None, status_code_retries: int | None = None, retriable_status_codes: list[int] | None = None, raise_exc: bool | None = None, rate_limit: float | None = None, concurrency: int | None = None, connect_retry_delay: float | None = None, status_code_retry_delay: float | None = None, statsd_client: statsd_client.StatsClient | None = None, statsd_prefix: str | None = None, prometheus_counter: prometheus_client.Counter | None = None, prometheus_histogram: prometheus_client.Histogram | None = None, influxdb_config: dict[str, ty.Any] | None = None, influxdb_client: influxdb_client.InfluxDBClient | None = None)
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