def _set_properties(self, resource): """Helper method for :meth:`from_api_repr`, :meth:`create`, etc. :type resource: dict :param resource: change set representation returned from the API """ resource = resource.copy() self._additions = tuple([ ResourceRecordSet.from_api_repr(added_res, self.zone) for added_res in resource.pop('additions', ())]) self._deletions = tuple([ ResourceRecordSet.from_api_repr(added_res, self.zone) for added_res in resource.pop('deletions', ())]) self._properties = resource
def _set_properties(self, resource): """Helper method for :meth:`from_api_repr`, :meth:`create`, etc. :type resource: dict :param resource: change set representation returned from the API. """ resource = resource.copy() self._additions = tuple([ ResourceRecordSet.from_api_repr(added_res, self.zone) for added_res in resource.pop('additions', ())]) self._deletions = tuple([ ResourceRecordSet.from_api_repr(added_res, self.zone) for added_res in resource.pop('deletions', ())]) self._properties = resource
def list_resource_record_sets(self, max_results=None, page_token=None, client=None): """List resource record 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:`gcloud.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:`gcloud.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/rrsets' % (self.project, self.name) client = self._require_client(client) conn = client.connection resp = conn.api_request(method='GET', path=path, query_params=params) zones = [ ResourceRecordSet.from_api_repr(resource, self) for resource in resp['rrsets'] ] return zones, resp.get('nextPageToken')
def list_resource_record_sets(self, max_results=None, page_token=None, client=None): """List resource record 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:`gcloud.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:`gcloud.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/rrsets' % ( self.project, self.name) client = self._require_client(client) conn = client.connection resp = conn.api_request(method='GET', path=path, query_params=params) zones = [ResourceRecordSet.from_api_repr(resource, self) for resource in resp['rrsets']] return zones, resp.get('nextPageToken')