
    C                         S SK r S SKJr  S SKJr  S SKJr  S SKJr  S SK	J
r
JrJr  S SKJr  S SKJr  S S	KJrJr  S
 r " S S5      r " S S5      r " S S5      rg)    N)
xform_name)OrderedDict)DocumentStructure)ResponseExampleDocumenter)document_custom_methoddocument_model_driven_methodget_instance_public_methods)ResponseParamsDocumenter)document_shared_examples)DocumentedShapeget_official_service_namec                     U S:w  a  g US;   $ )Ngenerate_presigned_url)s3 )method_nameservice_namekwargss      'lib/third_party/botocore/docs/client.py!_allowlist_generate_presigned_urlr      s    ..6!!    c                   x    \ rS rSr\/rSS jrS rS rS r	S r
S rS	 rS
 rS rS rS rS rS rS rS rSrg)ClientDocumenter#   Nc                     Xl         U R                   R                  R                  U l        X l        X0l        U R
                  c  0 U l        U R                   R                  R                  R                  U l	        g N)
_client	__class____name___client_class_name_root_docs_path_shared_examplesmetaservice_modelr   _service_name)selfclientroot_docs_pathshared_exampless       r   __init__ClientDocumenter.__init__(   s]    "&,,"8"8"A"A- /  ($&D!!\\..<<IIr   c                     U R                  U5        U R                  U5        U R                  5       nU R                  X5        U R	                  U5        g)zMDocuments a client and its methods

:param section: The section to write to.
N)
_add_title_add_class_signature_get_client_methods_add_client_intro_add_client_methods)r&   sectionclient_methodss      r   document_client ClientDocumenter.document_client1   sH    
 	 !!'*113w7  0r   c                 N    [        U R                  5      nU R                  U5      $ r   )r	   r   _filter_client_methods)r&   r3   s     r   r/   $ClientDocumenter._get_client_methods<   s!    4T\\B**>::r   c                     0 nUR                  5        H-  u  p4U R                  UUU R                  S9nU(       d  M)  XBU'   M/     U$ )N)methodr   r   )items_filter_client_methodr%   )r&   r3   filtered_methodsr   r:   includes         r   r7   'ClientDocumenter._filter_client_methods@   sY    #1#7#7#9K00'!// 1 G
 w06- $:  r   c                 H    U R                    H  nU" S0 UD6nUc  M  Us  $    g)NTr   )_CLIENT_METHODS_FILTERS)r&   r   filterfilter_includes       r   r<   &ClientDocumenter._filter_client_methodL   s0    22F#-f-N)%%	 3 r   c                 :    UR                   R                  S5        g )NClientstyleh2r&   r2   s     r   r-   ClientDocumenter._add_titleV   s    "r   c                    UR                  S5      n[        U R                  R                  R                  5      nUR                  SU 35        UR                  R                  5         UR                  U R                  R                  R                  R                  5        U R                  U5        UR                  R                  5         UR                  R                  5         UR                  S5        UR                  R                  5         [        U5       H-  nUR                  R!                  U R"                   SU 35        M/     g )Nintroz A low-level client representing z These are the available methods:z/client/)add_new_sectionr   r   r#   r$   writerH   new_lineinclude_doc_stringdocumentation_add_client_creation_examplededentnew_paragraphwritelntoctreesortedtocitemr%   )r&   r2   r3   official_service_namer   s        r   r0   "ClientDocumenter._add_client_introY   s   ))'2 9LL++!
 	./D.EF	
 	 ""LL++99	

 	))'2 	##%:;!.1KMM!!T%7%7$8"NO 2r   c                 P    UR                   R                  U R                   S3S9  g )Nz.Client
