
    Li                     	   d dl Z d dlZd dlmZmZmZ d dlmZ ddlm	Z	 ddlm
Z
 ddlmZ ddlmZ dd	lmZ dd
l
mZ ddl
mZ ddlmZmZ  ej.                  d      Z	 d3deeeef   ef   deeeef      deeef   fdZ	 d3deeeef   ef   deeeef      deeef   fdZ	 d3deeeef   ef   deeeef      deeef   fdZ	 d3deeeef   ef   deeeef      deeef   fdZ	 d3dedeeeef   ef   deeeef      deeef   fdZ 	 d3dedeeeef   ef   deeeef      deeef   fdZ!	 d3dedeeeef   ef   deeeef      deeef   fdZ"	 d3dedeeeef   ef   deeeef      deeef   fdZ#	 d3deeeef   ef   deeeef      deeef   fdZ$	 d3deeeef   ef   deeeef      deeef   fdZ%	 d3deeeef   ef   deeeef      deeef   fdZ&	 d3deeeef   ef   deeeef      deeef   fdZ'	 d3dedeeeef   ef   deeeef      deeef   fdZ(	 d3dedeeeef   ef   deeeef      deeef   fdZ)	 d3deeeef   ef   deeeef      deeef   fd Z*	 d3deeeef   ef   deeeef      deeef   fd!Z+	 d3deeeef   ef   deeeef      deeef   fd"Z,	 d3deeeef   ef   deeeef      deeef   fd#Z-	 d3deeeef   ef   deeeef      deeef   fd$Z.	 d3deeeef   ef   deeeef      deeef   fd%Z/	 d3deeeef   ef   deeeef      deeef   fd&Z0	 d3deeeef   ef   deeeef      deeef   fd'Z1	 d3deeeef   ef   deeeef      deeef   fd(Z2	 d3deeeef   ef   deeeef      deeef   fd)Z3	 d3deeeef   ef   deeeef      deeef   fd*Z4	 d3deeeef   ef   deeeef      deeef   fd+Z5	 d3deeeef   ef   deeeef      deeef   fd,Z6	 d3dedeeeef   ef   deeeef      deeef   fd-Z7	 d3dedeeeef   ef   deeeef      deeef   fd.Z8 G d/ d0e	jr                        Z: G d1 d2e	jr                        Z;y)4    N)AnyOptionalUnion)	urlencode   )_api_module)_common)_transformers)types)BaseApiClient)get_value_by_path)set_value_by_path)
AsyncPagerPagerzgoogle_genai.cachesfrom_objectparent_objectreturnc                     i }t        | dg      t        |dgt        | dg             t        | dg      t        d      t        | dg      t        |dgt        | dg             |S )Ndatadisplay_name6display_name parameter is not supported in Gemini API.	mime_typemimeType)getvsetv
ValueErrorr   r   	to_objects      Q/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/google/genai/caches.py_Blob_to_mldevr    $   sw     !)	+x ,VHd;9:	+'(4
M
NN	+}%1ZL${[M"BC	    c                     i }t        | dg      1t        |dgt        | dg      D cg c]  }t        ||       c}       t        | dg      t        |dgt        | dg             |S c c}w )Npartsrole)r   r   _Part_to_mldevr   r   r   items       r   _Content_to_mldevr(   5   s     !)	+y!-		 [7)4	
 4+	
 
+x ,VHd;9:		
s   A)c                 "   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      Dt        |dgt        j                  t        | dg            D cg c]  }t	        ||       c}       t        | dg      6t        |dgt	        t        j
                  t        | dg            |             t        | d	g      1t        |d	gt        | d	g      D cg c]  }t        ||       c}       t        | d
