o
    pkjb                     @   s	  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dZ	d`deeeef ef deeeef  deeef fddZ	d`deeeef ef deeeef  deeef fddZ	d`deeeef ef deeeef  deeef fddZ	d`deeeef ef deeeef  deeef fddZ	d`deeeef ef deeeef  deeef fddZ 	d`deeeef ef deeeef  deeef fddZ!	d`deeeef ef deeeef  deeef fddZ"	d`dedeeeef ef deeeef  deeef fd d!Z#	d`dedeeeef ef deeeef  deeef fd"d#Z$	d`dedeeeef ef deeeef  deeef fd$d%Z%	d`dedeeeef ef deeeef  deeef fd&d'Z&	d`deeeef ef deeeef  deeef fd(d)Z'	d`deeeef ef deeeef  deeef fd*d+Z(	d`deeeef ef deeeef  deeef fd,d-Z)	d`deeeef ef deeeef  deeef fd.d/Z*	d`deeeef ef deeeef  deeef fd0d1Z+	d`dedeeeef ef deeeef  deeef fd2d3Z,	d`dedeeeef ef deeeef  deeef fd4d5Z-	d`deeeef ef deeeef  deeef fd6d7Z.	d`deeeef ef deeeef  deeef fd8d9Z/	d`deeeef ef deeeef  deeef fd:d;Z0	d`deeeef ef deeeef  deeef fd<d=Z1	d`deeeef ef deeeef  deeef fd>d?Z2	d`deeeef ef deeeef  deeef fd@dAZ3	d`deeeef ef deeeef  deeef fdBdCZ4	d`deeeef ef deeeef  deeef fdDdEZ5	d`deeeef ef deeeef  deeef fdFdGZ6	d`deeeef ef deeeef  deeef fdHdIZ7	d`deeeef ef deeeef  deeef fdJdKZ8	d`deeeef ef deeeef  deeef fdLdMZ9	d`deeeef ef deeeef  deeef fdNdOZ:	d`deeeef ef deeeef  deeef fdPdQZ;	d`deeeef ef deeeef  deeef fdRdSZ<	d`deeeef ef deeeef  deeef fdTdUZ=	d`deeeef ef deeeef  deeef fdVdWZ>	d`dedeeeef ef deeeef  deeef fdXdYZ?	d`dedeeeef ef deeeef  deeef fdZd[Z@G d\d] d]e	jAZBG d^d_ d_e	jAZCdS )a    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                 C   s   i }t | dgd urt|dgt | dg t | dgd ur!tdt | dgd ur-tdt | dgd ur9tdt | d	gd urEtd
t | dgd urQtdt | dgd ur]td|S )Napi_keyapiKeyapi_key_configzvapi_key_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.	auth_typezqauth_type parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.google_service_account_configzgoogle_service_account_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.http_basic_auth_configz~http_basic_auth_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.oauth_configztoauth_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.oidc_configzsoidc_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.getvsetv
ValueErrorr   r   	to_object r!   Q/home/djax/ivt_ai_plugin/venv/lib/python3.10/site-packages/google/genai/caches.py_AuthConfig_to_mldev#   s8   r#   c                 C   sl   i }t | dgd urt|dgt | dg t | dgd ur!tdt | dgd ur4t|dgt | dg |S )Ndatadisplay_nametdisplay_name parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.	mime_typemimeTyper   r   r!   r!   r"   _Blob_to_mldevR   s   r)   c                 C   s   i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urGtd|S )Nenvironmentexcluded_predefined_functionsexcludedPredefinedFunctions!enable_prompt_injection_detectionenablePromptInjectionDetectiondisabled_safety_policieszdisabled_safety_policies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r   r!   r!   r"   _ComputerUse_to_vertexf   s(   

r0   c                    b   i  t | dgd urt dg fddt | dgD  t | dgd ur/t dgt | dg  S )Npartsc                       g | ]}t | qS r!   )_Part_to_mldev.0itemr    r!   r"   
<listcomp>       z%_Content_to_mldev.<locals>.<listcomp>roler   r   r   r   r!   r8   r"   _Content_to_mldev      

	r>   c                    r1   )Nr2   c                    r3   r!   )_Part_to_vertexr5   r8   r!   r"   r9      r:   z&_Content_to_vertex.<locals>.<listcomp>r;   r<   r=   r!   r8   r"   _Content_to_vertex   r?   rA   c              	      s^  i  t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urXt|dg fddtt | dgD  t | d	gd urqt|d
