libcloud.dns.drivers.gandi_live module
- class libcloud.dns.drivers.gandi_live.GandiLiveDNSDriver(key: str, secret: str | None = None, secure: bool = True, host: str | None = None, port: int | None = None, **kwargs: Any | None)[source]
Bases:
BaseGandiLiveDriver
,DNSDriver
API reference can be found at:
https://doc.livedns.gandi.net/
Please note that the Libcloud paradigm of one zone per domain does not match exactly with Gandi LiveDNS. For Gandi, a “zone” can apply to multiple domains. This driver behaves as if the domain is a zone, but be warned that modifying a domain means modifying the zone. If you have a zone associated with multiple domains, all of those domains will be modified as well.
- Parameters:
key (
str
) – API key or username to used (required)secret (
str
) – Secret password to be used (required)secure (
bool
) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.host (
str
) – Override hostname used for connections.port (
int
) – Override port used for connections.
- Returns:
None
- RECORD_TYPE_MAP: Dict[RecordType, str] = {'A': 'A', 'AAAA': 'AAAA', 'ALIAS': 'ALIAS', 'CAA': 'CAA', 'CNAME': 'CNAME', 'DNAME': 'DNAME', 'DS': 'DS', 'KEY': 'KEY', 'LOC': 'LOC', 'MX': 'MX', 'NS': 'NS', 'PTR': 'PTR', 'SPF': 'SPF', 'SRV': 'SRV', 'SSHFP': 'SSHFP', 'TLSA': 'TLSA', 'TXT': 'TXT', 'WKS': 'WKS'}
- connectionCls
alias of
GandiLiveDNSConnection
- create_record(name, zone, type, data, extra=None)[source]
Create a new record.
- Parameters:
name (
str
) – Record name without the domain name (e.g. www). Note: If you want to create a record for a base domain name, you should specify empty string (‘’) for this argument.zone (
Zone
) – Zone where the requested record is created.type (
RecordType
) – DNS record type (A, AAAA, …).data (
str
) – Data for the record (depends on the record type).extra (
dict
) – Extra attributes (driver specific). (optional)
- Return type:
Record
- create_zone(domain, type='master', ttl=None, extra=None)[source]
Create a new zone.
- Parameters:
domain (
str
) – Zone domain name (e.g. example.com)type (
str
) – Zone type (master / slave).ttl (
int
) – TTL for new records. (optional)extra (
dict
) – Extra attributes (driver specific). (optional)
- Return type:
Zone
- delete_record(record)[source]
Delete a record.
- Parameters:
record (
Record
) – Record to delete.- Return type:
bool
- export_zone_to_bind_format(zone)[source]
Export Zone object to the BIND compatible format.
- Parameters:
zone (
Zone
) – Zone to export.- Returns:
Zone data in BIND compatible format.
- Return type:
str
- get_record(zone_id, record_id)[source]
Return a Record instance.
- Parameters:
zone_id (
str
) – ID of the required zonerecord_id (
str
) – ID of the required record
- Return type:
Record
- get_zone(zone_id)[source]
Return a Zone instance.
- Parameters:
zone_id (
str
) – ID of the required zone- Return type:
Zone
- list_records(zone)[source]
Return a list of records for the provided zone.
- Parameters:
zone (
Zone
) – Zone to list records for.- Returns:
list
ofRecord
- type = 'gandi'
- update_record(record, name, type, data, extra)[source]
Update an existing record.
- Parameters:
record (
Record
) – Record to update.name (
str
) – Record name without the domain name (e.g. www). Note: If you want to create a record for a base domain name, you should specify empty string (‘’) for this argument.type (
RecordType
) – DNS record type (A, AAAA, …).data (
str
) – Data for the record (depends on the record type).extra (
dict
) – (optional) Extra attributes (driver specific).
- Return type:
Record