g      t        |dgt        | d
g             t        | dg      t        d      |S c c}w c c}w )Nttlexpire_time
expireTimer   displayNamecontentssystem_instructionsystemInstructiontoolstool_config
toolConfigkms_key_namez6kms_key_name parameter is not supported in Gemini API.)r   r   t
t_contentsr(   	t_content_Tool_to_mldevr   r&   s       r   #_CreateCachedContentConfig_to_mldevr9   J   s    !)	+w+kE7!;<	+'3[=/(JK	+'(4kN;K)LM	+
|$0	 T+
|%DE	
 dI.	
 
+,-.:	KK[+?*@ABI	
 
+y!-		 [7)4	
 4+	
 
+'3[=/(JK	+'(4
M
NN	?	
&	
s   ,F-Fc                    i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      :t        |dgt        j                  t        | dg            D cg c]  }| c}       t        | dg      ,t        |dgt        j                  t        | dg                   t        | d	g      1t        |d	gt        | d	g      D cg c]  }t        ||       c}       t        | d
g      t        |dgt        | d
g             t        | dg      t        |ddgt        | dg             |S c c}w c c}w )Nr*   r+   r,   r   r-   r.   r/   r0   r1   r2   r3   r4   encryption_spec
kmsKeyName)r   r   r5   r6   r7   _Tool_to_vertexr&   s       r   $_CreateCachedContentConfig_to_vertexr>      s    !)	+w+kE7!;<	+'3[=/(JK	+'(4kN;K)LM	+
|$0	,,tK*'FGH$H 
+,-.:		D';&<=> 
+y!-		 [7)4	
 D),	
 
+'3[=/(JK	+'(4	L)[>*+ 
= 	I	
s   ,	FF
api_clientc                     i }t        |dg      -t        |dgt        j                  | t        |dg                   t        |dg      t	        t        |dg      |       |S Nmodelconfig)r   r   r5   t_caches_modelr9   r?   r   r   r   s       r   '_CreateCachedContentParameters_to_mldevrF      sp    
 !)	+y!-			T+y%AB 
+z".'[8*%y 
r!   c                     i }t        |dg      -t        |dgt        j                  | t        |dg                   t        |dg      t	        t        |dg      |       |S rA   )r   r   r5   rD   r>   rE   s       r   (_CreateCachedContentParameters_to_vertexrH      sp    
 !)	+y!-			T+y%AB 
+z".([8*%y 
r!   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S Nname_urlr   r   r5   t_cached_content_namerE   s       r   '_DeleteCachedContentParameters_to_mldevrO      L    
 !)	+x ,		