gttt | d	g  t | dgd urt|dg fddt | dgD  t | dgd urt|dgtt | dg  t | dgd urtd S )Nttlexpire_time
expireTimer%   displayNamecontentsc                    r3   r!   )r>   r5   r8   r!   r"   r9      r:   z7_CreateCachedContentConfig_to_mldev.<locals>.<listcomp>system_instructionsystemInstructiontoolsc                    r3   r!   )_Tool_to_mldevr5   r8   r!   r"   r9      r:   tool_config
toolConfigkms_key_nameztkms_key_name parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.)r   r   t
t_contentsr>   	t_content_ToolConfig_to_mldevr   r=   r!   r8   r"   #_CreateCachedContentConfig_to_mldev   sT   
	

	rR   c              	      sn  i  t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urXt|dg fddtt | dgD  t | d	gd urqt|d
gttt | d	g  t | dgd urt|dg fddt | dgD  t | dgd urt|dgtt | dg  t | dgd urt|ddgt | dg  S )NrB   rC   rD   r%   rE   rF   c                    r3   r!   )rA   r5   r8   r!   r"   r9      r:   z8_CreateCachedContentConfig_to_vertex.<locals>.<listcomp>rG   rH   rI   c                    r3   r!   )_Tool_to_vertexr5   r8   r!   r"   r9     r:   rK   rL   rM   encryption_spec
kmsKeyName)r   r   rN   rO   rA   rP   _ToolConfig_to_vertexr=   r!   r8   r"   $_CreateCachedContentConfig_to_vertex   sX   
	

	
rW   
api_clientc              	   C   X   i }t |dgd urt|dgt| t |dg t |dgd ur*tt |dg| |S Nmodelconfig)r   r   rN   t_caches_modelrR   rX   r   r   r    r!   r!   r"   '_CreateCachedContentParameters_to_mldev(     r_   c              	   C   rY   rZ   )r   r   rN   r]   rW   r^   r!   r!   r"   (_CreateCachedContentParameters_to_vertex=  r`   ra   c              	   C   8   i }t |dgd urt|ddgt| t |dg |S Nname_urlr   r   rN   t_cached_content_namer^   r!   r!   r"   '_DeleteCachedContentParameters_to_mldevR     rh   c              	   C   rb   rc   rf   r^   r!   r!   r"   (_DeleteCachedContentParameters_to_vertexb  ri   rj   c                 C   .   i }t | dgd urt|dgt | dg |S NsdkHttpResponsesdk_http_responser<   r   r!   r!   r"   '_DeleteCachedContentResponse_from_mldevr     ro   c                 C   rk   rl   r<   r   r!   r!   r"   (_DeleteCachedContentResponse_from_vertex  rp   rq   c                 C   sl   i }t | dgd urtdt | dgd ur!t|dgt | dg t | dgd ur4t|dgt | dg |S )Nr%   r&   file_urifileUrir'   r(   )r   r   r   r   r!   r!   r"   _FileData_to_mldev  s   rt   c                 C   s   i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urGtdt | dgd urStd|S )Nidargsrd   partial_argsztpartial_args parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.will_continuezuwill_continue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r   r!   r!   r"   _FunctionCall_to_mldev  s    ry   c                 C   sl   i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur4td|S )Nallowed_function_namesallowedFunctionNamesmodestream_function_call_argumentszstream_function_call_arguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r   r!   r!   r"   _FunctionCallingConfig_to_mldev  s   
r~   c              	   C   rb   rc   rf   r^   r!   r!   r"   $_GetCachedContentParameters_to_mldev  ri   r   c              	   C   rb   rc   rf   r^   r!   r!   r"   %_GetCachedContentParameters_to_vertex  ri   r   c                 C   sr   i }t | dgd urt|dgtt | dg| t | dgd ur+t|dgt | dg t | dgd ur7td|S )Nauth_config
authConfigenable_widgetenableWidgetgrounding_typeszwgrounding_types parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.)r   r   r#   r   r   r!   r!   r"   _GoogleMaps_to_mldev  s   r   c                 C   s   i }t | dgd urt|dgt | dg t | dgd ur!tdt | dgd ur-tdt | dgd ur@t|dgt | dg |S )	Nsearch_typessearchTypesblocking_confidencez{blocking_confidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.exclude_domainszwexclude_domains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.time_range_filtertimeRangeFilterr   r   r!   r!   r"   _GoogleSearch_to_mldev  s    r   c                 C   X   i }t | dgd urt|ddgt | dg t | dgd ur*t|ddgt | dg |S N	page_size_querypageSize
page_token	pageTokenr<   r   r!   r!   r"   "_ListCachedContentsConfig_to_mldev)     
r   c                 C   r   r   r<   r   r!   r!   r"   #_ListCachedContentsConfig_to_vertex>  r   r   c                 C   *   i }t | dgd urtt | dg| |S Nr\   )r   r   r   r!   r!   r"   &_ListCachedContentsParameters_to_mldevS  s   r   c                 C   r   r   )r   r   r   r!   r!   r"   '_ListCachedContentsParameters_to_vertex^  s   r   c                 C      i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur@t|dgdd t | dgD  |S )	Nrm   rn   nextPageTokennext_page_tokencachedContentscached_contentsc                 S      g | ]}|qS r!   r!   r5   r!   r!   r"   r9   |      z:_ListCachedContentsResponse_from_mldev.<locals>.<listcomp>r<   r   r!   r!   r"   &_ListCachedContentsResponse_from_mldevk     r   c                 C   r   )	Nrm   rn   r   r   r   r   c                 S   r   r!   r!   r5   r!   r!   r"   r9     r   z;_ListCachedContentsResponse_from_vertex.<locals>.<listcomp>r<   r   r!   r!   r"   '_ListCachedContentsResponse_from_vertex  r   r   c                 C   s8   i }t | dgd urtdt | dgd urtd|S )Nrd   zlname parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.streamable_http_transportzstreamable_http_transport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.)r   r   r   r!   r!   r"   _McpServer_to_vertex  s   r   c                 C   s  i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urQt|dgtt | dg| t | d	gd urgt|d
gtt | d	g| t | dgd urzt|dgt | dg t | dgd urt|dgtt | dg| t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd ur+t|dgt | dg t | dgd ur?t|dgt | dg |S )Nmedia_resolutionmediaResolutioncode_execution_resultcodeExecutionResultexecutable_codeexecutableCode	file_datafileDatafunction_callfunctionCallfunction_responsefunctionResponseinline_data
inlineDatatextthoughtthought_signaturethoughtSignaturevideo_metadatavideoMetadata	tool_calltoolCalltool_responsetoolResponsepart_metadatapartMetadataaudio_transcriptionaudioTranscriptionmedia_processingmediaProcessing)r   r   rt   ry   r)   r   r!   r!   r"   r4     s   



r4   c                 C   sB  i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urNt|dgt | dg t | d	gd urat|d
gt | d	g t | dgd urtt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urtdt | dgd urtdt | dgd urtdt | dgd urt|dgt | dg t | dgd urt|dgt | dg |S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   zqtool_call parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   zutool_response parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   zupart_metadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r   r   r   r   r   r!   r!   r"   r@     sx   



r@   c                 C   s   i }t | dgd urt|dgt | dg t | dgd ur+t|dgtt | dg| t | dgd ur>t|dgt | dg |S )Nretrieval_configretrievalConfigfunction_calling_configfunctionCallingConfig$include_server_side_tool_invocations includeServerSideToolInvocations)r   r   r~   r   r!   r!   r"   rQ   Z  s(   
rQ   c                 C   sl   i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur4td|S )Nr   r   r   r   r   zinclude_server_side_tool_invocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r   r!   r!   r"   rV   w  s    
rV   c                 C   s  i }t | dgd urtdt | dgd ur!t|dgt | dg t | dgd ur4t|dgt | dg t | dgd urJt|dgtt | dg| t | d	gd ur`t|d
gtt | d	g| t | dgd urst|dgt | dg t | dgd urtdt | dgd urt|dgdd t | dgD  t | dgd urt|dgt | dg t | dgd urtdt | dgd urt|dgt | dg t | dgd urt|dgdd t | dgD  t | dgd urtd|S )N	retrievalzqretrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.computer_usecomputerUsefile_search
fileSearchgoogle_searchgoogleSearchgoogle_maps
googleMapscode_executioncodeExecutionenterprise_web_searchz}enterprise_web_search parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.function_declarationsfunctionDeclarationsc                 S   r   r!   r!   r5   r!   r!   r"   r9     r   z"_Tool_to_mldev.<locals>.<listcomp>google_search_retrievalgoogleSearchRetrievalparallel_ai_searchzzparallel_ai_search parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.url_context
urlContextmcp_servers
mcpServersc                 S   r   r!   r!   r5   r!   r!   r"   r9     r   exa_ai_searchzuexa_ai_search parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.)r   r   r   r   r   r   r!   r!   r"   rJ     sp   
rJ   c                    s  i  t | dgd urt dgt | dg t | dgd ur+t dgtt | dg  t | dgd ur7tdt | dgd urJt dgt | dg t | dgd ur]t d	gt | dg t | d
gd urpt dgt | d
g t | dgd urt dgt | dg t | dgd urt dgdd t | dgD  t | dgd urt dgt | dg t | dgd urt dgt | dg t | dgd urt dgt | dg t | dgd urt dg fddt | dgD  t | dgd urt dgt | dg  S )Nr   r   r   r   zsfile_search parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r   r   r   r   r   r   enterpriseWebSearchr   r   c                 S   r   r!   r!   r5   r!   r!   r"   r9   
  r   z#_Tool_to_vertex.<locals>.<listcomp>r   r   r   parallelAiSearchr   r   r   r   c                    r3   r!   )r   r5   r8   r!   r"   r9   "  r:   r   exaAiSearch)r   r   r0   r   r=   r!   r8   r"   rS     sp   




	rS   c                 C   T   i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg |S NrB   rC   rD   r<   r   r!   r!   r"   #_UpdateCachedContentConfig_to_mldev.     r   c                 C   r   r   r<   r   r!   r!   r"   $_UpdateCachedContentConfig_to_vertex=  r   r   c              	   C   Z   i }t |dgd urt|ddgt| t |dg t |dgd ur+tt |dg| |S Nrd   re   r\   )r   r   rN   rg   r   r^   r!   r!   r"   '_UpdateCachedContentParameters_to_mldevL     r   c              	   C   r   r   )r   r   rN   rg   r   r^   r!   r!   r"   (_UpdateCachedContentParameters_to_vertexa  r   r   c                   @      e Zd Zdddedeej dejfddZdddedeej	 dejfd	d
Z
dddedeej dejfddZdddedeej dejfddZdddeej dejfddZdddeej deej fddZdS )CachesNr\   r[   r\   r   c             	   C   P  t j||d}| jjr!t| j|}|d}|rd|}nd}nt| j|}|d}|r4d|}nd}|d}|rF| dt| }|	dd d}|j
dur]|j
jdur]|j
j}t|}t|}| jd|||}	|	jsui nt|	j}
t jj|
t|ddrdt|j
d	dt|j
d
dt|j
dddini d}| 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',
          },
      )
    r[   r\   re   r   r   ?r\   Npostresponse_schemaresponse_json_schemainclude_all_fieldsr   r   r   responsekwargs)r
   _CreateCachedContentParameters_api_clientvertexaira   get
