certbot_dns_google.dns_google

DNS Authenticator for Google Cloud DNS.

class certbot_dns_google.dns_google.Authenticator(*args, **kwargs)[source]

Bases: certbot.plugins.dns_common.DNSAuthenticator

DNS Authenticator for Google Cloud DNS

This Authenticator uses the Google Cloud DNS API to fulfill a dns-01 challenge.

class certbot_dns_google.dns_google._GoogleClient(account_json=None)[source]

Bases: object

Encapsulates all communication with the Google Cloud DNS API.

add_txt_record(domain, record_name, record_content, record_ttl)[source]

Add a TXT record using the supplied information.

Parameters:
  • domain (str) – The domain to use to look up the managed zone.
  • record_name (str) – The record name (typically beginning with ‘_acme-challenge.’).
  • record_content (str) – The record content (typically the challenge validation).
  • record_ttl (int) – The record TTL (number of seconds that the record may be cached).
Raises:

certbot.errors.PluginError – if an error occurs communicating with the Google API

del_txt_record(domain, record_name, record_content, record_ttl)[source]

Delete a TXT record using the supplied information.

Parameters:
  • domain (str) – The domain to use to look up the managed zone.
  • record_name (str) – The record name (typically beginning with ‘_acme-challenge.’).
  • record_content (str) – The record content (typically the challenge validation).
  • record_ttl (int) – The record TTL (number of seconds that the record may be cached).
Raises:

certbot.errors.PluginError – if an error occurs communicating with the Google API

get_existing_txt_rrset(zone_id, record_name)[source]

Get existing TXT records from the RRset for the record name.

If an error occurs while requesting the record set, it is suppressed and None is returned.

Parameters:
  • zone_id (str) – The ID of the managed zone.
  • record_name (str) – The record name (typically beginning with ‘_acme-challenge.’).
Returns:

List of TXT record values or None

Return type:

list of string or None

_find_managed_zone_id(domain)[source]

Find the managed zone for a given domain.

Parameters:domain (str) – The domain for which to find the managed zone.
Returns:The ID of the managed zone, if found.
Return type:str
Raises:certbot.errors.PluginError – if the managed zone cannot be found.
static get_project_id()[source]

Query the google metadata service for the current project ID

This only works on Google Cloud Platform

Raises:
  • ServerNotFoundError – Not running on Google Compute or DNS not available
  • ValueError – Server is found, but response code is not 200
Returns:

project id