Dvh,GH 
r!   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S rJ   rM   rE   s       r   (_DeleteCachedContentParameters_to_vertexrR      rP   r!   c                 V    i }t        | dg      t        |dgt        | dg             |S NsdkHttpResponsesdk_http_responser   r   r   s      r   '_DeleteCachedContentResponse_from_mldevrX      @     !)	+)*+7'(${=N<O*P 
r!   c                 V    i }t        | dg      t        |dgt        | dg             |S rT   rW   r   s      r   (_DeleteCachedContentResponse_from_vertexr[   
  rY   r!   c                     i }t        | dg      t        d      t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S )Nr   r   file_urifileUrir   r   r   r   r   r   s      r   _FileData_to_mldevr`     sw     !)	+'(4
M
NN	+
|$0YKkJ<!@A	+}%1ZL${[M"BC	r!   c                    i }t        | dg      t        d      t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | d	g      t        |d
gt        | d	g             |S )Nbehaviorz1behavior parameter is not supported in Vertex AI.descriptionrK   
parametersparameters_json_schemaparametersJsonSchemaresponseresponse_json_schemaresponseJsonSchemar_   r   s      r   _FunctionDeclaration_to_vertexrj   (  s&    !)	+
|$0
H
II	+'3]OT+%GH	+x ,VHd;9:	+~&2\ND|n$EF	+012>	 [345 
+
|$0ZL${ZL"AB	+./0<	[123 
r!   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S rJ   rM   rE   s       r   $_GetCachedContentParameters_to_mldevrl   M  rP   r!   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S rJ   rM   rE   s       r   %_GetCachedContentParameters_to_vertexrn   ]  rP   r!   c                     i }t        | dg      t        d      t        | dg      t        |dgt        | dg             |S )Nauth_configz5auth_config parameter is not supported in Gemini API.enable_widgetenableWidgetr_   r   s      r   _GoogleMaps_to_mldevrs   m  sS     !)	+'3
L
MM	+()5^$d;8I&JK	r!   c                     i }t        | dg      t        d      t        | dg      t        d      t        | dg      t        |dgt        | dg             |S )Nexclude_domainsz9exclude_domains parameter is not supported in Gemini API.blocking_confidencez=blocking_confidence parameter is not supported in Gemini API.time_range_filtertimeRangeFilterr_   r   s      r   _GoogleSearch_to_mldevry   {  s     !)	+)*+7
C  
+-./;
G  
++,-9%&[;N:O(P 
r!   c                     i }t        | dg      t        |ddgt        | dg             t        | dg      t        |ddgt        | dg             |S N	page_size_querypageSize
page_token	pageTokenrW   r   s      r   "_ListCachedContentsConfig_to_mldevr     m     !)	+}%1*-tK+/O 
+~&2	;[<.) 
r!   c                     i }t        | dg      t        |ddgt        | dg             t        | dg      t        |ddgt        | dg             |S r{   rW   r   s      r   #_ListCachedContentsConfig_to_vertexr     r   r!   c                 R    i }t        | dg      t        t        | dg      |       |S NrC   )r   r   r   s      r   &_ListCachedContentsParameters_to_mldevr     s1     !)	+z".&tK('DiP	r!   c                 R    i }t        | dg      t        t        | dg      |       |S r   )r   r   r   s      r   '_ListCachedContentsParameters_to_vertexr     s6     !)	+z".'[8*%y 
r!   c                    i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      't        |dgt        | dg      D cg c]  }| c}       |S c c}w NrU   rV   nextPageTokennext_page_tokencachedContentscached_contentsrW   r&   s       r   &_ListCachedContentsResponse_from_mldevr          !)	+)*+7'(${=N<O*P 
+()5&'kO;L)MN	+()*6	{-=,>?@$@ 
 	A   3	Bc                    i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      't        |dgt        | dg      D cg c]  }| c}       |S c c}w r   rW   r&   s       r   '_ListCachedContentsResponse_from_vertexr     r   r   c           
      *   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      #t        |dgt        t        | dg      |             t        | d	g      t        |d
gt        | d	g             t        | dg      #t        |dgt        t        | dg      |             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S )Nfunction_callfunctionCallcode_execution_resultcodeExecutionResultexecutable_codeexecutableCode	file_datafileDatafunction_responsefunctionResponseinline_data
inlineDatatextthoughtthought_signaturethoughtSignaturevideo_metadatavideoMetadata)r   r   r`   r    r   s      r   r%   r%     s    !)	+()5^$d;8I&JK	+/01=	[234 
+)*+7%&[;L:M(NO	+}%1	4k];YG 
++,-9	[./0 
+'3	tK-99E 
+x ,VHd;9:	+	{#/YKkI;!?@	++,-9	[./0 
+()*6_%tK:J9K'LM	r!   c           
         i }t        | dg      't        |dgt        | dg      D cg c]  }| c}       t        | dg      t        d      t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | d	g      t        |d
gt        | d	g             t        | dg      t        |dgt        | dg             t        | dg      t        d      t        | dg      #t        |dgt        t        | dg      |             t        | dg      #t        |dgt	        t        | dg      |             t        | dg      t        |dgt        | dg             |S c c}w )Nfunction_declarationsfunctionDeclarations	retrievalz3retrieval parameter is not supported in Gemini API.google_search_retrievalgoogleSearchRetrievalcomputer_usecomputerUsefile_search
fileSearchcode_executioncodeExecutionenterprise_web_searchz?enterprise_web_search parameter is not supported in Gemini API.google_maps
googleMapsgoogle_searchgoogleSearchurl_context
urlContext)r   r   r   rs   ry   r&   s       r   r8   r8   <  s    !)	+/01=	 {-D,EFG$G 
+}%1
J
KK	+123?	 ![456 
+'(4]OT+7G%HI	+'3\ND}o$FG	+()*6_%tK:J9K'LM	+/01=
I  
+'3	T+?K 
+()5	tK/1BCYO 
+'3\ND}o$FG	Y 	Hs   	Fc                     i }t        | dg      1t        |dgt        | dg      D cg c]  }t        ||       c}       t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        d	      t        | d
g      t        |dgt        | d
g             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S c c}w )Nr   r   r   r   r   r   r   r   z4file_search parameter is not supported in Vertex AI.r   r   r   enterpriseWebSearchr   r   r   r   r   r   )r   r   rj   r   r&   s       r   r=   r=   t  s    !)	+/01=	  [+B*CD	
 +4;	
 
+}%1[M4k]#CD	+123?	 ![456 
+'(4]OT+7G%HI	+'3
K
LL	+()*6_%tK:J9K'LM	+/01=	[234 
+'3\ND}o$FG	+()5^$d;8I&JK	+'3\ND}o$FG	S	
s   Fc                     i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S Nr*   r+   r,   rW   r   s      r   #_UpdateCachedContentConfig_to_mldevr     [     !)	+w+kE7!;<	+'3[=/(JK	r!   c                     i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S r   rW   r   s      r   $_UpdateCachedContentConfig_to_vertexr     r   r!   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   t        |dg      t	        t        |dg      |       |S NrK   rL   rC   )r   r   r5   rN   r   rE   s       r   '_UpdateCachedContentParameters_to_mldevr     ss    
 !)	+x ,		