format_mapr_   r   popr\   http_optionsr   convert_to_dictencode_unserializable_typesrequestbodyjsonloadsCachedContent_from_responsegetattr_verify_responseselfr[   r\   parameter_modelrequest_dictrequest_url_dictpathquery_paramsr  r   response_dictreturn_valuer!   r!   r"   createx  sj   






zCaches.createrd   c             	   C   r   )zGets cached content configurations.

    .. code-block:: python

      client.caches.get(name= ... ) // The server-generated resource name.
    rd   r\   re   {name}r   r   r\   Nr   r   r   r   r   r   )r
   _GetCachedContentParametersr   r   r   r   r  r   r   r  r\   r  r   r  r  r  r  r  r	  r
  r  r  r  r  rd   r\   r  r  r  r  r  r  r   r  r  r!   r!   r"   r     sf   






z
Caches.getc             	   C   s  t j||d}| jjr!t| j|}|d}|rd|}nd}nt| j|}|d}|r4d|}nd}|d}|rF| dt| }|	dd d}|j
dur]|j
jdur]|j
j}t|}t|}| jd|||}	|	jsui nt|	j}
| jjrt|
}
| jjst|
}
t jj|
t|ddrdt|j
d	dt|j
d
dt|j
dddini d}t j|	jd|_| j| |S )zDeletes cached content.

    Usage:

    .. code-block:: python

      client.caches.delete(name= ... ) // The server-generated resource name.
    r  re   r  r   r   r\   Ndeleter   r   r   r   r   headers)r
   _DeleteCachedContentParametersr   r   rj   r   r  rh   r   r  r\   r  r   r  r  r  r  r  r	  rq   ro   DeleteCachedContentResponser  r  HttpResponser  rn   r  r  r!   r!   r"   r  %  sx   






