-
Notifications
You must be signed in to change notification settings - Fork 0
/
TelstraTPN
2940 lines (2724 loc) · 118 KB
/
TelstraTPN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !
# ! Note:
# !
# ! THIS SCRIPT HAS BEEN AUTOMATICALLY GENERATED USING
# ! swagger-codegen (https://github.com/swagger-api/swagger-codegen)
# ! FROM SWAGGER SPECIFICATION IN JSON.
# !
# ! Generated on: 2018-01-17T22:02:43.245+11:00
# !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# This is a Bash client for Telstra Programmable Network API.
#
# LICENSE:
# http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
#
# CONTACT:
#
#
# MORE INFORMATION:
#
#
# For improved pattern matching in case statemets
shopt -s extglob
###############################################################################
#
# Make sure Bash is at least in version 4.3
#
###############################################################################
if ! ( (("${BASH_VERSION:0:1}" == "4")) && (("${BASH_VERSION:2:1}" >= "3")) ) \
&& ! (("${BASH_VERSION:0:1}" >= "5")); then
echo ""
echo "Sorry - your Bash version is ${BASH_VERSION}"
echo ""
echo "You need at least Bash 4.3 to run this script."
echo ""
exit 1
fi
###############################################################################
#
# Global variables
#
###############################################################################
##
# The filename of this script for help messages
script_name=$(basename "$0")
##
# Map for headers passed after operation as KEY:VALUE
declare -A header_arguments
##
# Map for operation parameters passed after operation as PARAMETER=VALUE
# These will be mapped to appropriate path or query parameters
# The values in operation_parameters are arrays, so that multiple values
# can be provided for the same parameter if allowed by API specification
declare -A operation_parameters
##
# Declare colors with autodection if output is terminal
if [ -t 1 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
WHITE="$(tput setaf 7)"
BOLD="$(tput bold)"
OFF="$(tput sgr0)"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
MAGENTA=""
CYAN=""
WHITE=""
BOLD=""
OFF=""
fi
declare -a result_color_table=( "$WHITE" "$WHITE" "$GREEN" "$YELLOW" "$WHITE" "$MAGENTA" "$WHITE" )
##
# This array stores the minimum number of required occurrences for parameter
# 0 - optional
# 1 - required
declare -A operation_parameters_minimum_occurrences
operation_parameters_minimum_occurrences["authGeneratetokenPost:::grant_type"]=1
operation_parameters_minimum_occurrences["authGeneratetokenPost:::username"]=1
operation_parameters_minimum_occurrences["authGeneratetokenPost:::password"]=1
operation_parameters_minimum_occurrences["inventoryLinksContractByLinkidAndContractidGet:::linkid"]=1
operation_parameters_minimum_occurrences["inventoryLinksContractByLinkidAndContractidGet:::contractid"]=1
operation_parameters_minimum_occurrences["inventoryLinksContractByLinkidAndContractidPut:::linkid"]=1
operation_parameters_minimum_occurrences["inventoryLinksContractByLinkidAndContractidPut:::contractid"]=1
operation_parameters_minimum_occurrences["inventoryLinksContractByLinkidAndContractidPut:::body"]=0
operation_parameters_minimum_occurrences["inventoryLinksContractByLinkidPost:::linkid"]=1
operation_parameters_minimum_occurrences["inventoryLinksContractByLinkidPost:::body"]=0
operation_parameters_minimum_occurrences["accountByCustomeruuidGet:::customeruuid"]=1
operation_parameters_minimum_occurrences["accountUserByCustomeruuidGet:::customeruuid"]=1
operation_parameters_minimum_occurrences["eis100EndpointsAssignTopologyTagByEndpointuuidPost:::endpointuuid"]=1
operation_parameters_minimum_occurrences["eis100EndpointsAssignTopologyTagByEndpointuuidPost:::body"]=0
operation_parameters_minimum_occurrences["inventoryEndpointByEndpointuuidGet:::endpointuuid"]=1
operation_parameters_minimum_occurrences["inventoryEndpointsCustomeruuidByCustomeruuidGet:::customeruuid"]=1
operation_parameters_minimum_occurrences["inventoryRegularendpointPost:::body"]=0
operation_parameters_minimum_occurrences["inventoryVnfendpointPost:::body"]=0
operation_parameters_minimum_occurrences["inventoryLinkPost:::body"]=0
operation_parameters_minimum_occurrences["inventoryLinksByLinkidGet:::linkid"]=1
operation_parameters_minimum_occurrences["inventoryLinksCustomerByCustomeruuidGet:::customeruuid"]=1
operation_parameters_minimum_occurrences["inventoryLinksHistoryByLinkidGet:::linkid"]=1
operation_parameters_minimum_occurrences["ttms100TopologyTagByTopotaguuidDelete:::topotaguuid"]=1
operation_parameters_minimum_occurrences["ttms100TopologyTagByTopotaguuidGet:::topotaguuid"]=1
operation_parameters_minimum_occurrences["ttms100TopologyTagByTopotaguuidPut:::topotaguuid"]=1
operation_parameters_minimum_occurrences["ttms100TopologyTagByTopotaguuidPut:::body"]=0
operation_parameters_minimum_occurrences["ttms100TopologyTagObjectsByTopotaguuidGet:::topotaguuid"]=1
operation_parameters_minimum_occurrences["ttms100TopologyTagPost:::body"]=0
operation_parameters_minimum_occurrences["inventoryRegularvportPost:::body"]=0
operation_parameters_minimum_occurrences["inventoryVnfVportPost:::body"]=0
operation_parameters_minimum_occurrences["inventoryVportByVportuuidGet:::vportuuid"]=1
##
# This array stores the maximum number of allowed occurrences for parameter
# 1 - single value
# 2 - 2 values
# N - N values
# 0 - unlimited
declare -A operation_parameters_maximum_occurrences
operation_parameters_maximum_occurrences["authGeneratetokenPost:::grant_type"]=0
operation_parameters_maximum_occurrences["authGeneratetokenPost:::username"]=0
operation_parameters_maximum_occurrences["authGeneratetokenPost:::password"]=0
operation_parameters_maximum_occurrences["inventoryLinksContractByLinkidAndContractidGet:::linkid"]=0
operation_parameters_maximum_occurrences["inventoryLinksContractByLinkidAndContractidGet:::contractid"]=0
operation_parameters_maximum_occurrences["inventoryLinksContractByLinkidAndContractidPut:::linkid"]=0
operation_parameters_maximum_occurrences["inventoryLinksContractByLinkidAndContractidPut:::contractid"]=0
operation_parameters_maximum_occurrences["inventoryLinksContractByLinkidAndContractidPut:::body"]=0
operation_parameters_maximum_occurrences["inventoryLinksContractByLinkidPost:::linkid"]=0
operation_parameters_maximum_occurrences["inventoryLinksContractByLinkidPost:::body"]=0
operation_parameters_maximum_occurrences["accountByCustomeruuidGet:::customeruuid"]=0
operation_parameters_maximum_occurrences["accountUserByCustomeruuidGet:::customeruuid"]=0
operation_parameters_maximum_occurrences["eis100EndpointsAssignTopologyTagByEndpointuuidPost:::endpointuuid"]=0
operation_parameters_maximum_occurrences["eis100EndpointsAssignTopologyTagByEndpointuuidPost:::body"]=0
operation_parameters_maximum_occurrences["inventoryEndpointByEndpointuuidGet:::endpointuuid"]=0
operation_parameters_maximum_occurrences["inventoryEndpointsCustomeruuidByCustomeruuidGet:::customeruuid"]=0
operation_parameters_maximum_occurrences["inventoryRegularendpointPost:::body"]=0
operation_parameters_maximum_occurrences["inventoryVnfendpointPost:::body"]=0
operation_parameters_maximum_occurrences["inventoryLinkPost:::body"]=0
operation_parameters_maximum_occurrences["inventoryLinksByLinkidGet:::linkid"]=0
operation_parameters_maximum_occurrences["inventoryLinksCustomerByCustomeruuidGet:::customeruuid"]=0
operation_parameters_maximum_occurrences["inventoryLinksHistoryByLinkidGet:::linkid"]=0
operation_parameters_maximum_occurrences["ttms100TopologyTagByTopotaguuidDelete:::topotaguuid"]=0
operation_parameters_maximum_occurrences["ttms100TopologyTagByTopotaguuidGet:::topotaguuid"]=0
operation_parameters_maximum_occurrences["ttms100TopologyTagByTopotaguuidPut:::topotaguuid"]=0
operation_parameters_maximum_occurrences["ttms100TopologyTagByTopotaguuidPut:::body"]=0
operation_parameters_maximum_occurrences["ttms100TopologyTagObjectsByTopotaguuidGet:::topotaguuid"]=0
operation_parameters_maximum_occurrences["ttms100TopologyTagPost:::body"]=0
operation_parameters_maximum_occurrences["inventoryRegularvportPost:::body"]=0
operation_parameters_maximum_occurrences["inventoryVnfVportPost:::body"]=0
operation_parameters_maximum_occurrences["inventoryVportByVportuuidGet:::vportuuid"]=0
##
# The type of collection for specifying multiple values for parameter:
# - multi, csv, ssv, tsv
declare -A operation_parameters_collection_type
operation_parameters_collection_type["authGeneratetokenPost:::grant_type"]=""
operation_parameters_collection_type["authGeneratetokenPost:::username"]=""
operation_parameters_collection_type["authGeneratetokenPost:::password"]=""
operation_parameters_collection_type["inventoryLinksContractByLinkidAndContractidGet:::linkid"]=""
operation_parameters_collection_type["inventoryLinksContractByLinkidAndContractidGet:::contractid"]=""
operation_parameters_collection_type["inventoryLinksContractByLinkidAndContractidPut:::linkid"]=""
operation_parameters_collection_type["inventoryLinksContractByLinkidAndContractidPut:::contractid"]=""
operation_parameters_collection_type["inventoryLinksContractByLinkidAndContractidPut:::body"]=""
operation_parameters_collection_type["inventoryLinksContractByLinkidPost:::linkid"]=""
operation_parameters_collection_type["inventoryLinksContractByLinkidPost:::body"]=""
operation_parameters_collection_type["accountByCustomeruuidGet:::customeruuid"]=""
operation_parameters_collection_type["accountUserByCustomeruuidGet:::customeruuid"]=""
operation_parameters_collection_type["eis100EndpointsAssignTopologyTagByEndpointuuidPost:::endpointuuid"]=""
operation_parameters_collection_type["eis100EndpointsAssignTopologyTagByEndpointuuidPost:::body"]=""
operation_parameters_collection_type["inventoryEndpointByEndpointuuidGet:::endpointuuid"]=""
operation_parameters_collection_type["inventoryEndpointsCustomeruuidByCustomeruuidGet:::customeruuid"]=""
operation_parameters_collection_type["inventoryRegularendpointPost:::body"]=""
operation_parameters_collection_type["inventoryVnfendpointPost:::body"]=""
operation_parameters_collection_type["inventoryLinkPost:::body"]=""
operation_parameters_collection_type["inventoryLinksByLinkidGet:::linkid"]=""
operation_parameters_collection_type["inventoryLinksCustomerByCustomeruuidGet:::customeruuid"]=""
operation_parameters_collection_type["inventoryLinksHistoryByLinkidGet:::linkid"]=""
operation_parameters_collection_type["ttms100TopologyTagByTopotaguuidDelete:::topotaguuid"]=""
operation_parameters_collection_type["ttms100TopologyTagByTopotaguuidGet:::topotaguuid"]=""
operation_parameters_collection_type["ttms100TopologyTagByTopotaguuidPut:::topotaguuid"]=""
operation_parameters_collection_type["ttms100TopologyTagByTopotaguuidPut:::body"]=""
operation_parameters_collection_type["ttms100TopologyTagObjectsByTopotaguuidGet:::topotaguuid"]=""
operation_parameters_collection_type["ttms100TopologyTagPost:::body"]=""
operation_parameters_collection_type["inventoryRegularvportPost:::body"]=""
operation_parameters_collection_type["inventoryVnfVportPost:::body"]=""
operation_parameters_collection_type["inventoryVportByVportuuidGet:::vportuuid"]=""
##
# Map for body parameters passed after operation as
# PARAMETER==STRING_VALUE or PARAMETER:=NUMERIC_VALUE
# These will be mapped to top level json keys ( { "PARAMETER": "VALUE" })
declare -A body_parameters
##
# These arguments will be directly passed to cURL
curl_arguments=""
##
# The host for making the request
host=""
##
# The user credentials for basic authentication
basic_auth_credential=""
##
# If true, the script will only output the actual cURL command that would be
# used
print_curl=false
##
# The operation ID passed on the command line
operation=""
##
# The provided Accept header value
header_accept=""
##
# The provided Content-type header value
header_content_type=""
##
# If there is any body content on the stdin pass it to the body of the request
body_content_temp_file=""
##
# If this variable is set to true, the request will be performed even
# if parameters for required query, header or body values are not provided
# (path parameters are still required).
force=false
##
# Declare some mime types abbreviations for easier content-type and accepts
# headers specification
declare -A mime_type_abbreviations
# text/*
mime_type_abbreviations["text"]="text/plain"
mime_type_abbreviations["html"]="text/html"
mime_type_abbreviations["md"]="text/x-markdown"
mime_type_abbreviations["csv"]="text/csv"
mime_type_abbreviations["css"]="text/css"
mime_type_abbreviations["rtf"]="text/rtf"
# application/*
mime_type_abbreviations["json"]="application/json"
mime_type_abbreviations["xml"]="application/xml"
mime_type_abbreviations["yaml"]="application/yaml"
mime_type_abbreviations["js"]="application/javascript"
mime_type_abbreviations["bin"]="application/octet-stream"
mime_type_abbreviations["rdf"]="application/rdf+xml"
# image/*
mime_type_abbreviations["jpg"]="image/jpeg"
mime_type_abbreviations["png"]="image/png"
mime_type_abbreviations["gif"]="image/gif"
mime_type_abbreviations["bmp"]="image/bmp"
mime_type_abbreviations["tiff"]="image/tiff"
##############################################################################
#
# Escape special URL characters
# Based on table at http://www.w3schools.com/tags/ref_urlencode.asp
#
##############################################################################
url_escape() {
local raw_url="$1"
value=$(sed -e 's/ /%20/g' \
-e 's/!/%21/g' \
-e 's/"/%22/g' \
-e 's/#/%23/g' \
-e 's/\&/%26/g' \
-e 's/'\''/%28/g' \
-e 's/(/%28/g' \
-e 's/)/%29/g' \
-e 's/:/%3A/g' \
-e 's/\t/%09/g' \
-e 's/?/%3F/g' <<<"$raw_url");
echo "$value"
}
##############################################################################
#
# Lookup the mime type abbreviation in the mime_type_abbreviations array.
# If not present assume the user provided a valid mime type
#
##############################################################################
lookup_mime_type() {
local mime_type="$1"
if [[ ${mime_type_abbreviations[$mime_type]} ]]; then
echo "${mime_type_abbreviations[$mime_type]}"
else
echo "$mime_type"
fi
}
##############################################################################
#
# Converts an associative array into a list of cURL header
# arguments (-H "KEY: VALUE")
#
##############################################################################
header_arguments_to_curl() {
local headers_curl=""
for key in "${!header_arguments[@]}"; do
headers_curl+="-H \"${key}: ${header_arguments[${key}]}\" "
done
headers_curl+=" "
echo "${headers_curl}"
}
##############################################################################
#
# Converts an associative array into a simple JSON with keys as top
# level object attributes
#
# \todo Add conversion of more complex attributes using paths
#
##############################################################################
body_parameters_to_json() {
local body_json="-d '{"
local count=0
for key in "${!body_parameters[@]}"; do
if [[ $((count++)) -gt 0 ]]; then
body_json+=", "
fi
body_json+="\"${key}\": ${body_parameters[${key}]}"
done
body_json+="}'"
if [[ "${#body_parameters[@]}" -eq 0 ]]; then
echo ""
else
echo "${body_json}"
fi
}
##############################################################################
#
# Helper method for showing error because for example echo in
# build_request_path() is evaluated as part of command line not printed on
# output. Anyway better idea for resource clean up ;-).
#
##############################################################################
ERROR_MSG=""
function finish {
if [[ -n "$ERROR_MSG" ]]; then
echo >&2 "${OFF}${RED}$ERROR_MSG"
echo >&2 "${OFF}Check usage: '${script_name} --help'"
fi
}
trap finish EXIT
##############################################################################
#
# Validate and build request path including query parameters
#
##############################################################################
build_request_path() {
local path_template=$1
local -n path_params=$2
local -n query_params=$3
#
# Check input parameters count against minimum and maximum required
#
if [[ "$force" = false ]]; then
local was_error=""
for qparam in "${query_params[@]}" "${path_params[@]}"; do
local parameter_values
mapfile -t parameter_values < <(sed -e 's/'":::"'/\n/g' <<<"${operation_parameters[$qparam]}")
#
# Check if the number of provided values is not less than minimum required
#
if [[ ${#parameter_values[@]} -lt ${operation_parameters_minimum_occurrences["${operation}:::${qparam}"]} ]]; then
echo "ERROR: Too few values provided for '${qparam}' parameter."
was_error=true
fi
#
# Check if the number of provided values is not more than maximum
#
if [[ ${operation_parameters_maximum_occurrences["${operation}:::${qparam}"]} -gt 0 \
&& ${#parameter_values[@]} -gt ${operation_parameters_maximum_occurrences["${operation}:::${qparam}"]} ]]; then
echo "ERROR: Too many values provided for '${qparam}' parameter"
was_error=true
fi
done
if [[ -n "$was_error" ]]; then
exit 1
fi
fi
# First replace all path parameters in the path
for pparam in "${path_params[@]}"; do
local path_regex="(.*)(\\{$pparam\\})(.*)"
if [[ $path_template =~ $path_regex ]]; then
path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
fi
done
local query_request_part=""
local count=0
for qparam in "${query_params[@]}"; do
# Get the array of parameter values
local parameter_value=""
local parameter_values
mapfile -t parameter_values < <(sed -e 's/'":::"'/\n/g' <<<"${operation_parameters[$qparam]}")
if [[ -n "${parameter_values[*]}" ]]; then
if [[ $((count++)) -gt 0 ]]; then
query_request_part+="&"
fi
fi
#
# Append parameters without specific cardinality
#
local collection_type="${operation_parameters_collection_type["${operation}:::${qparam}"]}"
if [[ "${collection_type}" == "" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+="&"
fi
parameter_value+="${qparam}=${qvalue}"
done
#
# Append parameters specified as 'mutli' collections i.e. param=value1¶m=value2&...
#
elif [[ "${collection_type}" == "multi" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+="&"
fi
parameter_value+="${qparam}=${qvalue}"
done
#
# Append parameters specified as 'csv' collections i.e. param=value1,value2,...
#
elif [[ "${collection_type}" == "csv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+=","
fi
parameter_value+="${qvalue}"
done
#
# Append parameters specified as 'ssv' collections i.e. param="value1 value2 ..."
#
elif [[ "${collection_type}" == "ssv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+=" "
fi
parameter_value+="${qvalue}"
done
#
# Append parameters specified as 'tsv' collections i.e. param="value1\tvalue2\t..."
#
elif [[ "${collection_type}" == "tsv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+="\\t"
fi
parameter_value+="${qvalue}"
done
else
echo "Unsupported collection format \"${collection_type}\""
exit 1
fi
if [[ -n "${parameter_value}" ]]; then
query_request_part+="${parameter_value}"
fi
done
# Now append query parameters - if any
if [[ -n "${query_request_part}" ]]; then
path_template+="?${query_request_part}"
fi
echo "$path_template"
}
###############################################################################
#
# Print main help message
#
###############################################################################
print_help() {
cat <<EOF
${BOLD}${WHITE}Telstra Programmable Network API command line client (API version 2.1.3)${OFF}
${BOLD}${WHITE}Usage${OFF}
${GREEN}${script_name}${OFF} [-h|--help] [-V|--version] [--about] [${RED}<curl-options>${OFF}]
[-ac|--accept ${GREEN}<mime-type>${OFF}] [-ct,--content-type ${GREEN}<mime-type>${OFF}]
[--host ${CYAN}<url>${OFF}] [--dry-run] [-nc|--no-colors] ${YELLOW}<operation>${OFF} [-h|--help]
[${BLUE}<headers>${OFF}] [${MAGENTA}<parameters>${OFF}] [${MAGENTA}<body-parameters>${OFF}]
- ${CYAN}<url>${OFF} - endpoint of the REST service without basepath
- ${RED}<curl-options>${OFF} - any valid cURL options can be passed before ${YELLOW}<operation>${OFF}
- ${GREEN}<mime-type>${OFF} - either full mime-type or one of supported abbreviations:
(text, html, md, csv, css, rtf, json, xml, yaml, js, bin,
rdf, jpg, png, gif, bmp, tiff)
- ${BLUE}<headers>${OFF} - HTTP headers can be passed in the form ${YELLOW}HEADER${OFF}:${BLUE}VALUE${OFF}
- ${MAGENTA}<parameters>${OFF} - REST operation parameters can be passed in the following
forms:
* ${YELLOW}KEY${OFF}=${BLUE}VALUE${OFF} - path or query parameters
- ${MAGENTA}<body-parameters>${OFF} - simple JSON body content (first level only) can be build
using the following arguments:
* ${YELLOW}KEY${OFF}==${BLUE}VALUE${OFF} - body parameters which will be added to body
JSON as '{ ..., "${YELLOW}KEY${OFF}": "${BLUE}VALUE${OFF}", ... }'
* ${YELLOW}KEY${OFF}:=${BLUE}VALUE${OFF} - body parameters which will be added to body
JSON as '{ ..., "${YELLOW}KEY${OFF}": ${BLUE}VALUE${OFF}, ... }'
EOF
echo -e "${BOLD}${WHITE}Authentication methods${OFF}"
echo -e ""
echo -e " - ${MAGENTA}OAuth2 (flow: password)${OFF}"
echo -e " Token URL: "
echo -e " * https://penapi.pacnetconnect.com/1.0.0/auth/generatetoken"
echo -e " Scopes:"
echo -e " * Oauth2 - Oauth2"
echo ""
echo -e "${BOLD}${WHITE}Operations (grouped by tags)${OFF}"
echo ""
echo -e "${BOLD}${WHITE}[authentication]${OFF}"
read -r -d '' ops <<EOF
${CYAN}authGeneratetokenPost${OFF};Create an authentication token
${CYAN}authValidatetokenGet${OFF};Validate authentication token
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[contracts]${OFF}"
read -r -d '' ops <<EOF
${CYAN}inventoryLinksContractByLinkidAndContractidGet${OFF};Get active Contract by ContractID (AUTH)
${CYAN}inventoryLinksContractByLinkidAndContractidPut${OFF};Update active Contract by ContractID (AUTH)
${CYAN}inventoryLinksContractByLinkidPost${OFF};Create new Contract on specified link (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[customers]${OFF}"
read -r -d '' ops <<EOF
${CYAN}accountByCustomeruuidGet${OFF};Get account information details (AUTH)
${CYAN}accountUserByCustomeruuidGet${OFF};List users (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[datacentres]${OFF}"
read -r -d '' ops <<EOF
${CYAN}inventoryDatacentersGet${OFF};Get list of all the data centers (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[endpoints]${OFF}"
read -r -d '' ops <<EOF
${CYAN}eis100EndpointsAssignTopologyTagByEndpointuuidPost${OFF};Assign a Topology Tag to an Endpoint (AUTH)
${CYAN}inventoryEndpointByEndpointuuidGet${OFF};Get information about the specified endpoint (AUTH)
${CYAN}inventoryEndpointsCustomeruuidByCustomeruuidGet${OFF};Get list of endpoints for a customer (AUTH)
${CYAN}inventoryRegularendpointPost${OFF};Create Physical (Port) Endpoint (AUTH)
${CYAN}inventoryVnfendpointPost${OFF};Create VNF Endpoint (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[links]${OFF}"
read -r -d '' ops <<EOF
${CYAN}inventoryLinkPost${OFF};Create Link and initial Contract (AUTH)
${CYAN}inventoryLinksByLinkidGet${OFF};Get details of specified link (AUTH)
${CYAN}inventoryLinksCustomerByCustomeruuidGet${OFF};Get active Links (AUTH)
${CYAN}inventoryLinksHistoryByLinkidGet${OFF};Get Link history (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[topologies]${OFF}"
read -r -d '' ops <<EOF
${CYAN}ttms100TopologyTagByTopotaguuidDelete${OFF};Delete a topology tag
${CYAN}ttms100TopologyTagByTopotaguuidGet${OFF};Get information about the specified topology tag
${CYAN}ttms100TopologyTagByTopotaguuidPut${OFF};Update a topology tag's name and/or description
${CYAN}ttms100TopologyTagGet${OFF};List all topology tags
${CYAN}ttms100TopologyTagObjectsByTopotaguuidGet${OFF};List objects for Topology
${CYAN}ttms100TopologyTagPost${OFF};Create a named topology tag
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[vnfs]${OFF}"
read -r -d '' ops <<EOF
${CYAN}marketplaceImageGet${OFF};List images in the Marketplace (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[vports]${OFF}"
read -r -d '' ops <<EOF
${CYAN}inventoryRegularvportPost${OFF};Create VPort for physical endpoint (AUTH)
${CYAN}inventoryVnfVportPost${OFF};Create VNF VPort (AUTH)
${CYAN}inventoryVportByVportuuidGet${OFF};Get information about the specified VPort (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}Options${OFF}"
echo -e " -h,--help\\t\\t\\t\\tPrint this help"
echo -e " -V,--version\\t\\t\\t\\tPrint API version"
echo -e " --about\\t\\t\\t\\tPrint the information about service"
echo -e " --host ${CYAN}<url>${OFF}\\t\\t\\t\\tSpecify the host URL "
echo -e " \\t\\t\\t\\t(e.g. 'https://penapi.pacnetconnect.com')"
echo -e " --force\\t\\t\\t\\tForce command invocation in spite of missing"
echo -e " \\t\\t\\t\\trequired parameters or wrong content type"
echo -e " --dry-run\\t\\t\\t\\tPrint out the cURL command without"
echo -e " \\t\\t\\t\\texecuting it"
echo -e " -nc,--no-colors\\t\\t\\tEnforce print without colors, otherwise autodected"
echo -e " -ac,--accept ${YELLOW}<mime-type>${OFF}\\t\\tSet the 'Accept' header in the request"
echo -e " -ct,--content-type ${YELLOW}<mime-type>${OFF}\\tSet the 'Content-type' header in "
echo -e " \\tthe request"
echo ""
}
##############################################################################
#
# Print REST service description
#
##############################################################################
print_about() {
echo ""
echo -e "${BOLD}${WHITE}Telstra Programmable Network API command line client (API version 2.1.3)${OFF}"
echo ""
echo -e "License: MIT"
echo -e "Contact: "
echo ""
read -r -d '' appdescription <<EOF
Telstra Programmable Network is a self-provisioning platform that allows its users to create on-demand connectivity services between multiple end-points and add various network functions to those services. Programmable Network enables to connectivity to a global ecosystem of networking services as well as public and private cloud services. Once you are connected to the platform on one or more POPs (points of presence), you can start creating those services based on the use case that you want to accomplish. The Programmable Network API is available to all customers who have registered to use the Programmable Network.
To register, please contact your account representative.
EOF
echo "$appdescription" | paste -sd' ' | fold -sw 80
}
##############################################################################
#
# Print REST api version
#
##############################################################################
print_version() {
echo ""
echo -e "${BOLD}Telstra Programmable Network API command line client (API version 2.1.3)${OFF}"
echo ""
}
##############################################################################
#
# Print help for authGeneratetokenPost operation
#
##############################################################################
print_authGeneratetokenPost_help() {
echo ""
echo -e "${BOLD}${WHITE}authGeneratetokenPost - Create an authentication token${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Create an authentication token" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;A JSON hash containing the bearer token${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=412
echo -e "${result_color_table[${code:0:1}]} 412;Provided authorization grant is invalid${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for authValidatetokenGet operation
#
##############################################################################
print_authValidatetokenGet_help() {
echo ""
echo -e "${BOLD}${WHITE}authValidatetokenGet - Validate authentication token${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Validate the authentication token and get information about the user (roles, permissions, etc.)" | paste -sd' ' | fold -sw 80
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryLinksContractByLinkidAndContractidGet operation
#
##############################################################################
print_inventoryLinksContractByLinkidAndContractidGet_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryLinksContractByLinkidAndContractidGet - Get active Contract by ContractID${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Get active Contract by ContractID" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}linkid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific link ${YELLOW}Specify as: linkid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}contractid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific contract ${YELLOW}Specify as: contractid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryLinksContractByLinkidAndContractidPut operation
#
##############################################################################
print_inventoryLinksContractByLinkidAndContractidPut_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryLinksContractByLinkidAndContractidPut - Update active Contract by ContractID${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Update active Contract by ContractID" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}linkid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific link ${YELLOW}Specify as: linkid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}contractid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific contract ${YELLOW}Specify as: contractid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryLinksContractByLinkidPost operation
#
##############################################################################
print_inventoryLinksContractByLinkidPost_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryLinksContractByLinkidPost - Create new Contract on specified link${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Create new Contract on specified link" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}linkid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific link ${YELLOW}Specify as: linkid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for accountByCustomeruuidGet operation
#
##############################################################################
print_accountByCustomeruuidGet_help() {
echo ""
echo -e "${BOLD}${WHITE}accountByCustomeruuidGet - Get account information details${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Get the account information for the specified customer" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}customeruuid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific customer ${YELLOW}Specify as: customeruuid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authorization Failed${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for accountUserByCustomeruuidGet operation
#
##############################################################################
print_accountUserByCustomeruuidGet_help() {
echo ""
echo -e "${BOLD}${WHITE}accountUserByCustomeruuidGet - List users${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "List all users associated with the specified customer" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}customeruuid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific customer ${YELLOW}Specify as: customeruuid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryDatacentersGet operation
#
##############################################################################
print_inventoryDatacentersGet_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryDatacentersGet - Get list of all the data centers${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Get list of all the data centers" | paste -sd' ' | fold -sw 80
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;array of data center objects${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Request is not correctly formatted${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Missing Token${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Authorization Failed${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Specified object cannot be found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;Method Not Allowed${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=409
echo -e "${result_color_table[${code:0:1}]} 409;Status onflict${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=422
echo -e "${result_color_table[${code:0:1}]} 422;Request is invalid${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=0
echo -e "${result_color_table[${code:0:1}]} 0;Backend Error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for eis100EndpointsAssignTopologyTagByEndpointuuidPost operation
#
##############################################################################
print_eis100EndpointsAssignTopologyTagByEndpointuuidPost_help() {
echo ""
echo -e "${BOLD}${WHITE}eis100EndpointsAssignTopologyTagByEndpointuuidPost - Assign a Topology Tag to an Endpoint${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Assign a Topology Tag to an Endpoint" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}endpointuuid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific endpoint ${YELLOW}Specify as: endpointuuid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=201
echo -e "${result_color_table[${code:0:1}]} 201;Created${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryEndpointByEndpointuuidGet operation
#
##############################################################################
print_inventoryEndpointByEndpointuuidGet_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryEndpointByEndpointuuidGet - Get information about the specified endpoint${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Get information about the specified endpoint" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}endpointuuid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific endpoint ${YELLOW}Specify as: endpointuuid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryEndpointsCustomeruuidByCustomeruuidGet operation
#
##############################################################################
print_inventoryEndpointsCustomeruuidByCustomeruuidGet_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryEndpointsCustomeruuidByCustomeruuidGet - Get list of endpoints for a customer${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Get list of endpoints for a customer" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}customeruuid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific customer ${YELLOW}Specify as: customeruuid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryRegularendpointPost operation
#
##############################################################################
print_inventoryRegularendpointPost_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryRegularendpointPost - Create Physical (Port) Endpoint${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Create Physical (Port) Endpoint" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryVnfendpointPost operation
#
##############################################################################
print_inventoryVnfendpointPost_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryVnfendpointPost - Create VNF Endpoint${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Create VNF Endpoint" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryLinkPost operation
#
##############################################################################
print_inventoryLinkPost_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryLinkPost - Create Link and initial Contract${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Create Link and initial Contract" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryLinksByLinkidGet operation
#
##############################################################################
print_inventoryLinksByLinkidGet_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryLinksByLinkidGet - Get details of specified link${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Get details of specified link" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}linkid${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF}${OFF} - Unique identifier representing a specific link ${YELLOW}Specify as: linkid=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inventoryLinksCustomerByCustomeruuidGet operation
#
##############################################################################
print_inventoryLinksCustomerByCustomeruuidGet_help() {
echo ""
echo -e "${BOLD}${WHITE}inventoryLinksCustomerByCustomeruuidGet - Get active Links${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Get active Links" | paste -sd' ' | fold -sw 80
echo -e ""