DNS Client#

Client for interacting with the Google Cloud DNS API.

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

Bases: gcloud.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 gcloud.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 quots 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)[source]#

Construct a zone bound to this client.

Parameters:
  • name (string) – Name of the zone.
  • dns_name (string) – DNS name of the zone.
Return type:

gcloud.dns.zone.ManagedZone

Returns:

a new ManagedZone instance

Connection#

Create / interact with gcloud dns connections.

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

Bases: gcloud.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.