Generates the reference documentation for botocore This will go through every available AWS service and output ReSTructured text files documenting each service. :param root_dir: The directory to write the reference files to. Each service's reference documentation is loacated at
(root_dir, session)
| 16 | |
| 17 | |
| 18 | def generate_docs(root_dir, session): |
| 19 | """Generates the reference documentation for botocore |
| 20 | |
| 21 | This will go through every available AWS service and output ReSTructured |
| 22 | text files documenting each service. |
| 23 | |
| 24 | :param root_dir: The directory to write the reference files to. Each |
| 25 | service's reference documentation is loacated at |
| 26 | root_dir/reference/services/service-name.rst |
| 27 | """ |
| 28 | # Create the root directory where all service docs live. |
| 29 | services_dir_path = os.path.join(root_dir, 'reference', 'services') |
| 30 | if not os.path.exists(services_dir_path): |
| 31 | os.makedirs(services_dir_path) |
| 32 | |
| 33 | # Generate reference docs and write them out. |
| 34 | for service_name in session.get_available_services(): |
| 35 | docs = ServiceDocumenter( |
| 36 | service_name, session, services_dir_path |
| 37 | ).document_service() |
| 38 | |
| 39 | # Write the main service documentation page. |
| 40 | # Path: <root>/reference/services/<service>/index.rst |
| 41 | service_file_path = os.path.join( |
| 42 | services_dir_path, f'{service_name}.rst' |
| 43 | ) |
| 44 | with open(service_file_path, 'wb') as f: |
| 45 | f.write(docs) |