MCPcopy Create free account
hub / github.com/aws/aws-cli / ServiceDocumenter

Class ServiceDocumenter

awscli/botocore/docs/service.py:25–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class ServiceDocumenter:
26 def __init__(self, service_name, session, root_docs_path):
27 self._session = session
28 self._service_name = service_name
29 self._root_docs_path = root_docs_path
30
31 self._client = self._session.create_client(
32 service_name,
33 region_name='us-east-1',
34 aws_access_key_id='foo',
35 aws_secret_access_key='bar',
36 )
37 self._event_emitter = self._client.meta.events
38
39 self.sections = [
40 'title',
41 'table-of-contents',
42 'client-api',
43 'client-exceptions',
44 'paginator-api',
45 'waiter-api',
46 'client-context-params',
47 ]
48
49 def document_service(self):
50 """Documents an entire service.
51
52 :returns: The reStructured text of the documented service.
53 """
54 doc_structure = DocumentStructure(
55 self._service_name, section_names=self.sections, target='html'
56 )
57 self.title(doc_structure.get_section('title'))
58 self.table_of_contents(doc_structure.get_section('table-of-contents'))
59 self.client_api(doc_structure.get_section('client-api'))
60 self.client_exceptions(doc_structure.get_section('client-exceptions'))
61 self.paginator_api(doc_structure.get_section('paginator-api'))
62 self.waiter_api(doc_structure.get_section('waiter-api'))
63 context_params_section = doc_structure.get_section(
64 'client-context-params'
65 )
66 self.client_context_params(context_params_section)
67 return doc_structure.flush_structure()
68
69 def title(self, section):
70 section.style.h1(self._client.__class__.__name__)
71 service_id = self._client.meta.service_model.service_id.hyphenize()
72 self._event_emitter.emit(
73 'docs.{}.{}'.format('title', service_id), section=section
74 )
75
76 def table_of_contents(self, section):
77 section.style.table_of_contents(title='Table of Contents', depth=2)
78
79 def client_api(self, section):
80 examples = None
81 try:
82 examples = self.get_examples(self._service_name)

Calls

no outgoing calls