class_name)rH   start_sphinx_py_classr    rJ   s     r   r.   %ClientDocumenter._add_class_signaturer   s*    ++112': 	, 	
r   c                     UR                   R                  5         UR                   R                  5         UR                  SR	                  U R
                  S95        UR                   R                  5         g )Nz+client = session.create_client('{service}'))service)rH   start_codeblockrP   rO   formatr%   end_codeblockrJ   s     r   rS   -ClientDocumenter._add_client_creation_examplew   s]    %%' ;BB** C 	

 	##%r   c                     [        U5       Hg  n[        USS9nU R                  X2X   5        [        R                  R                  U R                  U R                  S5      nUR                  XB5        Mi     g )Nhtmltargetr'   )	rX   r   _add_client_methodospathjoinr!   r%   write_to_file)r&   r3   r   method_doc_structureclient_dir_paths        r   r1   $ClientDocumenter._add_client_methods   sp    !.1K#4F$  ##$>3N
 !ggll$$d&8&8(O !..L 2r   c                    UR                  S5      nUR                  R                  U R                  SU R                   35        UR                  SU 35        UR                  U5        UR                  USU R                   S30S9nU R                  U5      (       a  U R                  UUU5        g U R                  XR5        g )N
breadcrumbz../../z / Client / 	qualifierz.Client.)context)
rN   rH   refr    r%   rO   add_title_section_is_custom_method_add_custom_method_add_model_driven_method)r&   r2   r   r:   breadcrumb_sectionmethod_sections         r   rk   #ClientDocumenter._add_client_method   s    $44\B  $$##vd.@.@-A%B	
 	  <}!=>!!+. 00 T%<%<$=X"FG 1 
 !!+..## )).Fr   c                 F    XR                   R                  R                  ;  $ r   )r   r#   method_to_api_mapping)r&   r   s     r   ry   "ClientDocumenter._is_custom_method   s    ,,"3"3"I"IIIr   c                     [        XU5        g r   )r   )r&   r2   r   r:   s       r   rz   #ClientDocumenter._add_custom_method   s    wV<r   c                 \   UR                  S5      nUR                  R                  5         UR                  R                  S5        UR                  R                  5         UR                   H<  nU R
                   SUR                   3nUR                  R                  SU-  5        M>     g )N
exceptions
Exceptions.Client.exceptions.z:py:class:`%s`)rN   rH   rP   bolderror_shapesr    nameli)r&   r2   operation_modelerror_sectionerrorr^   s         r   _add_method_exceptions_list,ClientDocumenter._add_method_exceptions_list   s    //=$$&  .$$&$11E**++>uzzlK  ""#3j#@A	 2r   c           	         U R                   R                  R                  nU R                   R                  R                  U   nUR	                  U5      nSU-  nUR
                  R                  SS5       U 3n[        UUUU R                   R                  R                  UR                  US9  UR                  (       a  U R                  X5        U R                  R                  U5      nU(       a  [        XXh5        g g )Nzresponse = client.%sru    )event_emittermethod_descriptionexample_prefix)r   r#   r$   r   r   rv   getr   eventsrR   r   r   r"   r   )	r&   r2   r   r$   operation_namer   r   full_method_namer)   s	            r   r{   )ClientDocumenter._add_model_driven_method   s    ))77**@@M'77G/+="";34[MB 	 	%,,++22.<<)	
 '',,WF //33NC$. r   )r   r    r!   r%   r"   r   )r   
__module____qualname____firstlineno__r   rA   r*   r4   r/   r7   r<   r-   r0   r.   rS   r1   rk   ry   rz   r   r{   __static_attributes__r   r   r   r   r   #   s^    )J	1;
 #P2

&M G(J=	Br   r   c                       \ rS rSrSr\" SSS\" S\" SSSS	94S
\" S
SSS	94/5      S9rS rS r	S r
S rS rS rS rS rS rS rS rS rS rS rSrg)ClientExceptionsDocumenter   zQhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/error-handling.htmlError	structurez1Normalized access to common exception attributes.Codestringz,An identifier specifying the exception type.)r   	type_namerR   Messagez;A descriptive message explaining why the exception occured.)r   r   rR   membersc                     Xl         U R                   R                  R                  U l        U R                   R                  R
                  R                  U l        X l        g r   )	r   r   r   r    r#   r$   r   r%   r!   )r&   r'   r(   s      r   r*   #ClientExceptionsDocumenter.__init__   sC    "&,,"8"8"A"A!\\..<<II-r   c                     U R                  U5        U R                  U5        U R                  U5        U R                  5         g r   )r-   _add_overview_add_exceptions_list_add_exception_classesrJ   s     r   document_exceptions.ClientExceptionsDocumenter.document_exceptions   s6     7#!!'*##%r   c                 :    UR                   R                  S5        g )NzClient ExceptionsrG   rJ   s     r   r-   %ClientExceptionsDocumenter._add_title  s    ,-r   c                     UR                   R                  5         UR                  S5        UR                   R                  SU R                  S9  UR                  S5        UR                   R                  5         g )NzClient exceptions are available on a client instance via the ``exceptions`` property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling z
