libcloud.dns.drivers.google module
- class libcloud.dns.drivers.google.GoogleDNSDriver(user_id, key, project=None, auth_type=None, scopes=None, **kwargs)[source]
Bases:
DNSDriver
- 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', 'CAA': 'CAA', 'CNAME': 'CNAME', 'MX': 'MX', 'NS': 'NS', 'PTR': 'PTR', 'SOA': 'SOA', 'SPF': 'SPF', 'SRV': 'SRV', 'TXT': 'TXT'}
- connectionCls
alias of
GoogleDNSConnection
- create_record(name, zone, type, data, extra=None)[source]
Create a new record.
- Parameters:
name (
str
) – Record name fully qualified, with a ‘.’ at the end.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. (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.) with a ‘.’ at the end.type (
str
) – Zone type (master is the only one supported).ttl (
int
) – TTL for new records. (unused)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
- delete_zone(zone)[source]
Delete a zone.
Note: This will delete all the records belonging to this zone.
- Parameters:
zone (
Zone
) – Zone to delete.- Return type:
bool
- ex_bulk_record_changes(zone, records)[source]
Bulk add and delete records.
- Parameters:
zone (
Zone
) – Zone where the requested record changes are done.records – Dictionary of additions list or deletions list, or both
- of resourceRecordSets. For example:
- {‘additions’: [{‘rrdatas’: [‘127.0.0.1’],
‘kind’: ‘dns#resourceRecordSet’, ‘type’: ‘A’, ‘name’: ‘www.example.com.’, ‘ttl’: ‘300’}],
- ‘deletions’: [{‘rrdatas’: [‘127.0.0.1’],
‘kind’: ‘dns#resourceRecordSet’, ‘type’: ‘A’, ‘name’: ‘www2.example.com.’, ‘ttl’: ‘300’}]}
- Returns:
A dictionary of Record additions and deletions.
- Return type:
dict
of additions and deletions ofRecord
- 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
- iterate_records(zone)[source]
Return a generator to iterate over records for the provided zone.
- Parameters:
zone (
Zone
) – Zone to list records for.- Return type:
generator
ofRecord
- iterate_zones()[source]
Return a generator to iterate over available zones.
- Return type:
generator
ofZone
- type = 'google'