Asterisk - The Open Source Telephony Project GIT-master-85241bd
Functions | Variables
make_ari_stubs Namespace Reference

Functions

def main (argv)
 
def rel (file)
 

Variables

 file
 
 TOPDIR = os.path.dirname(os.path.abspath(__file__))
 

Function Documentation

◆ main()

def main (   argv)

Definition at line 45 of file make_ari_stubs.py.

45def main(argv):
46 description = (
47 'Command line utility to export ARI documentation to markdown'
48 )
49
50 parser = ArgParser(description=description)
51 parser.add_argument('--resources', type=str, default="rest-api/resources.json",
52 help="resources.json file to process", required=False)
53 parser.add_argument('--source-dir', type=str, default=".",
54 help="Asterisk source directory", required=False)
55 parser.add_argument('--dest-dir', type=str, default="doc/rest-api",
56 help="Destination directory", required=False)
57 parser.add_argument('--docs-prefix', type=str, default="../",
58 help="Prefix to apply to links", required=False)
59
60 args = parser.parse_args()
61 if not args:
62 return
63
64 renderer = pystache.Renderer(search_dirs=[TOPDIR], missing_tags='strict')
65 processor = AsteriskProcessor(wiki_prefix=args.docs_prefix)
66
67 API_TRANSFORMS = [
68 Transform(rel('api.wiki.mustache'),
69 '%s/{{name_title}}_REST_API.md' % args.dest_dir),
70 Transform(rel('res_ari_resource.c.mustache'),
71 'res/res_ari_{{c_name}}.c'),
72 Transform(rel('ari_resource.h.mustache'),
73 'res/ari/resource_{{c_name}}.h'),
74 Transform(rel('ari_resource.c.mustache'),
75 'res/ari/resource_{{c_name}}.c', overwrite=False),
76 ]
77
78 RESOURCES_TRANSFORMS = [
79 Transform(rel('models.wiki.mustache'),
80 '%s/Asterisk_REST_Data_Models.md' % args.dest_dir),
81 Transform(rel('ari.make.mustache'), 'res/ari.make'),
82 Transform(rel('ari_model_validators.h.mustache'),
83 'res/ari/ari_model_validators.h'),
84 Transform(rel('ari_model_validators.c.mustache'),
85 'res/ari/ari_model_validators.c'),
86 ]
87
88 # Build the models
89 base_dir = os.path.dirname(args.resources)
90 resources = ResourceListing().load_file(args.resources, processor)
91 for api in resources.apis:
92 api.load_api_declaration(base_dir, processor)
93
94 # Render the templates
95 for api in resources.apis:
96 for transform in API_TRANSFORMS:
97 transform.render(renderer, api, args.source_dir)
98 for transform in RESOURCES_TRANSFORMS:
99 transform.render(renderer, resources, args.source_dir)
100
def main(argv)
static int load_file(const char *filename, char **ret)
Read a TEXT file into a string and return the length.

References load_file(), main(), and rel().

Referenced by main().

◆ rel()

def rel (   file)
Helper to get a file relative to the script's directory

@parm file: Relative file path.

Definition at line 38 of file make_ari_stubs.py.

38def rel(file):
39 """Helper to get a file relative to the script's directory
40
41 @parm file: Relative file path.
42 """
43 return os.path.join(TOPDIR, file)
44

Referenced by main().

Variable Documentation

◆ file

file

Definition at line 25 of file make_ari_stubs.py.

