libcloud.dns.drivers.cloudflare module

class libcloud.dns.drivers.cloudflare.CloudFlareDNSDriver(key, secret=None, secure=True, host=None, port=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

MEMBERSHIPS_PAGE_SIZE = 50
RECORDS_PAGE_SIZE = 100
RECORD_TYPE_MAP: Dict[RecordType, str] = {'A': 'A', 'AAAA': 'AAAA', 'CNAME': 'CNAME', 'MX': 'MX', 'NS': 'NS', 'SPF': 'SPF', 'SRV': 'SRV', 'TXT': 'TXT', 'URL': 'LOC'}
ZONES_PAGE_SIZE = 50
connectionCls

alias of GlobalAPIKeyDNSConnection

create_record(name, zone, type, data, extra=None)[source]

@inherits: DNSDriver.create_record

Note that for extra record properties, only the ones specified in RECORD_CREATE_ATTRIBUTES can be set at creation time. Any non-settable properties are ignored.

NOTE: For CAA RecordType, data needs to be in the following format: <flags> <tag> <ca domain name> where the tag can be issue, issuewild or iodef.

For example: 0 issue test.caa.com

NOTE: For SSHFP RecordType, data need to be in the format: <algorithm> <type> <fingerprint>

create_zone(domain, type='master', ttl=None, extra=None)[source]

@inherits: DNSDriver.create_zone

Note that for users who have more than one account membership, the id of the account in which to create the zone must be specified via the extra key account.

Note that for extra zone properties, only the ones specified in ZONE_CREATE_ATTRIBUTES can be set at creation time. Additionally, setting the ``ttl` property is not supported.

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_blacklist_ip(zone, ip)[source]
ex_disable_development_mode(zone)[source]
ex_disable_ipv6_support(zone)[source]
ex_enable_development_mode(zone)[source]
ex_enable_ipv6_support(zone)[source]
ex_get_ip_threat_score(ip)[source]
ex_get_user_account_memberships()[source]
ex_get_zone_settings(zone)[source]
ex_get_zone_stats(zone, interval=30)[source]
ex_purge_cached_file(zone, url)[source]
ex_purge_cached_files(zone)[source]
ex_set_zone_cache_level(zone, level)[source]
ex_set_zone_security_level(zone, level)[source]
ex_unlist_ip(zone, ip)[source]
ex_whitelist_ip(zone, ip)[source]
ex_zone_check(zones)[source]
get_record(zone_id, record_id)[source]

Return a Record instance.

Parameters:
  • zone_id (str) – ID of the required zone

  • record_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 of Record

iterate_zones()[source]

Return a generator to iterate over available zones.

Return type:

generator of Zone

name: str = 'CloudFlare DNS'
type = 'cloudflare'
update_record(record, name=None, type=None, data=None, extra=None)[source]

@inherits: DNSDriver.update_record

Note that for extra record properties, only the ones specified in RECORD_UPDATE_ATTRIBUTES can be updated. Any non-updatable properties are ignored.

update_zone(zone, domain, type='master', ttl=None, extra=None)[source]

@inherits: DNSDriver.update_zone

Note that the zone, type and ttl properties can’t be updated. The only updatable properties are the extra zone properties specified in ZONE_UPDATE_ATTRIBUTES. Only one property may be updated at a time. Any non-updatable properties are ignored.

website: str = 'https://www.cloudflare.com'