o ãÄdá7ã@s¸ddlZddlmZddlmZddlmZddlmZddl m Z m Z m Z ddl mZddlmZdd lmZdd lmZmZmZmZdd lmZGd d „d eƒZGdd„deƒZdS)éN)Ú xform_name)ÚDocumentStructure)Úget_official_service_name)ÚActionDocumenter)Údocument_attributeÚdocument_identifierÚdocument_reference)ÚBaseDocumenter)ÚCollectionDocumenter)ÚSubResourceDocumenter)Úadd_resource_type_overviewÚ!get_identifier_args_for_signatureÚget_identifier_descriptionÚ!get_identifier_values_for_example)ÚWaiterResourceDocumentercs”eZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Z‡ZS)!ÚResourceDocumentercs>tƒ |¡||_||_|j ¡|_|j|jkrd|_dSdS)Nzservice-resource)ÚsuperÚ__init__Ú_botocore_sessionÚ_root_docs_pathÚ_resource_nameÚlowerÚ_resource_sub_pathÚ _service_name)ÚselfÚresourceZbotocore_sessionZroot_docs_path©Ú __class__©ún/private/var/folders/v1/_jykv66s6qd26_69j1njbrl80000gr/T/pip-target-p1gutpg6/lib/python/boto3/docs/resource.pyr&s    ÿzResourceDocumenter.__init__cCsh| |¡| |¡| |¡| |¡| |¡| |¡| |¡| |¡| |¡|  |¡dS©N) Ú _add_titleÚ_add_resource_noteÚ _add_introÚ_add_identifiersÚ_add_attributesÚ_add_referencesÚ _add_actionsÚ_add_sub_resourcesÚ_add_collectionsÚ _add_waiters©rÚsectionrrrÚdocument_resource.s         z$ResourceDocumenter.document_resourcecCs|j |j¡dSr )ÚstyleÚh2rr+rrrr!:szResourceDocumenter._add_titlec Cs¬g}|jjr|jjD]}| |j¡q t|ƒ}| d¡}|jj|j›d|›dd| d¡}|  |¡| d¡}|  ||¡| d¡}|  ||¡| d¡} | j  ¡dS) NÚ start_classú(ú))Ú class_nameÚ descriptionZexampleÚparamsÚ end_class) Z_resource_modelÚ identifiersÚappendÚnamer Úadd_new_sectionr.Zstart_sphinx_py_classr3Ú_add_descriptionÚ _add_exampleÚ_add_params_descriptionZend_sphinx_py_class) rr,Úidentifier_namesÚ identifierZ class_argsr0Zdescription_sectionZexample_sectionZ param_sectionr6rrrr#=s"  ÿ       zResourceDocumenter._add_introcCs"t|jƒ}| d ||j¡¡dS)Nz A resource representing an {} {})rÚ_service_modelÚwriteÚformatr©rr,Zofficial_service_namerrrr;Zs ÿÿz#ResourceDocumenter._add_descriptioncCsˆ|j ¡|j ¡| d¡|j ¡|j ¡| d |j|j¡¡|j ¡t|ƒ}| d t|jƒ|j|j|¡¡|j  ¡dS)Nú import boto3z{} = boto3.resource('{}')z{} = {}.{}({})) r.Ústart_codeblockÚnew_linerArBrrrrÚ end_codeblock)rr,r>Zexample_valuesrrrr<bs*     ÿÿ üÿzResourceDocumenter._add_examplecCsV|D]&}t|j|ƒ}| d|›d¡|j ¡| d|›d|›¡|j ¡qdS)Nz:type z: stringz:param z: )rrrAr.rF)rr,r>Zidentifier_namer4rrrr=ysÿ  ùz*ResourceDocumenter._add_params_descriptioncCsR|j ¡| d|›d¡|j ¡|j ¡|j|D] }|j |›¡qdS)Nz#These are the resource's available ú:)r.rFrAZtoctreeÚ member_mapZtocitem)rr,Zresource_member_typeÚmemberrrrÚ_add_overview_of_member_typeƒs  ÿ  ÿz/ResourceDocumenter._add_overview_of_member_typecCsÄ|jjjj}| d¡}g}|r||jd<t|dddd|D]7}| |j¡t |jdd}|  |j¡| |j¡}t ||j |dt j |j|j›|j›¡}| ||j¡q|r`| |d¡dSdS) Nr7Z IdentifierszYIdentifiers are properties of a resource that are set upon instantiation of the resource.Úidentifiers_attributes_intro©r,Z resource_typer4Z intro_linkÚhtml©Útarget)r,Ú resource_nameZidentifier_model)Ú _resourceÚmetaÚresource_modelr7r:rIr r8r9rÚadd_title_sectionrrÚosÚpathÚjoinrrrÚ write_to_filerK)rr,r7Z member_listr?Zidentifier_docZidentifier_sectionZidentifiers_dir_pathrrrr$s@   ù  ÿýýÿz#ResourceDocumenter._add_identifiersc Cs|jjjjj}i}|jjjjr | |jjjj¡}|jjj |¡}| d¡}g}|r6t |dddd||j d<t |ƒD]A}||\}}|  |¡t |dd} |  |¡|  |¡} t| |j|j||jjjjj|dtj |j|j›|j›¡} |  | |¡q:|r†| |d¡dSdS) NÚ attributesZ Attributesz”Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the :py:meth:`load` method.rLrMrNrO)r,Z service_namerQÚ attr_nameZ event_emitterZ attr_model)rRrSÚclientÚ service_modelrTÚshapeZ shape_forZget_attributesr:r rIÚsortedr8rrUrrrÚeventsrVrWrXrrrYrK) rr,r]rZr^Zattribute_listr[Ú_Z attr_shapeZ attribute_docZattribute_sectionZattributes_dir_pathrrrr%µsT  ÿ ÿ ÷       ú ýÿz"ResourceDocumenter._add_attributescCsÌ| d¡}|jjjj}g}|r"t|dddd||jd<| |d¡|D]5}| |j ¡t |j dd}|  |j ¡| |j ¡}t ||dt j |j|j›|j›¡}| ||j ¡q$|rd| |d¡dSdS) NÚ referencesZ ReferenceszNReferences are related resource instances that have a belongs-to relationship.Zreferences_introrMrNrO)r,Zreference_model)r:rRrSrTrbr rIrKr8r9rrUrrVrWrXrrrrY)rr,rbZreference_listÚ referenceZ reference_docZreference_sectionZreferences_dir_pathrrrr&ès:  ù    ÿýÿz"ResourceDocumenter._add_referencescCóN| d¡}|jjjj}|r%t|j|jƒ}|j|_| |¡|  |d¡dSdS)NÚactions) r:rRrSrTrerrrIZdocument_actionsrK)rr,reÚ documenterrrrr' s   üzResourceDocumenter._add_actionscCrd)Nz sub-resources) r:rRrSrTZ subresourcesr rrIZdocument_sub_resourcesrK)rr,Z sub_resourcesrfrrrr(ó  ÿ úz%ResourceDocumenter._add_sub_resourcescCrd)NÚ collections) r:rRrSrTrhr rrIZdocument_collectionsrK)rr,rhrfrrrr) rgz#ResourceDocumenter._add_collectionscCs^| d¡}|jjjj}|r-|j |j¡}t|j||j ƒ}|j |_ |  |¡|  |d¡dSdS)NÚwaiters) r:rRrSrTrirZget_waiter_modelrrrrIZdocument_resource_waitersrK)rr,riZservice_waiter_modelrfrrrr*+s  ÿ ÿ ÷zResourceDocumenter._add_waiterscCs,| d¡}|j ¡| d¡|j ¡dS)Nzfeature-freezez¢Before using anything on this page, please refer to the resources :doc:`user guide <../../../../guide/resources>` for the most recent guidance on using resources.)r:r.Z start_noterAZend_noter+rrrr"9s  ÿz%ResourceDocumenter._add_resource_note)Ú__name__Ú __module__Ú __qualname__rr-r!r#r;r<r=rKr$r%r&r'r(r)r*r"Ú __classcell__rrrrr%s"    (3$   rc@s0eZdZedd„ƒZdd„Zdd„Zdd„Zd S) ÚServiceResourceDocumentercCs |j›dS)Nz.ServiceResource)Z_service_docs_name)rrrrr3Es z$ServiceResourceDocumenter.class_namecCs|j d¡dS)NzService Resource)r.r/r+rrrr!Isz$ServiceResourceDocumenter._add_titlecCst|jƒ}| d|›¡dS)NzA resource representing )rr@rArCrrrr;Ls z*ServiceResourceDocumenter._add_descriptioncCsZ|j ¡|j ¡| d¡|j ¡|j ¡| |j›d|j›d¡|j ¡dS)NrDz = boto3.resource('z'))r.rErFrArrG)rr,r>rrrr<Ps     ÿz&ServiceResourceDocumenter._add_exampleN)rjrkrlÚpropertyr3r!r;r<rrrrrnDs   rn)rVZbotocorerZbotocore.docs.bcdoc.restdocrZbotocore.docs.utilsrZboto3.docs.actionrZboto3.docs.attrrrrZboto3.docs.baser Zboto3.docs.collectionr Zboto3.docs.subresourcer Zboto3.docs.utilsr r rrZboto3.docs.waiterrrrnrrrrÚs        !