Dvh,GH 
+z".'[8*%y 
r!   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   t        |dg      t	        t        |dg      |       |S r   )r   r   r5   rN   r   rE   s       r   (_UpdateCachedContentParameters_to_vertexr     ss    
 !)	+x ,		
Dvh,GH 
+z".([8*%y 
r!   c                      e Zd Zdddedeej                     dej                  fdZdddedeej                     dej                  fdZ
dddedeej                     dej                  fd	Zdddedeej                     dej                  fd
Zdddeej                      dej"                  fdZdddeej                      deej                     fdZy)CachesNrC   rB   rC   r   c                   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
|j+                         	      }| j                  j-                  |       |S )
a  Creates a cached contents resource.

    Usage:

    .. code-block:: python

      contents = ... // Initialize the content to cache.
      response = client.caches.create(
          model= ... // The publisher model id
          contents=contents,
          config={
              'display_name': 'test cache',
              'system_instruction': 'What is the sum of the two pdfs?',
              'ttl': '86400s',
          },
      )
    rB   rC   rL   r   r}   ?rC   Npostrg   kwargs)r   _CreateCachedContentParameters_api_clientvertexairH   get
format_maprF   r   poprC   http_optionsr	   convert_to_dictencode_unserializable_typesrequestbodyjsonloadsCachedContent_from_response
model_dump_verify_responseselfrB   rC   parameter_modelrequest_dictrequest_url_dictpathquery_paramsr   rg   response_dictreturn_values               r   createzCaches.create  s   0 ::O   =


Ol &))&1	**+;<<


Ol &))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''lLH 'mmBHMM1JM&&55'A'A'C 6 L 	%%l3r!   rK   c                   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
|j+                         	      }| j                  j-                  |       |S )
zGets cached content configurations.

    .. code-block:: python

      client.caches.get(name= ... ) // The server-generated resource name.
    rK   rC   rL   {name}r}   r   rC   Nr   r   )r   _GetCachedContentParametersr   r   rn   r   r   rl   r   r   rC   r   r	   r   r   r   r   r   r   r   r   r   r   r   rK   rC   r   r   r   r   r   r   rg   r   r   s               r   r   z
Caches.getA  s    77O   :


Ol &))&1	""#349


Ol &))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t\<PH&mmBHMM1JM&&55'A'A'C 6 L 	%%l3r!   c                   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }	|	j                   si nt#        j$                  |	j                         }
| j                  j                  rt'        |
      }
| j                  j                  st)        |
      }
t         j*                  j-                  |
|j/                         	      }t        j0                  |	j2                  
      |_        | j                  j7                  |       |S )zDeletes cached content.

    Usage:

    .. code-block:: python

      client.caches.delete(name= ... ) // The server-generated resource name.
    r   rL   r   r}   r   rC   Ndeleter   headers)r   _DeleteCachedContentParametersr   r   rR   r   r   rO   r   r   rC   r   r	   r   r   r   r   r   r   r[   rX   DeleteCachedContentResponser   r   HttpResponser   rV   r   r   s               r   r   zCaches.delete  s    ::O   =


Ol &))&1	""#34<


Ol &))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''$lH 'mmBHMM1JM  >}Mm$$=mLm44CC'A'A'C D L &+%7%7  &L" 	%%l3r!   c                   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
|j+                         	      }| j                  j-                  |       |S )
zUpdates cached content configurations.

    .. code-block:: python

      response = client.caches.update(
          name= ... // The server-generated resource name.
          config={
              'ttl': '7600s',
          },
      )
    r   rL   r   r}   r   rC   Npatchr   )r   _UpdateCachedContentParametersr   r   r   r   r   r   r   r   rC   r   r	   r   r   r   r   r   r   r   r   r   r   r   s               r   updatezCaches.update  s   $ ::O   =


Ol &))&1	""#34<


Ol &))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''|\H 'mmBHMM1JM&&55'A'A'C 6 L 	%%l3r!   c                R   t        j                  |      }| j                  j                  r3t	        |      }|j                  d      }|rdj                  |      }n5d}n2t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }|j                   si nt#        j$                  |j                         }	| j                  j                  rt'        |	      }	| j                  j                  st)        |	      }	t         j*                  j-                  |	|j/                         	      }
t        j0                  |j2                  
      |
