o ãÄdbã@spddlZddlmZddlmZddlmZddlZddl m Z ddl m Z m Z ddlmZGdd „d eƒZdS) éN)ÚDocumentStructure)ÚServiceDocumenter)ÚDataNotFoundError)ÚBoto3ClientDocumenter)ÚResourceDocumenterÚServiceResourceDocumenter)ÚServiceContextcsleZdZej ej ej¡d¡Z ‡fdd„Z dd„Z dd„Z dd „Z d d „Zd d „Zdd„Zdd„Z‡ZS)rÚexamplescsftƒj||j|d||_|j |¡|_d|_|j|j ¡vr&|j  |¡|_gd¢|_ ||_ d|_ dS)N)Ú service_nameÚsessionÚroot_docs_path)Útitleútable-of-contentsÚclientÚ paginatorsÚwaitersÚ resourcesr zLhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html) ÚsuperÚ__init__Ú_sessionÚ_boto3_sessionrÚ_clientÚ_service_resourceÚ _service_nameZget_available_resourcesÚresourceÚsectionsÚ_root_docs_pathÚ_USER_GUIDE_LINK)Úselfr r r ©Ú __class__©úm/private/var/folders/v1/_jykv66s6qd26_69j1njbrl80000gr/T/pip-target-p1gutpg6/lib/python/boto3/docs/service.pyrsû  ÿzServiceDocumenter.__init__cCst|j|jdd}| | d¡¡| | d¡¡| | d¡¡| | d¡¡| | d¡¡|j r<|  | d¡¡|  | d ¡¡|  ¡S) ziDocuments an entire service. :returns: The reStructured text of the documented service. Úhtml)Z section_namesÚtargetr rrrrrr ) rrrr Z get_sectionZtable_of_contentsÚ client_apiZ paginator_apiZ waiter_apirÚresource_sectionÚ_document_examplesZflush_structure)rZ doc_structurer!r!r"Údocument_service9s ÿz"ServiceDocumenter.document_servicecCsBd}z| |j¡}Wn tyYnwt|j|j|ƒ |¡dS)N)Z get_examplesrrrrrZdocument_client)rÚsectionr r!r!r"r%Ls ÿ ÿ zServiceDocumenter.client_apicCs†|j d¡|j ¡| d¡|jjd|jd| d¡|j ¡|j ¡| d¡|j ¡|j ¡| |¡| |¡dS)NZ Resourcesz—Resources are available in boto3 via the ``resource`` method. For more detailed instructions and examples on the usage of resources, see the resources z user guide)r ÚlinkÚ.zThe available resources are:) ÚstyleÚh2Únew_lineÚwriteZ external_linkrZtoctreeÚ_document_service_resourceÚ_document_resources)rr)r!r!r"r&Ws"  ÿþ       z"ServiceDocumenter.resource_sectioncCs„tddd}t|j|j|jƒ |¡|jjjj}||j krd}t j   |j|j ›|  ¡›¡}| |d¡|j |j ›d|›d¡dS)Nzservice-resourcer#©r$Úindexú/ú/index)rrrrrÚdocument_resourceÚmetaÚresource_modelÚnamerÚosÚpathÚjoinÚlowerÚ write_to_filer,Útocitem)rr)Zservice_resource_docÚ resource_nameÚservice_resource_dir_pathr!r!r"r0ms"ÿ ÿ  ý z,ServiceDocumenter._document_service_resourcec Csd}|j d¡}| |jd¡}|jjjjj}|dD]q}|d|}|jj j ||t |j|d|ddd}|jj j } g} | D]} |  |¡q>|| d|jiŽ} | jj j ¡}t|dd } t| |j|jƒ |  | jj j¡¡tj |j|j›|›¡}|  |d ¡|j |j›d |›d ¡qdS) NZfooZ data_loaderz resources-1r)r Zresource_json_definitionsÚ service_modelZservice_waiter_model)r@Zsingle_resource_json_definitionZservice_contextrr#r2r3r4r5)rZ get_componentZload_service_modelrrr7rrBrZresource_factoryZload_from_definitionrr8Ú identifiersÚappendrr9r=rrrr6Zadd_new_sectionr:r;r<r>r,r?)rr)Ztemp_identifier_valueÚloaderZjson_resource_modelrBr@r8Z resource_clsrCÚargsÚ_rZ resource_docrAr!r!r"r1‚sX ÿ  ÿúýÿ    ÿÿý ÿÛz%ServiceDocumenter._document_resourcescCstj tj |j|jd¡¡S)Nz.rst)r:r;Úrealpathr<Ú EXAMPLE_PATHr)rr!r!r"Ú_get_example_file²sÿz#ServiceDocumenter._get_example_filecCsˆ| ¡}tj |¡rB|j d¡|j ¡| d¡|j ¡|j ¡t|ƒ}| |  ¡¡WdƒdS1s;wYdSdS)NZExamplesz'.. contents:: :local: :depth: 1) rJr:r;Úisfiler,r-r.r/ÚopenÚread)rr)Z examples_fileÚfr!r!r"r'·s       "ÿúz$ServiceDocumenter._document_examples)Ú__name__Ú __module__Ú __qualname__r:r;r<ÚdirnameÚboto3Ú__file__rIrr(r%r&r0r1rJr'Ú __classcell__r!r!rr"rs  0r)r:Zbotocore.docs.bcdoc.restdocrZbotocore.docs.servicerZBaseServiceDocumenterZbotocore.exceptionsrrSZboto3.docs.clientrZboto3.docs.resourcerrZ boto3.utilsrr!r!r!r"Ús