diff --git a/src/modules/punk/netbox-999999.0a1.0.tm b/src/modules/punk/netbox-999999.0a1.0.tm index 9e6be8cc..985b8f73 100644 --- a/src/modules/punk/netbox-999999.0a1.0.tm +++ b/src/modules/punk/netbox-999999.0a1.0.tm @@ -681,6 +681,13 @@ tcl::namespace::eval punk::netbox { variable contexts [dict create] variable context_id 0 + namespace eval argdoc { + variable PUNKARGS + set DYN_CONTEXTNAMES {${[punk::netbox::api_context_names]}} + } + + + proc api_context_names {} { variable contexts return [dict keys $contexts] @@ -845,7 +852,7 @@ tcl::namespace::eval punk::netbox { set nowarnings [dict exists $received -nowarnings] if {$filepath eq ""} { - set filepath [_datafile] + set filepath [_datafile -quiet] } if {![file exists $filepath]} { error "No existing datafile at '$filepath'\nUse api_context_create/api_context_save to configure and save contexts" @@ -900,12 +907,16 @@ tcl::namespace::eval punk::netbox { set received [dict get $argd received] set be_quiet [dict exists $received -quiet] set nowarnings [dict exists $received -nowarnings] - set filepath [_datafile] + if {!$bequiet} { + set filepath [_datafile] + } else { + set filepath [_datafile -quiet] + } if {![file exists $filepath]} { error "No existing datafile at '$filepath'\nCall api_context_load with a path to a .toml file with context records\nor use api_context_create/api_context_save." } if {!$be_quiet} { - puts stdout "Loading API token contexts from [_datafile]" + puts stdout "Loading API token contexts from $filepath" } if {$nowarnings} { api_context_load -nowarnings @@ -992,6 +1003,7 @@ tcl::namespace::eval punk::netbox { } namespace eval argdoc { lappend PUNKARGS [list { + @dynamic @id -id ::punk::netbox::api_context_get @cmd -name punk::netbox::api_context_get -help\ "Get api context fields for a single context. @@ -1003,7 +1015,7 @@ tcl::namespace::eval punk::netbox { Contextids can be created in-memory using api_context_create, or loaded from a .toml file using api_context_load."\ - -choices {${[punk::netbox::api_context_names]}} + -choices {${$DYN_CONTEXTNAMES}} @values -min 0 -max -1 field -type string -multiple 1 -optional 1 -help\ "If no field arguments are supplied, all will @@ -1646,29 +1658,32 @@ tcl::namespace::eval punk::netbox { append _number_filter_help [textblock::list_as_table -columns 3 -show_hseps 1 $_filter_number] } - punk::args::define {*}[list\ - { - @id -id ::punk::netbox::status - @cmd -name punk::netbox::status -help\ - "status_list - GET request for endpoint /status/ + namespace eval argdoc { + punk::args::define {*}[list\ + { + @dynamic + @id -id ::punk::netbox::status + @cmd -name punk::netbox::status -help\ + "status_list + GET request for endpoint /status/ - Netbox's current operational status - " - @leaders -min 1 -max 1 - apicontextid -help\ - "The name of the stored api context to use. - A contextid can be created in-memory using - api_context_create, or loaded from a .toml - file using api_context_load."\ - -choices {${[punk::netbox::api_context_names]}} - @opts - }\ - [set ::punk::netbox::argdoc::_RETURN_STATUS]\ - { - -ASYNC -type none - @values -min 0 -max 0 - }] + Netbox's current operational status + " + @leaders -min 1 -max 1 + apicontextid -help\ + "The name of the stored api context to use. + A contextid can be created in-memory using + api_context_create, or loaded from a .toml + file using api_context_load."\ + -choices {${$DYN_CONTEXTNAMES}} + @opts + }\ + [set ::punk::netbox::argdoc::_RETURN_STATUS]\ + { + -ASYNC -type none + @values -min 0 -max 0 + }] + } ::punk::netbox::system::make_rest_func_async ::punk::netbox::status api/status/ -verb get -body none #test - to see what the create_interface procs look like with a callback @@ -1779,93 +1794,96 @@ tcl::namespace::eval punk::netbox { tcl::namespace::eval punk::netbox::dcim { namespace export {[a-z]*} - lappend PUNKARGS [list\ - { - @dynamic - @id -id ::punk::netbox::dcim::devices_list - @cmd -name punk::netbox::dcim::devices_list -help\ - "tenancy_tenants_list - GET request for endpoint /dcim/devices/" - @leaders -min 1 -max 1 - apicontextid -help\ - "The name of the stored api context to use. - A contextid can be created in-memory using - api_context_create, or loaded from a .toml - file using api_context_load."\ - -choices {${[punk::netbox::api_context_names]}} - @opts - -id -type integer - -ID_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help\ - {${$::punk::netbox::argdoc::_number_filter_help}} - -name - -NAME_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_name_filter_help}} - -asset_tag -type string - -ASSET_TAG_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}} - -face -type string - -face__n -type string - -position -type integer - -POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}} - -airflow -type string - -airflow__n -type string - -vc_position -type integer - -VC_POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}} - -vc_priority -type integer - -VC_PRIORITY_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}} - }\ - [set ::punk::netbox::argdoc::_create_update_options]\ - { - -q -type string - -tag -type string -multiple true - -tag__n -type string - }\ - [set ::punk::netbox::argdoc::_tenant_options]\ - [set ::punk::netbox::argdoc::_contact_options]\ - { - -local_context_data - -manufacturer_id - -manufacturer_id__n - -manufacturer - -manufacturer__n - -device_type_id - -device_type_id__n - -role_id - -role_id__n - -role - -role__n - -parent_device_id - -parent_device_id__n - -platform_id - -platform_id__n - -platform - -platform__n - }\ - [set ::punk::netbox::argdoc::_group_options]\ - [set ::punk::netbox::argdoc::_region_options]\ - [set ::punk::netbox::argdoc::_site_options]\ - { - -location_id -type integer - -location_id__n -type integer - -rack_id -type integer - -rack_id__n -type integer - -cluster_id -type integer - -cluster_id__n -type integer - -model -type string - -model__n -type string - -status -type string - -status__n -type string - -mac_address -type string - -MAC_ADDRESS_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}} - -serial -type string - -SERIAL_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}} - -virtual_chassis_id -type integer - -virtual_chassis_id__n -type integer - }\ - [set ::punk::netbox::argdoc::_page_options]\ - [set ::punk::netbox::argdoc::_CUSTOM_PARAMS]\ - [set ::punk::netbox::argdoc::_RETURN_PAGEDICT]\ - { - @values -min 0 -max 0 - }] + namespace eval argdoc { + set DYN_CONTEXTNAMES {${[punk::netbox::api_context_names]}} + lappend PUNKARGS [list\ + { + @dynamic + @id -id ::punk::netbox::dcim::devices_list + @cmd -name punk::netbox::dcim::devices_list -help\ + "tenancy_tenants_list + GET request for endpoint /dcim/devices/" + @leaders -min 1 -max 1 + apicontextid -help\ + "The name of the stored api context to use. + A contextid can be created in-memory using + api_context_create, or loaded from a .toml + file using api_context_load."\ + -choices {${$DYN_CONTEXTNAMES}} + @opts + -id -type integer + -ID_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help\ + {${$::punk::netbox::argdoc::_number_filter_help}} + -name + -NAME_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_name_filter_help}} + -asset_tag -type string + -ASSET_TAG_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}} + -face -type string + -face__n -type string + -position -type integer + -POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}} + -airflow -type string + -airflow__n -type string + -vc_position -type integer + -VC_POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}} + -vc_priority -type integer + -VC_PRIORITY_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}} + }\ + [set ::punk::netbox::argdoc::_create_update_options]\ + { + -q -type string + -tag -type string -multiple true + -tag__n -type string + }\ + [set ::punk::netbox::argdoc::_tenant_options]\ + [set ::punk::netbox::argdoc::_contact_options]\ + { + -local_context_data + -manufacturer_id + -manufacturer_id__n + -manufacturer + -manufacturer__n + -device_type_id + -device_type_id__n + -role_id + -role_id__n + -role + -role__n + -parent_device_id + -parent_device_id__n + -platform_id + -platform_id__n + -platform + -platform__n + }\ + [set ::punk::netbox::argdoc::_group_options]\ + [set ::punk::netbox::argdoc::_region_options]\ + [set ::punk::netbox::argdoc::_site_options]\ + { + -location_id -type integer + -location_id__n -type integer + -rack_id -type integer + -rack_id__n -type integer + -cluster_id -type integer + -cluster_id__n -type integer + -model -type string + -model__n -type string + -status -type string + -status__n -type string + -mac_address -type string + -MAC_ADDRESS_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}} + -serial -type string + -SERIAL_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}} + -virtual_chassis_id -type integer + -virtual_chassis_id__n -type integer + }\ + [set ::punk::netbox::argdoc::_page_options]\ + [set ::punk::netbox::argdoc::_CUSTOM_PARAMS]\ + [set ::punk::netbox::argdoc::_RETURN_PAGEDICT]\ + { + @values -min 0 -max 0 + }] + } ::punk::netbox::system::make_rest_func_async ::punk::netbox::dcim::devices_list api/dcim/devices/ -verb get -body none } diff --git a/src/modules/punk/netbox-buildversion.txt b/src/modules/punk/netbox-buildversion.txt index f47d01c8..781c895b 100644 --- a/src/modules/punk/netbox-buildversion.txt +++ b/src/modules/punk/netbox-buildversion.txt @@ -1,3 +1,3 @@ -0.1.0 +0.1.1 #First line must be a semantic version number #all other lines are ignored.