_        | j                  j7                  |
       |
S )zLists cached content configurations.

    .. code-block:: python

      cached_contents = client.caches.list(config={'page_size': 2})
      for cached_content in cached_contents:
        print(cached_content)
    r   rL   r   r}   r   rC   Nr   r   r   )r   _ListCachedContentsParametersr   r   r   r   r   r   r   r   rC   r   r	   r   r   r   r   r   r   r   r   ListCachedContentsResponser   r   r   r   rV   r   r   rC   r   r   r   r   r   r   rg   r   r   s              r   _listzCaches._list  s    99O   <_Ml%))&1	**+;<;OLl%))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t\<PH&mmBHMM1JM  =mLm$$<]Km33BB'A'A'C C L &+%7%7  &L" 	%%l3r!   c                R    t        d| j                  | j                  |      |      S Nr   r   )r   r   r   rC   s     r   listzCaches.listZ  s,     



&
!	 r!   )__name__
__module____qualname__strr   r   CreateCachedContentConfigOrDictr   r   GetCachedContentConfigOrDictr   DeleteCachedContentConfigOrDictr   r   UpdateCachedContentConfigOrDictr   ListCachedContentsConfigOrDictr   r   r   r   r!   r   r   r     s`    AE	L L u<<=	L
 Ld >B	? ? u99:	?
 ?J AE	K K u<<=	K
 ((Kb AE	F F u<<=	F
 FR IMA D DEA''AH IM D DEU  !r!   r   c                      e Zd Zdddedeej                     dej                  fdZdddedeej                     dej                  fdZ
dddedeej                     dej                  fd	Zdddedeej                     dej                  fd
Zdddeej                      dej"                  fdZdddeej                      deej                     fdZy)AsyncCachesNr   rB   rC   r   c                  K   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d{   }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
|j+                         	      }| j                  j-                  |       |S 7 }w)
a  Creates a cached contents resource.

    Usage:

    .. code-block:: python

      contents = ... // Initialize the content to cache.
      response = await client.aio.caches.create(
          model= ... // The publisher model id
          contents=contents,
          config={
              'display_name': 'test cache',
              'system_instruction': 'What is the sum of the two pdfs?',
              'ttl': '86400s',
          },
      )
    r   rL   r   r}   r   rC   Nr   r   )r   r   r   r   rH   r   r   rF   r   r   rC   r   r	   r   r   async_requestr   r   r   r   r   r   r   r   s               r   r   zAsyncCaches.createg  s    0 ::O   =


Ol &))&1	**+;<<


Ol &))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33lL H 'mmBHMM1JM&&55'A'A'C 6 L 	%%l3   E#G%%G#&A>G%rK   c                  K   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d{   }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
|j+                         	      }| j                  j-                  |       |S 7 }w)
zGets cached content configurations.

    .. code-block:: python

      await client.aio.caches.get(name= ... ) // The server-generated resource
      name.
    r   rL   r   r}   r   rC   Nr   r   )r   r   r   r   rn   r   r   rl   r   r   rC   r   r	   r   r   r  r   r   r   r   r   r   r   r   s               r   r   zAsyncCaches.get  s     77O   :


Ol &))&1	""#349


Ol &))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t\< H 'mmBHMM1JM&&55'A'A'C 6 L 	%%l3r  c                  K   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d{   }	|	j                   si nt#        j$                  |	j                         }
| j                  j                  rt'        |
      }
| j                  j                  st)        |
      }
t         j*                  j-                  |
|j/                         	      }t        j0                  |	j2                  
      |_        | j                  j7                  |       |S 7 w)zDeletes cached content.

    Usage:

    .. code-block:: python

      await client.aio.caches.delete(name= ... ) // The server-generated
      resource name.
    r   rL   r   r}   r   rC   Nr   r   r   )r   r   r   r   rR   r   r   rO   r   r   rC   r   r	   r   r   r  r   r   r   r[   rX   r   r   r   r   r   rV   r   r   s               r   r   zAsyncCaches.delete  s      ::O   =


Ol &))&1	""#34<


Ol &))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33$l H 'mmBHMM1JM  >}Mm$$=mLm44CC'A'A'C D L &+%7%7  &L" 	%%l3's   E#I%I
&C%Ic                  K   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d{   }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
|j+                         	      }| j                  j-                  |       |S 7 }w)
zUpdates cached content configurations.

    .. code-block:: python

      response = await client.aio.caches.update(
          name= ... // The server-generated resource name.
          config={
              'ttl': '7600s',
          },
      )
    r   rL   r   r}   r   rC   Nr   r   )r   r   r   r   r   r   r   r   r   r   rC   r   r	   r   r   r  r   r   r   r   r   r   r   r   s               r   r   zAsyncCaches.updateG  s    $ ::O   =


Ol &))&1	""#34<


Ol &))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33|\ H 'mmBHMM1JM&&55'A'A'C 6 L 	%%l3r  c                n  K   t        j                  |      }| j                  j                  r3t	        |      }|j                  d      }|rdj                  |      }n5d}n2t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d{   }|j                   si nt#        j$                  |j                         }	| j                  j                  rt'        |	      }	| j                  j                  st)        |	      }	t         j*                  j-                  |	|j/                         	      }
t        j0                  |j2                  
      |
_        | j                  j7                  |
       |
S 7 w)zLists cached content configurations.

    .. code-block:: python

      cached_contents = await client.aio.caches.list(config={'page_size': 2})
      async for cached_content in cached_contents:
        print(cached_content)
    r   rL   r   r}   r   rC   Nr   r   r   )r   r   r   r   r   r   r   r   r   r   rC   r   r	   r   r   r  r   r   r   r   r   r   r   r   r   r   rV   r   r   s              r   r   zAsyncCaches._list  s     99O   <_Ml%))&1	**+;<;OLl%))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t\< H 'mmBHMM1JM  =mLm$$<]Km33BB'A'A'C C L &+%7%7  &L" 	%%l3's   EH5H3C%H5c                n   K   t        d| j                  | j                  |       d {   |      S 7 	wr  )r   r   r  s     r   r  zAsyncCaches.list  s8      

jjj''	  	(s   '53
5)r  r  r  r  r   r   r	  r   r   r
  r   r  r   r   r  r   r  r   r   r   r  r  r!   r   r  r  e  sd    AE	L L u<<=	L
 Ld >B	B B u99:	B
 BP AE	L L u<<=	L
 ((Ld AE	F F u<<=	F
 FR IMC D DEC''CL IM D DE%%%&r!   r  )N)<r   loggingtypingr   r   r   urllib.parser    r   r	   r
   r5   r   r   r   r   r   r   r   pagersr   r   	getLoggerloggerdictr  objectr    r(   r9   r>   rF   rH   rO   rR   rX   r[   r`   rj   rl   rn   rs   ry   r   r   r   r   r   r   r%   r8   r=   r   r   r   r   
