a
    !f$                     @   s<   d Z ddlmZ ddlmZ ddlmZ G dd deZdS )z5Client for interacting with the Google Cloud DNS API.    )
JSONClient)
ConnectionManagedZonec                   @   s0   e Zd ZdZeZdd Zd	ddZd
ddZdS )Clienta  Client to bundle configuration needed for API requests.

    :type project: string
    :param project: 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.

    :type credentials: :class:`oauth2client.client.OAuth2Credentials` or
                       :class:`NoneType`
    :param credentials: 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.

    :type http: :class:`httplib2.Http` or class that defines ``request()``.
    :param http: 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.
    c                 C   s6   d| j f }| jjd|d}tdd |d  D S )a)  Return DNS quots for the project associated with this client.

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

        :rtype: mapping
        :returns: keys for the mapping correspond to those of the ``quota``
                  sub-mapping of the project resource.
        z/projects/%sGET)methodpathc                 S   s$   g | ]\}}|d kr|t |fqS )kind)int).0keyvalue r   R/var/www/html/python-backend/venv/lib/python3.9/site-packages/gcloud/dns/client.py
<listcomp>;   s   z!Client.quotas.<locals>.<listcomp>Zquota)project
connectionapi_requestdictitems)selfr	   respr   r   r   quotas.   s
    

zClient.quotasNc                    sf   i }|dur||d< |dur$||d< d j f } jjd||d} fdd|d	 D }||d
fS )aM  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``).
        NZ
maxResultsZ	pageTokenz/projects/%s/managedZonesr   )r   r	   Zquery_paramsc                    s   g | ]}t | qS r   )r   Zfrom_api_repr)r   resourcer   r   r   r   ^   s   z%Client.list_zones.<locals>.<listcomp>ZmanagedZonesZnextPageToken)r   r   r   get)r   Zmax_resultsZ
page_tokenparamsr	   r   Zzonesr   r   r   
list_zones>   s    

zClient.list_zonesc                 C   s   t ||| |dS )aV  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
        )clientdescriptionr   )r   nameZdns_namer    r   r   r   zoneb   s    zClient.zone)NN)NN)	__name__
__module____qualname____doc__r   Z_connection_classr   r   r"   r   r   r   r   r      s
   
$r   N)r&   Zgcloud.clientr   Zgcloud.dns.connectionr   Zgcloud.dns.zoner   r   r   r   r   r   <module>   s   