def changes(self):
        """Construct a change set bound to this zone.

        :rtype: :class:`google.cloud.dns.changes.Changes`
        :returns: a new ``Changes`` instance
        """
        return Changes(zone=self)
def _item_to_changes(iterator, resource):
    """Convert a JSON "changes" value to the native object.

    :type iterator: :class:`~google.cloud.iterator.Iterator`
    :param iterator: The iterator that has retrieved the item.

    :type resource: dict
    :param resource: An item to be converted to a "changes".

    :rtype: :class:`.Changes`
    :returns: The next "changes" in the page.
    """
    return Changes.from_api_repr(resource, iterator.zone)
Exemple #3
0
def _item_to_changes(iterator, resource):
    """Convert a JSON "changes" value to the native object.

    :type iterator: :class:`~google.cloud.iterator.Iterator`
    :param iterator: The iterator that has retrieved the item.

    :type resource: dict
    :param resource: An item to be converted to a "changes".

    :rtype: :class:`.Changes`
    :returns: The next "changes" in the page.
    """
    return Changes.from_api_repr(resource, iterator.zone)
    def list_changes(self, max_results=None, page_token=None, client=None):
        """List change sets for this zone.

        See:
        https://cloud.google.com/dns/api/v1/resourceRecordSets/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.

        :type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
        :param client: the client to use.  If not passed, falls back to the
                       ``client`` stored on the current zone.

        :rtype: tuple, (list, str)
        :returns: list of
                  :class:`google.cloud.dns.resource_record_set.ResourceRecordSet`,
                  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/%s/changes' % (self.project,
                                                         self.name)
        client = self._require_client(client)
        conn = client.connection
        resp = conn.api_request(method='GET', path=path, query_params=params)
        zones = [
            Changes.from_api_repr(resource, self)
            for resource in resp['changes']
        ]
        return zones, resp.get('nextPageToken')
Exemple #5
0
    def list_changes(self, max_results=None, page_token=None, client=None):
        """List change sets for this zone.

        See:
        https://cloud.google.com/dns/api/v1/resourceRecordSets/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.

        :type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
        :param client: the client to use.  If not passed, falls back to the
                       ``client`` stored on the current zone.

        :rtype: tuple, (list, str)
        :returns: list of
                  :class:`google.cloud.dns.resource_record_set.ResourceRecordSet`,
                  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/%s/changes' % (
            self.project, self.name)
        client = self._require_client(client)
        conn = client.connection
        resp = conn.api_request(method='GET', path=path, query_params=params)
        zones = [Changes.from_api_repr(resource, self)
                 for resource in resp['changes']]
        return zones, resp.get('nextPageToken')