user guidetitlelink.)rH   rP   rO   external_link_USER_GUIDE_LINKrJ   s     r   r   (ClientExceptionsDocumenter._add_overview  sf     	
 	##&& 	$ 	
 	c r   c                 8    U R                    SUR                   3$ )Nr   )r    r   )r&   shapes     r   _exception_class_name0ClientExceptionsDocumenter._exception_class_name  s    ))**=ejj\JJr   c                    U R                   R                  R                  R                  nU(       dF  UR                  R                  5         UR                  S5        UR                  R                  5         g UR                  R                  5         UR                  S5        UR                  R                  5         U H7  nUR                  R                  U R                   SUR                   35        M9     g )Nz-This client has no modeled exception classes.z$The available client exceptions are:z/client/exceptions/)r   r#   r$   r   rH   rP   rO   rV   rW   rY   r%   r   )r&   r2   r   r   s       r   r   /ClientExceptionsDocumenter._add_exceptions_list  s    ||((66CCMM""$MMIJMM""$ >?!EMM!!%%&&9%**F "r   c                 R   U R                   R                  R                  R                   Hy  n[	        UR
                  SS9nU R                  X!5        [        R                  R                  U R                  U R                  SS5      nUR                  X1R
                  5        M{     g )Nrh   ri   r'   r   )r   r#   r$   r   r   r   _add_exception_classrl   rm   rn   r!   r%   ro   )r&   r   exception_doc_structureexception_dir_paths       r   r   1ClientExceptionsDocumenter._add_exception_classes(  s    \\&&44AAE&7

6'# %%&=E "$$$""	" $11"JJ Br   c                 "   UR                  S5      nUR                  R                  U R                  SU R                   35        UR                  SUR                   35        UR                  UR                  5        UR                  UR                  5      nU R                  U5      nUR                  R                  US9  U R                  XB5        U R                  XB5        U R                  XB5        UR                  R                  5         g )Nrt   z	../../../z / Client / exceptions / r]   )rN   rH   rw   r    r%   rO   r   rx   r   r_   _add_top_level_documentation_add_exception_catch_example_add_response_attrend_sphinx_py_class)r&   r2   r   r|   class_sectionr^   s         r   r   /ClientExceptionsDocumenter._add_exception_class;  s    $44\B  $$##y1C1C0D%E	
 	  #<UZZL!IJ!!%**-//

;//6
11Z1H))-?))-?5//1r   c                     UR                   (       aP  UR                  R                  5         UR                  UR                   5        UR                  R                  5         g g r   )rR   rH   rP   rQ   r&   r2   r   s      r   r   7ClientExceptionsDocumenter._add_top_level_documentationJ  sD    MM""$&&u':':;MM""$ r   c                    UR                   R                  5         UR                   R                  S5        UR                   R                  5         UR                   R	                  5         UR                  S5        UR                   R                  5         UR                   R                  5         UR                  S5        UR                   R                  5         UR                   R                  5         UR                  SUR                  -  5        UR                   R                  5         UR                   R                  5         UR                  S5        UR                   R                  5         UR                   R                  5         g )NExampleztry:z...z!except client.exceptions.%s as e:zprint(e.response))
rH   rP   r   rU   rc   rO   indentrT   r   re   r   s      r   r   7ClientExceptionsDocumenter._add_exception_catch_exampleP  s     9%##%%%'f e 9EJJFG )*##%r   c                     UR                  S5      nUR                  R                  S5        U R                  U5        U R	                  X25        U R                  X25        UR                  R                  5         g )Nresponse)rN   rH   start_sphinx_py_attr_add_response_attr_description_add_response_example_add_response_paramsend_sphinx_py_attr)r&   r2   r   response_sections       r   r   -ClientExceptionsDocumenter._add_response_attrb  sf    "22:>33J?++,<=""#3;!!"2:113r   c                     UR                   R                  5         UR                  S5        UR                   R                  5         g )NzThe parsed error response. All exceptions have a top level ``Error`` key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.)rH   rP   rQ   rJ   s     r   r   9ClientExceptionsDocumenter._add_response_attr_descriptionj  s7     ""*	
 	 r   c                 b   UR                  S5      nUR                  R                  5         UR                  R                  S5        UR                  R	                  5         [        U R                  S U R                  R                  R                  S9nUR                  UUU R                  /S9  g )NsyntaxSyntaxr   r   r   r>   )rN   rH   rP   r   rU   r   r%   r   r#   r   document_example_GENERIC_ERROR_SHAPE)r&   r2   r   example_section
