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 inRECORD_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
keyaccount
.Note that for
extra
zone properties, only the ones specified inZONE_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
- 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 = '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 inRECORD_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
andttl
properties can’t be updated. The only updatable properties are theextra
zone properties specified inZONE_UPDATE_ATTRIBUTES
. Only one property may be updated at a time. Any non-updatable properties are ignored.