zCaches.deletec             	   C   r   )zUpdates cached content configurations.

    .. code-block:: python

      response = client.caches.update(
          name= ... // The server-generated resource name.
          config={
              'ttl': '7600s',
          },
      )
    r  re   r  r   r   r\   Npatchr   r   r   r   r   )r
   _UpdateCachedContentParametersr   r   r   r   r  r   r   r  r\   r  r   r  r  r  r  r  r	  r
  r  r  r  r  r!   r!   r"   update  sj   






zCaches.updatec             	   C   sv  t j|d}| jjrt|}|d}|rd|}nd}nt|}|d}|r/d|}nd}|d}|rA| dt| }|	dd  d }|j
d urX|j
jd urX|j
j}t|}t|}| jd|||}|jspi nt|j}	| jjr~t|	}	| jjst|	}	t jj|	t|dd rdt|j
dd t|j
d	d t|j
d
d dini d}
t j|jd|
_| j|
 |
S Nr   re   r   r   r   r\   r   r   r   r   r   r   r  )r
   _ListCachedContentsParametersr   r   r   r   r  r   r   r  r\   r  r   r  r  r  r  r  r	  r   r   ListCachedContentsResponser  r  r!  r  rn   r  r  r\   r  r  r  r  r  r  r   r  r  r!   r!   r"   _list  sj   






