DNS Client#

Client for interacting with the Google Cloud DNS API.

class google.cloud.dns.client.Client(project=None, credentials=None, http=None)[source]#

Bases: google.cloud.client.JSONClient

Client to bundle configuration needed for API requests.

Parameters:
  • project (string) – the project which the client acts on behalf of. Will be passed when creating a zone. If not passed, falls back to the default inferred from the environment.
  • credentials (oauth2client.client.OAuth2Credentials or NoneType) – The OAuth2 Credentials to use for the connection owned by this client. If not passed (and if no http object is passed), falls back to the default inferred from the environment.
  • http (httplib2.Http or class that defines request().) – An optional HTTP object to make requests. If not passed, an http object is created that is bound to the credentials for the current object.
list_zones(max_results=None, page_token=None)[source]#

List zones for the project associated with this client.

See: https://cloud.google.com/dns/api/v1/managedZones/list

Parameters:
  • max_results (int) – maximum number of zones to return, If not passed, defaults to a value set by the API.
  • page_token (string) – opaque marker for the next “page” of zones. If not passed, the API will return the first page of zones.
Return type:

tuple, (list, str)

Returns:

list of google.cloud.dns.zone.ManagedZone, plus a “next page token” string: if the token is not None, indicates that more zones can be retrieved with another call (pass that value as page_token).

quotas()[source]#

Return DNS quotas for the project associated with this client.

See: https://cloud.google.com/dns/api/v1/projects/get

Return type:mapping
Returns:keys for the mapping correspond to those of the quota sub-mapping of the project resource.
zone(name, dns_name=None, description=None)[source]#

Construct a zone bound to this client.

Parameters:
  • name (string) – Name of the zone.
  • dns_name (string or NoneType) – DNS name of the zone. If not passed, then calls to zone.create() will fail.
  • description (string or NoneType) – the description for the zone. If not passed, defaults to the value of ‘dns_name’.
Return type:

google.cloud.dns.zone.ManagedZone

Returns:

a new ManagedZone instance.

Connection#

Create / interact with Google Cloud DNS connections.

class google.cloud.dns.connection.Connection(credentials=None, http=None)[source]#

Bases: google.cloud.connection.JSONConnection

A connection to Google Cloud DNS via the JSON REST API.

API_BASE_URL = 'https://www.googleapis.com'#

The base of the API call URL.

API_URL_TEMPLATE = '{api_base_url}/dns/{api_version}{path}'#

A template for the URL of a particular API call.

API_VERSION = 'v1'#

The version of the API, used in building the API call’s URL.

SCOPE = ('https://www.googleapis.com/auth/ndev.clouddns.readwrite',)#

The scopes required for authenticating as a Cloud DNS consumer.