documenters        r   r   0ClientExceptionsDocumenter._add_response_examplet  s    !11(;&&(""8,++-.++,,++22


 	##../ 	$ 	
r   c                 b   UR                  S5      nUR                  R                  5         UR                  R                  S5        UR                  R	                  5         [        U R                  S U R                  R                  R                  S9nUR                  UUU R                  /S9  g )N	Structurer   r   )rN   rH   rP   r   rU   r
   r%   r   r#   r   document_paramsr   )r&   r2   r   params_sectionr   s        r   r   /ClientExceptionsDocumenter._add_response_params  s     00=%%'!!+.**,-++,,++22


 	""../ 	# 	
r   )r   r    r!   r%   N)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   r   r      s    	@  +J ##"*J		 #&"*'	

	>.&.!K&2%&$4!
 
r   r   c                   @    \ rS rSrSrSSS.rS rS rS rS	 r	S
 r
Srg)ClientContextParamsDocumenteri  zPhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html)
AccelerateDisableMultiRegionAccessPointsForcePathStyleUseArnRegion)r   )r   	s3controlc                     Xl         X l        g r   )r%   _context_params)r&   r   context_paramss      r   r*   &ClientContextParamsDocumenter.__init__  s    )-r   c                 j    U R                  U5        U R                  U5        U R                  U5        g r   )r-   r   _add_context_params_listrJ   s     r   document_context_params5ClientContextParamsDocumenter.document_context_params  s*     7#%%g.r   c                 :    UR                   R                  S5        g )NzClient Context ParametersrG   rJ   s     r   r-   (ClientContextParamsDocumenter._add_title  s    45r   c                     UR                   R                  5         UR                  S5        UR                   R                  SU R                  S9  UR                  S5        UR                   R                  5         g )NzClient context parameters are configurable on a client instance via the ``client_context_params`` parameter in the ``Config`` object. For more detailed instructions and examples on the exact usage of context params see the zconfiguration guider   r   )rH   rP   rO   r   _CONFIG_GUIDE_LINKrJ   s     r   r   +ClientContextParamsDocumenter._add_overview  sf     <	
 	##'(( 	$ 	
 	c r   c           	      j   UR                   R                  5         SU R                   S3nUR                  SU S35        U R                   Hd  nUR                   R                  5         S[        UR                  5       S3nUR                  SU SUR                   SUR                   35        Mf     g )Nz``zThe available z client context params are:z* z (z) - )
rH   rP   r%   rV   r   r   r   rO   typerR   )r&   r2   snparamr   s        r   r   6ClientContextParamsDocumenter._add_context_params_list  s     $$$%R(.,GHI))EMM""$
5::./r2DMMBtfBuzzl$u7J7J6KLM *r   )r   r%   N)r   r   r   r   r   OMITTED_CONTEXT_PARAMSr*   r   r-   r   r   r   r   r   r   r   r     s8    	? 
 './
6!Nr   r   )rl   botocorer   botocore.compatr   botocore.docs.bcdoc.restdocr   botocore.docs.exampler   botocore.docs.methodr   r   r	   botocore.docs.paramsr
   botocore.docs.sharedexampler   botocore.docs.utilsr   r   r   r   r   r   r   r   r   <module>r     sV    
  ' 9 ; 
 : @ J"n nb~
 ~
B2N 2Nr   