@ -681,6 +681,13 @@ tcl::namespace::eval punk::netbox {
variable contexts [dict create]
variable contexts [dict create]
variable context_id 0
variable context_id 0
namespace eval argdoc {
variable PUNKARGS
set DYN_CONTEXTNAMES {${[punk::netbox::api_context_names]}}
}
proc api_context_names {} {
proc api_context_names {} {
variable contexts
variable contexts
return [dict keys $contexts]
return [dict keys $contexts]
@ -845,7 +852,7 @@ tcl::namespace::eval punk::netbox {
set nowarnings [dict exists $received -nowarnings]
set nowarnings [dict exists $received -nowarnings]
if {$filepath eq ""} {
if {$filepath eq ""} {
set filepath [_datafile]
set filepath [_datafile -quiet ]
}
}
if {![file exists $filepath]} {
if {![file exists $filepath]} {
error "No existing datafile at '$filepath'\nUse api_context_create/api_context_save to configure and save contexts"
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 received [dict get $argd received]
set be_quiet [dict exists $received -quiet]
set be_quiet [dict exists $received -quiet]
set nowarnings [dict exists $received -nowarnings]
set nowarnings [dict exists $received -nowarnings]
set filepath [_datafile]
if {!$bequiet} {
set filepath [_datafile]
} else {
set filepath [_datafile -quiet]
}
if {![file exists $filepath]} {
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."
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} {
if {!$be_quiet} {
puts stdout "Loading API token contexts from [_datafile] "
puts stdout "Loading API token contexts from $filepath "
}
}
if {$nowarnings} {
if {$nowarnings} {
api_context_load -nowarnings
api_context_load -nowarnings
@ -992,6 +1003,7 @@ tcl::namespace::eval punk::netbox {
}
}
namespace eval argdoc {
namespace eval argdoc {
lappend PUNKARGS [list {
lappend PUNKARGS [list {
@dynamic
@id -id ::punk::netbox::api_context_get
@id -id ::punk::netbox::api_context_get
@cmd -name punk::netbox::api_context_get -help\
@cmd -name punk::netbox::api_context_get -help\
"Get api context fields for a single context.
"Get api context fields for a single context.
@ -1003,7 +1015,7 @@ tcl::namespace::eval punk::netbox {
Contextids can be created in-memory using
Contextids can be created in-memory using
api_context_create, or loaded from a .toml
api_context_create, or loaded from a .toml
file using api_context_load."\
file using api_context_load."\
-choices {${[punk::netbox::api_context_names] }}
-choices {${$DYN_CONTEXTNAMES }}
@values -min 0 -max -1
@values -min 0 -max -1
field -type string -multiple 1 -optional 1 -help\
field -type string -multiple 1 -optional 1 -help\
"If no field arguments are supplied, all will
"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]
append _number_filter_help [textblock::list_as_table -columns 3 -show_hseps 1 $_filter_number]
}
}
punk::args::define {*}[list\
namespace eval argdoc {
{
punk::args::define {*}[list\
@id -id ::punk::netbox::status
{
@cmd -name punk::netbox::status -help\
@dynamic
"status_list
@id -id ::punk::netbox::status
GET request for endpoint /status/
@cmd -name punk::netbox::status -help\
"status_list
GET request for endpoint /status/
Netbox's current operational status
Netbox's current operational status
"
"
@leaders -min 1 -max 1
@leaders -min 1 -max 1
apicontextid -help\
apicontextid -help\
"The name of the stored api context to use.
"The name of the stored api context to use.
A contextid can be created in-memory using
A contextid can be created in-memory using
api_context_create, or loaded from a .toml
api_context_create, or loaded from a .toml
file using api_context_load."\
file using api_context_load."\
-choices {${[punk::netbox::api_context_names]}}
-choices {${$DYN_CONTEXTNAMES}}
@opts
@opts
}\
}\
[set ::punk::netbox::argdoc::_RETURN_STATUS]\
[set ::punk::netbox::argdoc::_RETURN_STATUS]\
{
{
-ASYNC -type none
-ASYNC -type none
@values -min 0 -max 0
@values -min 0 -max 0
}]
}]
}
::punk::netbox::system::make_rest_func_async ::punk::netbox::status api/status/ -verb get -body none
::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
#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 {
tcl::namespace::eval punk::netbox::dcim {
namespace export {[a-z]*}
namespace export {[a-z]*}
lappend PUNKARGS [list\
namespace eval argdoc {
{
set DYN_CONTEXTNAMES {${[punk::netbox::api_context_names]}}
@dynamic
lappend PUNKARGS [list\
@id -id ::punk::netbox::dcim::devices_list
{
@cmd -name punk::netbox::dcim::devices_list -help\
@dynamic
"tenancy_tenants_list
@id -id ::punk::netbox::dcim::devices_list
GET request for endpoint /dcim/devices/"
@cmd -name punk::netbox::dcim::devices_list -help\
@leaders -min 1 -max 1
"tenancy_tenants_list
apicontextid -help\
GET request for endpoint /dcim/devices/"
"The name of the stored api context to use.
@leaders -min 1 -max 1
A contextid can be created in-memory using
apicontextid -help\
api_context_create, or loaded from a .toml
"The name of the stored api context to use.
file using api_context_load."\
A contextid can be created in-memory using
-choices {${[punk::netbox::api_context_names]}}
api_context_create, or loaded from a .toml
@opts
file using api_context_load."\
-id -type integer
-choices {${$DYN_CONTEXTNAMES}}
-ID_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help\
@opts
{${$::punk::netbox::argdoc::_number_filter_help}}
-id -type integer
-name
-ID_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help\
-NAME_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_name_filter_help}}
{${$::punk::netbox::argdoc::_number_filter_help}}
-asset_tag -type string
-name
-ASSET_TAG_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}}
-NAME_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_name_filter_help}}
-face -type string
-asset_tag -type string
-face__n -type string
-ASSET_TAG_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}}
-position -type integer
-face -type string
-POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}}
-face__n -type string
-airflow -type string
-position -type integer
-airflow__n -type string
-POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}}
-vc_position -type integer
-airflow -type string
-VC_POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}}
-airflow__n -type string
-vc_priority -type integer
-vc_position -type integer
-VC_PRIORITY_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}}
-VC_POSITION_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}}
}\
-vc_priority -type integer
[set ::punk::netbox::argdoc::_create_update_options]\
-VC_PRIORITY_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_number_filter_help}}
{
}\
-q -type string
[set ::punk::netbox::argdoc::_create_update_options]\
-tag -type string -multiple true
{
-tag__n -type string
-q -type string
}\
-tag -type string -multiple true
[set ::punk::netbox::argdoc::_tenant_options]\
-tag__n -type string
[set ::punk::netbox::argdoc::_contact_options]\
}\
{
[set ::punk::netbox::argdoc::_tenant_options]\
-local_context_data
[set ::punk::netbox::argdoc::_contact_options]\
-manufacturer_id
{
-manufacturer_id__n
-local_context_data
-manufacturer
-manufacturer_id
-manufacturer__n
-manufacturer_id__n
-device_type_id
-manufacturer
-device_type_id__n
-manufacturer__n
-role_id
-device_type_id
-role_id__n
-device_type_id__n
-role
-role_id
-role__n
-role_id__n
-parent_device_id
-role
-parent_device_id__n
-role__n
-platform_id
-parent_device_id
-platform_id__n
-parent_device_id__n
-platform
-platform_id
-platform__n
-platform_id__n
}\
-platform
[set ::punk::netbox::argdoc::_group_options]\
-platform__n
[set ::punk::netbox::argdoc::_region_options]\
}\
[set ::punk::netbox::argdoc::_site_options]\
[set ::punk::netbox::argdoc::_group_options]\
{
[set ::punk::netbox::argdoc::_region_options]\
-location_id -type integer
[set ::punk::netbox::argdoc::_site_options]\
-location_id__n -type integer
{
-rack_id -type integer
-location_id -type integer
-rack_id__n -type integer
-location_id__n -type integer
-cluster_id -type integer
-rack_id -type integer
-cluster_id__n -type integer
-rack_id__n -type integer
-model -type string
-cluster_id -type integer
-model__n -type string
-cluster_id__n -type integer
-status -type string
-model -type string
-status__n -type string
-model__n -type string
-mac_address -type string
-status -type string
-MAC_ADDRESS_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}}
-status__n -type string
-serial -type string
-mac_address -type string
-SERIAL_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}}
-MAC_ADDRESS_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}}
-virtual_chassis_id -type integer
-serial -type string
-virtual_chassis_id__n -type integer
-SERIAL_FILTER -type list -minsize 2 -maxsize 2 -multiple 1 -unindentedfields {-help} -help {${$::punk::netbox::argdoc::_string_filter_help}}
}\
-virtual_chassis_id -type integer
[set ::punk::netbox::argdoc::_page_options]\
-virtual_chassis_id__n -type integer
[set ::punk::netbox::argdoc::_CUSTOM_PARAMS]\
}\
[set ::punk::netbox::argdoc::_RETURN_PAGEDICT]\
[set ::punk::netbox::argdoc::_page_options]\
{
[set ::punk::netbox::argdoc::_CUSTOM_PARAMS]\
@values -min 0 -max 0
[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
::punk::netbox::system::make_rest_func_async ::punk::netbox::dcim::devices_list api/dcim/devices/ -verb get -body none
}
}