Referenced by __ao2_alloc(), __ao2_alloc_with_lockobj(), __ao2_callback(), __ao2_callback_data(), __ao2_cleanup_debug(), __ao2_container_alloc_hash(), __ao2_container_alloc_list(), __ao2_container_alloc_rbtree(), __ao2_container_clone(), __ao2_find(), __ao2_get_weakproxy(), __ao2_global_obj_ref(), __ao2_global_obj_replace(), __ao2_global_obj_replace_unref(), __ao2_iterator_next(), __ao2_link(), __ao2_lock(), __ao2_ref(), __ao2_trylock(), __ao2_unlink(), __ao2_unlock(), __ao2_weakproxy_alloc(), __ao2_weakproxy_find(), __ao2_weakproxy_get_object(), __ao2_weakproxy_ref_object(), __ao2_weakproxy_set_object(), __ast_asprintf(), __ast_assert_failed(), __ast_bucket_scheme_register(), __ast_calloc(), __ast_calloc_cache(), __ast_calloc_with_stringfields(), __ast_cc_config_params_init(), __ast_channel_alloc(), __ast_channel_alloc_ap(), __ast_channel_internal_alloc(), __ast_datastore_alloc(), __ast_dummy_channel_alloc(), __ast_fd_set_flags(), __ast_format_cache_get(), __ast_format_cap_alloc(), __ast_format_cap_append(), __ast_frdup(), __ast_frisolate(), __ast_heap_rdlock(), __ast_heap_unlock(), __ast_heap_wrlock(), __ast_malloc(), __ast_manager_event_multichan(), __ast_module_ref(), __ast_module_running_ref(), __ast_module_shutdown_ref(), __ast_module_unref(), __ast_realloc(), __ast_sorcery_open(), __ast_str_helper(), __ast_strdup(), __ast_string_field_alloc_space(), __ast_string_field_init(), __ast_string_field_ptr_build(), __ast_string_field_ptr_build_va(), __ast_string_fields_copy(), __ast_strndup(), __ast_vasprintf(), __ast_verbose(), __ast_verbose_ap(), __ast_verbose_callid(), __container_unlink_node_debug(), __hash_open(), __manager_event_sessions(), __manager_event_sessions_va(), __stasis_message_router_create(), __stasis_message_router_create_pool(), __stasis_subscribe(), __stasis_subscribe_pool(), __state_find_or_add(), _agent_lock(), _agent_unlock(), _ast_addressfamily_to_sockaddrsize(), _ast_bridge_channel_lock(), _ast_bridge_channel_trylock(), _ast_bridge_channel_unlock(), _ast_bridge_lock(), _ast_bridge_trylock(), _ast_bridge_unlock(), _ast_hashtab_create(), _ast_hashtab_dup(), _ast_hashtab_insert_immediate(), _ast_hashtab_insert_immediate_bucket(), _ast_hashtab_insert_safe(), _ast_hashtab_resize(), _ast_hashtab_start_traversal(), _ast_hashtab_start_write_traversal(), _ast_heap_create(), _ast_heap_push(), _ast_odbc_request_obj(), _ast_sockaddr_from_sin(), _ast_sockaddr_port(), _ast_sockaddr_set_port(), _ast_sockaddr_to_sin(), _ast_var_assign(), _ast_variable_new(), _get_mohbyname(), _moh_class_malloc(), _moh_register(), aco_info_init(), aco_process_ast_config(), aco_process_config(), action_playback(), action_playback_and_continue(), add_string_pool(), ael_yy_create_buffer(), ael_yy_init_buffer(), ast_bucket_file_alloc(), ast_bucket_file_clone(), ast_bucket_file_copy(), ast_bucket_file_create(), ast_bucket_file_delete(), ast_bucket_file_is_stale(), ast_bucket_file_json(), ast_bucket_file_metadata_callback(), ast_bucket_file_metadata_get(), ast_bucket_file_metadata_set(), ast_bucket_file_metadata_unset(), ast_bucket_file_temporary_create(), ast_bucket_file_temporary_destroy(), ast_bucket_file_update(), ast_control_streamfile(), ast_control_streamfile_lang(), ast_control_streamfile_w_cb(), ast_fax_log(), ast_frame_header_new(), ast_log(), ast_log_ap(), ast_log_callid(), ast_log_full(), ast_log_safe(), ast_pthread_create_detached_stack(), ast_pthread_create_stack(), ast_safe_execvp(), ast_str_thread_get(), ast_stream_and_wait(), AST_TEST_DEFINE(), ast_threadstorage_get(), ast_yy_create_buffer(), ast_yy_init_buffer(), bucket_file_alloc(), bucket_file_destroy(), bucket_file_wizard_create(), bucket_file_wizard_delete(), bucket_file_wizard_is_stale(), bucket_file_wizard_update(), config_curl(), config_ldap(), config_mysql(), config_odbc(), config_pgsql(), control_streamfile(), crypto_load_cb(), crypto_load_cert_store(), crypto_log_openssl(), dbm_open(), delete_file(), find_recording(), format_log_message(), format_log_message_ap(), grow_heap(), handle_scan_file(), hash_ao2_alloc_empty_clone(), hash_ao2_new_node(), init_hash(), internal_aco_type_find(), internal_ao2_alloc(), internal_ao2_traverse(), internal_file_types_destroy(), internal_process_ast_config(), internal_stasis_subscribe(), is_preload(), limits_interval_playback(), log_bad_ao2(), log_caps(), make_fn(), manager_mixmonitor(), message_playback_callback_fn(), phoneprov_callback(), play_and_wait(), pp_each_extension_helper(), process_category(), profile_destructor(), rb_ao2_alloc_empty_clone(), rb_ao2_new_node(), read_full(), set_fn(), smdi_toggle_mwi(), split_path(), stasis_app_stored_recording_find_by_name(), stasis_message_router_create_internal(), state_alloc(), vm_delete(), wait_file(), and wait_file2().

◆ TOPDIR

TOPDIR = os.path.dirname(os.path.abspath(__file__))

Definition at line 35 of file make_ari_stubs.py.