def list_zones(self, max_results=None, page_token=None): """List zones for the project associated with this client. See: https://cloud.google.com/dns/api/v1/managedZones/list :type max_results: int :param max_results: maximum number of zones to return, If not passed, defaults to a value set by the API. :type page_token: string :param page_token: opaque marker for the next "page" of zones. If not passed, the API will return the first page of zones. :rtype: tuple, (list, str) :returns: list of :class:`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``). """ params = {} if max_results is not None: params['maxResults'] = max_results if page_token is not None: params['pageToken'] = page_token path = '/projects/%s/managedZones' % (self.project,) resp = self.connection.api_request(method='GET', path=path, query_params=params) zones = [ManagedZone.from_api_repr(resource, self) for resource in resp['managedZones']] return zones, resp.get('nextPageToken')
def zone(self, name, dns_name): """Construct a zone bound to this client. :type name: string :param name: Name of the zone. :type dns_name: string :param dns_name: DNS name of the zone. :rtype: :class:`gcloud.dns.zone.ManagedZone` :returns: a new ``ManagedZone`` instance """ return ManagedZone(name, dns_name, client=self)
def zone(self, name, dns_name=None, description=None): """Construct a zone bound to this client. :type name: string :param name: Name of the zone. :type dns_name: string or :class:`NoneType` :param dns_name: DNS name of the zone. If not passed, then calls to :meth:`zone.create` will fail. :type description: string or :class:`NoneType` :param description: the description for the zone. If not passed, defaults to the value of 'dns_name'. :rtype: :class:`gcloud.dns.zone.ManagedZone` :returns: a new ``ManagedZone`` instance. """ return ManagedZone(name, dns_name, client=self, description=description)