BaseModuler   r  r  r!   r   <module>r#     sA	  $   ' ' "      & . . % 
		0	1
 /3tCH~v-.DcN+ 
#s(^& /3tCH~v-.DcN+ 
#s(^. /32tCH~v-.2DcN+2 
#s(^2n /31tCH~v-.1DcN+1 
#s(^1n /3tCH~v-. DcN+ 
#s(^	0 /3tCH~v-. DcN+ 
#s(^	0 /3tCH~v-. DcN+ 
#s(^	& /3tCH~v-. DcN+ 
#s(^	$ /3
tCH~v-.
DcN+
 
#s(^
 /3
tCH~v-.
DcN+
 
#s(^
 /3tCH~v-.DcN+ 
#s(^& /3"tCH~v-."DcN+" 
#s(^"P /3tCH~v-. DcN+ 
#s(^	& /3tCH~v-. DcN+ 
#s(^	$ /3tCH~v-.DcN+ 
#s(^  /3tCH~v-.DcN+ 
#s(^2 /3tCH~v-.DcN+ 
#s(^. /3tCH~v-.DcN+ 
#s(^. /3tCH~v-.DcN+ 
#s(^ /3
tCH~v-.
DcN+
 
#s(^
 /3tCH~v-.DcN+ 
#s(^2 /3tCH~v-.DcN+ 
#s(^2 /37tCH~v-.7DcN+7 
#s(^7x /35tCH~v-.5DcN+5 
#s(^5t /32tCH~v-.2DcN+2 
#s(^2n /3tCH~v-.DcN+ 
#s(^" /3tCH~v-.DcN+ 
#s(^$ /3tCH~v-. DcN+ 
#s(^	0 /3tCH~v-. DcN+ 
#s(^	*q[## qhw+(( wr!   