zCaches._listc                C   s   | j }td|| j |d|S )a  Lists cached contents.

    Args:
      config (ListCachedContentsConfig): Optional configuration for the list
        request.

    Returns:
      A Pager object that contains one page of cached contents. When iterating
      over
      the pager, it automatically fetches the next page if there are more.

    Usage:

    .. code-block:: python
      for cached_content in client.caches.list():
        print(cached_content.name)
    r   r   )r)  r   r  r\   list_requestr!   r!   r"   list!  s   
zCaches.list)__name__
__module____qualname__strr   r
   CreateCachedContentConfigOrDictr
  r  GetCachedContentConfigOrDictr   DeleteCachedContentConfigOrDictr   r  UpdateCachedContentConfigOrDictr$  ListCachedContentsConfigOrDictr'  r)  r   r,  r!   r!   r!   r"   r   v  sZ    
a
T
`
X
Jr   c                   @   r   )AsyncCachesNr   r[   r\   r   c             	      X  t j||d}| jjr"t| j|}|d}|rd|}nd}nt| j|}|d}|r5d|}nd}|d}|rG| dt| }|	dd d}|j
dur^|j
jdur^|j
j}t|}t|}| jd|||I dH }	|	jsyi nt|	j}
t jj|
t|ddrdt|j
d	dt|j
d
dt|j
dddini d}| j| |S )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   re   r   r   r   r\   Nr   r   r   r   r   r   )r
   r   r   r   ra   r   r  r_   r   r  r\   r  r   r  r  async_requestr  r  r	  r
  r  r  r  r  r!   r!   r"   r  A  sl   







zAsyncCaches.createrd   c             	      r7  )zGets cached content configurations.

    .. code-block:: python

      await client.aio.caches.get(name= ... ) // The server-generated resource
      name.
    r  re   r  r   r   r\   Nr   r   r   r   r   r   )r
   r  r   r   r   r   r  r   r   r  r\   r  r   r  r  r8  r  r  r	  r
  r  r  r  r  r!   r!   r"   r     sl   







zAsyncCaches.getc             	      s  t j||d}| jjr"t| j|}|d}|rd|}nd}nt| j|}|d}|r5d|}nd}|d}|rG| dt| }|	dd d}|j
dur^|j
jdur^|j
j}t|}t|}| jd|||I dH }	|	jsyi nt|	j}
| jjrt|
}
| jjst|
}
t jj|
t|ddrdt|j
d	dt|j
d
dt|j
dddini d}t j|	jd|_| j| |S )zDeletes cached content.

    Usage:

    .. code-block:: python

      await client.aio.caches.delete(name= ... ) // The server-generated
      resource name.
    r  re   r  r   r   r\   Nr  r   r   r   r   r   r  )r
   r  r   r   rj   r   r  rh   r   r  r\   r  r   r  r  r8  r  r  r	  rq   ro   r   r  r  r!  r  rn   r  r  r!   r!   r"   r    sz   







zAsyncCaches.deletec             	      r7  )zUpdates cached content configurations.

    .. code-block:: python

      response = await client.aio.caches.update(
          name= ... // The server-generated resource name.
          config={
              'ttl': '7600s',
          },
      )
    r  re   r  r   r   r\   Nr"  r   r   r   r   r   )r
   r#  r   r   r   r   r  r   r   r  r\   r  r   r  r  r8  r  r  r	  r
  r  r  r  r  r!   r!   r"   r$  N  sl   







zAsyncCaches.updatec             	      s~  t j|d}| jjrt|}|d}|rd|}nd}nt|}|d}|r0d|}nd}|d}|rB| dt| }|	dd  d }|j
d urY|j
jd urY|j
j}t|}t|}| jd|||I d H }|jsti nt|j}	| jjrt|	}	| jjst|	}	t jj|	t|dd rdt|j
dd t|j
d	d t|j
d
d dini d}
t j|jd|
_| j|
 |
S r%  )r
   r&  r   r   r   r   r  r   r   r  r\   r  r   r  r  r8  r  r  r	  r   r   r'  r  r  r!  r  rn   r  r(  r!   r!   r"   r)    sp   







zAsyncCaches._listc                   s$   | j }td|| j |dI dH |S )a  Lists cached contents asynchronously.

    Args:
      config (ListCachedContentsConfig): Optional configuration for the list
        request.

    Returns:
      A Pager object that contains one page of cached contents. When iterating
      over
      the pager, it automatically fetches the next page if there are more.

    Usage:

    .. code-block:: python
      async for cached_content in await client.aio.caches.list():
        print(cached_content.name)
    r   r   N)r)  r   r*  r!   r!   r"   r,    s   zAsyncCaches.list)r-  r.  r/  r0  r   r
   r1  r
  r  r2  r   r3  r   r  r4  r$  r5  r'  r)  r   r,  r!   r!   r!   r"   r6  ?  sZ    
a
W
a
X
Lr6  )N)Dr  loggingtypingr   r   r   urllib.parser    r   r   r	   rN   r
   r   r   r   r   r   r   pagersr   r   	getLoggerloggerdictr0  objectr#   r)   r0   r>   rA   rR   rW   r_   ra   rh   rj   ro   rq   rt   ry   r~   r   r   r   r   r   r   r   r   r   r   r   r4   r@   rQ   rV   rJ   rS   r   r   r   r   
BaseModuler   r6  r!   r!   r!   r"   <module>   s  


1



!





>

@









































Z

W





Q

O







   L