diff --git a/Testdaten/rtcinfo (1).msg b/Testdaten/rtcinfo (1).msg new file mode 100644 index 0000000..4faa734 Binary files /dev/null and b/Testdaten/rtcinfo (1).msg differ diff --git a/Testdaten/rtcinfo (10).msg b/Testdaten/rtcinfo (10).msg new file mode 100644 index 0000000..3829b12 Binary files /dev/null and b/Testdaten/rtcinfo (10).msg differ diff --git a/Testdaten/rtcinfo (11).msg b/Testdaten/rtcinfo (11).msg new file mode 100644 index 0000000..1eb3961 Binary files /dev/null and b/Testdaten/rtcinfo (11).msg differ diff --git a/Testdaten/rtcinfo (12).msg b/Testdaten/rtcinfo (12).msg new file mode 100644 index 0000000..76c44b3 Binary files /dev/null and b/Testdaten/rtcinfo (12).msg differ diff --git a/Testdaten/rtcinfo (13).msg b/Testdaten/rtcinfo (13).msg new file mode 100644 index 0000000..c275c80 Binary files /dev/null and b/Testdaten/rtcinfo (13).msg differ diff --git a/Testdaten/rtcinfo (14).msg b/Testdaten/rtcinfo (14).msg new file mode 100644 index 0000000..c515369 Binary files /dev/null and b/Testdaten/rtcinfo (14).msg differ diff --git a/Testdaten/rtcinfo (15).msg b/Testdaten/rtcinfo (15).msg new file mode 100644 index 0000000..d1d332c Binary files /dev/null and b/Testdaten/rtcinfo (15).msg differ diff --git a/Testdaten/rtcinfo (16).msg b/Testdaten/rtcinfo (16).msg new file mode 100644 index 0000000..94742c6 Binary files /dev/null and b/Testdaten/rtcinfo (16).msg differ diff --git a/Testdaten/rtcinfo (17).msg b/Testdaten/rtcinfo (17).msg new file mode 100644 index 0000000..6a75f77 Binary files /dev/null and b/Testdaten/rtcinfo (17).msg differ diff --git a/Testdaten/rtcinfo (18).msg b/Testdaten/rtcinfo (18).msg new file mode 100644 index 0000000..9b23b8a Binary files /dev/null and b/Testdaten/rtcinfo (18).msg differ diff --git a/Testdaten/rtcinfo (19).msg b/Testdaten/rtcinfo (19).msg new file mode 100644 index 0000000..5616baa Binary files /dev/null and b/Testdaten/rtcinfo (19).msg differ diff --git a/Testdaten/rtcinfo (2).msg b/Testdaten/rtcinfo (2).msg new file mode 100644 index 0000000..8f88617 Binary files /dev/null and b/Testdaten/rtcinfo (2).msg differ diff --git a/Testdaten/rtcinfo (20).msg b/Testdaten/rtcinfo (20).msg new file mode 100644 index 0000000..222a053 Binary files /dev/null and b/Testdaten/rtcinfo (20).msg differ diff --git a/Testdaten/rtcinfo (21).msg b/Testdaten/rtcinfo (21).msg new file mode 100644 index 0000000..66e762c Binary files /dev/null and b/Testdaten/rtcinfo (21).msg differ diff --git a/Testdaten/rtcinfo (22).msg b/Testdaten/rtcinfo (22).msg new file mode 100644 index 0000000..b6b8d73 Binary files /dev/null and b/Testdaten/rtcinfo (22).msg differ diff --git a/Testdaten/rtcinfo (23).msg b/Testdaten/rtcinfo (23).msg new file mode 100644 index 0000000..ed1479a Binary files /dev/null and b/Testdaten/rtcinfo (23).msg differ diff --git a/Testdaten/rtcinfo (24).msg b/Testdaten/rtcinfo (24).msg new file mode 100644 index 0000000..80b92f7 Binary files /dev/null and b/Testdaten/rtcinfo (24).msg differ diff --git a/Testdaten/rtcinfo (25).msg b/Testdaten/rtcinfo (25).msg new file mode 100644 index 0000000..073f6e4 Binary files /dev/null and b/Testdaten/rtcinfo (25).msg differ diff --git a/Testdaten/rtcinfo (26).msg b/Testdaten/rtcinfo (26).msg new file mode 100644 index 0000000..f9f42ae Binary files /dev/null and b/Testdaten/rtcinfo (26).msg differ diff --git a/Testdaten/rtcinfo (27).msg b/Testdaten/rtcinfo (27).msg new file mode 100644 index 0000000..586b6b3 Binary files /dev/null and b/Testdaten/rtcinfo (27).msg differ diff --git a/Testdaten/rtcinfo (28).msg b/Testdaten/rtcinfo (28).msg new file mode 100644 index 0000000..19476a6 Binary files /dev/null and b/Testdaten/rtcinfo (28).msg differ diff --git a/Testdaten/rtcinfo (29).msg b/Testdaten/rtcinfo (29).msg new file mode 100644 index 0000000..d5978b2 Binary files /dev/null and b/Testdaten/rtcinfo (29).msg differ diff --git a/Testdaten/rtcinfo (3).msg b/Testdaten/rtcinfo (3).msg new file mode 100644 index 0000000..755ed3b Binary files /dev/null and b/Testdaten/rtcinfo (3).msg differ diff --git a/Testdaten/rtcinfo (30).msg b/Testdaten/rtcinfo (30).msg new file mode 100644 index 0000000..03f3a0f Binary files /dev/null and b/Testdaten/rtcinfo (30).msg differ diff --git a/Testdaten/rtcinfo (31).msg b/Testdaten/rtcinfo (31).msg new file mode 100644 index 0000000..daa34ff Binary files /dev/null and b/Testdaten/rtcinfo (31).msg differ diff --git a/Testdaten/rtcinfo (32).msg b/Testdaten/rtcinfo (32).msg new file mode 100644 index 0000000..8050224 Binary files /dev/null and b/Testdaten/rtcinfo (32).msg differ diff --git a/Testdaten/rtcinfo (33).msg b/Testdaten/rtcinfo (33).msg new file mode 100644 index 0000000..064708e Binary files /dev/null and b/Testdaten/rtcinfo (33).msg differ diff --git a/Testdaten/rtcinfo (34).msg b/Testdaten/rtcinfo (34).msg new file mode 100644 index 0000000..a2fe184 Binary files /dev/null and b/Testdaten/rtcinfo (34).msg differ diff --git a/Testdaten/rtcinfo (35).msg b/Testdaten/rtcinfo (35).msg new file mode 100644 index 0000000..2f99cca Binary files /dev/null and b/Testdaten/rtcinfo (35).msg differ diff --git a/Testdaten/rtcinfo (36).msg b/Testdaten/rtcinfo (36).msg new file mode 100644 index 0000000..996d286 Binary files /dev/null and b/Testdaten/rtcinfo (36).msg differ diff --git a/Testdaten/rtcinfo (37).msg b/Testdaten/rtcinfo (37).msg new file mode 100644 index 0000000..d6450bc Binary files /dev/null and b/Testdaten/rtcinfo (37).msg differ diff --git a/Testdaten/rtcinfo (38).msg b/Testdaten/rtcinfo (38).msg new file mode 100644 index 0000000..3f50eed Binary files /dev/null and b/Testdaten/rtcinfo (38).msg differ diff --git a/Testdaten/rtcinfo (39).msg b/Testdaten/rtcinfo (39).msg new file mode 100644 index 0000000..fa373c3 Binary files /dev/null and b/Testdaten/rtcinfo (39).msg differ diff --git a/Testdaten/rtcinfo (4).msg b/Testdaten/rtcinfo (4).msg new file mode 100644 index 0000000..9f9e23b Binary files /dev/null and b/Testdaten/rtcinfo (4).msg differ diff --git a/Testdaten/rtcinfo (5).msg b/Testdaten/rtcinfo (5).msg new file mode 100644 index 0000000..2fb64e6 Binary files /dev/null and b/Testdaten/rtcinfo (5).msg differ diff --git a/Testdaten/rtcinfo (6).msg b/Testdaten/rtcinfo (6).msg new file mode 100644 index 0000000..992d20f Binary files /dev/null and b/Testdaten/rtcinfo (6).msg differ diff --git a/Testdaten/rtcinfo (7).msg b/Testdaten/rtcinfo (7).msg new file mode 100644 index 0000000..28fab14 Binary files /dev/null and b/Testdaten/rtcinfo (7).msg differ diff --git a/Testdaten/rtcinfo (8).msg b/Testdaten/rtcinfo (8).msg new file mode 100644 index 0000000..10e8e5b Binary files /dev/null and b/Testdaten/rtcinfo (8).msg differ diff --git a/Testdaten/rtcinfo (9).msg b/Testdaten/rtcinfo (9).msg new file mode 100644 index 0000000..782a2e1 Binary files /dev/null and b/Testdaten/rtcinfo (9).msg differ diff --git a/Testdaten/rtcinfo.7z b/Testdaten/rtcinfo.7z new file mode 100644 index 0000000..102c641 Binary files /dev/null and b/Testdaten/rtcinfo.7z differ diff --git a/Testdaten/rtcinfo/220816_rtcinfo.txt b/Testdaten/rtcinfo/220816_rtcinfo.txt new file mode 100644 index 0000000..6321b40 --- /dev/null +++ b/Testdaten/rtcinfo/220816_rtcinfo.txt @@ -0,0 +1,115 @@ +sERVUS Von: extern.stefan.renatscher@audi.de +Gesendet: Dienstag, 16. August 2022 22:04 +An: Spar, Georg (I/BT-O75); dbjyt0u@islcl011.in.audi.vwg; g6dt7ew@islcl011.in.audi.vwg +Betreff: rtcinfo + +INFO: any log- and error files will be located in: + /var/venus/logs/2022/08/16/au.admin.get_rtclu_info-islcl68162fbf83100009a77 +############ ivlbo009 ########### +### +### Reservierungen nach User ### +### +Format: Master: User Anzahl Command +iclcx620: VDP0MFX 5 start vred-13.3 start +iclcx623: SI80N1P 5 start vred-12.3 +iclcx625: DSELLR8 10 start vred-13.3 +iclcx626: SI80N1P 5 start vred-12.3 +iclcx627: hobmaihe 5 start vred-14.2 +iclcx628: DMU0F4Q 10 start vred-12.3 +iclcx629: TU4SUYU 5 start vred-14.2 +iclcx631: TFF86DT 25 start vred-13.3 +iclcx632: ABQX5TN 10 start vred-14.2 +iclcx633: HACKNEFL 5 start vred-13.3 +iclcx635: GNY3R61 20 start vred-14.2 +iclcx637: F22ENAM 40 start vred-14.2 +iclcx638: Laurenje 10 start vred-13.3 + +### +### Reservierungen nach Master ### +### +Format: Master[: allocated client 1 [[allocated client 2] [...]]] +cae-lsf-BT: iclcx001 iclcx002 iclcx003 iclcx004 +cae-lsf-ED: iclcx438 iclcx439 iclcx440 iclcx441 iclcx442 iclcx443 iclcx444 iclcx445 iclcx446 iclcx447 iclcx458 iclcx459 iclcx460 iclcx461 iclcx462 iclcx463 iclcx464 iclcx465 iclcx466 iclcx467 iclcx473 iclcx474 iclcx475 iclcx476 iclcx477 iclcx498 iclcx509 iclcx510 iclcx511 iclcx512 iclcx513 +cae-lsf-EK: iclcx206 iclcx207 iclcx208 iclcx209 iclcx210 iclcx211 iclcx212 iclcx213 iclcx214 iclcx215 iclcx216 iclcx217 iclcx218 iclcx219 iclcx220 iclcx221 iclcx222 iclcx223 iclcx224 iclcx225 iclcx226 iclcx227 iclcx228 iclcx229 iclcx230 iclcx231 iclcx232 iclcx233 iclcx234 iclcx235 iclcx236 iclcx237 iclcx238 iclcx239 iclcx240 iclcx241 iclcx242 iclcx243 iclcx244 iclcx245 iclcx246 iclcx247 iclcx248 iclcx249 iclcx250 iclcx251 iclcx252 iclcx253 iclcx254 iclcx255 iclcx256 iclcx257 iclcx258 iclcx259 iclcx260 iclcx261 iclcx262 iclcx263 iclcx264 iclcx265 iclcx266 iclcx267 iclcx268 iclcx269 iclcx270 iclcx271 iclcx272 iclcx273 iclcx274 iclcx275 iclcx276 iclcx277 iclcx278 iclcx279 iclcx280 iclcx281 iclcx282 iclcx283 iclcx284 iclcx285 iclcx286 iclcx287 iclcx288 iclcx289 iclcx290 iclcx291 +cae-lsf-GQ: iclcx292 iclcx293 iclcx294 iclcx295 iclcx296 iclcx297 iclcx298 iclcx299 iclcx300 iclcx301 iclcx302 iclcx303 iclcx304 iclcx305 iclcx306 iclcx307 iclcx308 iclcx309 iclcx310 iclcx311 iclcx312 iclcx313 iclcx314 iclcx315 iclcx316 iclcx317 iclcx318 iclcx319 iclcx320 iclcx321 iclcx322 iclcx323 iclcx324 iclcx325 iclcx326 iclcx327 +cae-lsf +cae-lsf-PG: iclcx005 iclcx006 iclcx007 iclcx008 iclcx009 iclcx010 iclcx011 iclcx012 iclcx013 iclcx014 iclcx015 iclcx016 iclcx017 iclcx018 iclcx019 iclcx020 iclcx021 iclcx022 iclcx023 iclcx024 iclcx025 iclcx026 iclcx027 iclcx028 iclcx029 iclcx030 iclcx031 iclcx032 iclcx033 iclcx034 iclcx035 iclcx036 iclcx037 iclcx038 iclcx039 iclcx040 iclcx041 iclcx042 iclcx043 iclcx044 iclcx045 iclcx046 iclcx047 iclcx048 iclcx049 iclcx050 iclcx051 iclcx052 iclcx054 iclcx055 iclcx056 iclcx057 iclcx058 iclcx060 iclcx061 iclcx062 iclcx063 iclcx064 iclcx065 iclcx066 iclcx067 iclcx068 iclcx069 iclcx070 iclcx071 iclcx072 iclcx073 iclcx074 iclcx075 iclcx076 iclcx077 iclcx078 iclcx079 iclcx080 iclcx081 iclcx082 iclcx083 iclcx084 iclcx085 iclcx086 iclcx087 iclcx088 iclcx089 iclcx090 iclcx091 iclcx092 iclcx093 iclcx094 iclcx095 iclcx096 iclcx097 iclcx098 iclcx099 iclcx100 iclcx101 iclcx102 iclcx103 iclcx104 iclcx105 iclcx106 iclcx107 iclcx108 iclcx109 iclcx110 iclcx111 iclcx112 iclcx113 iclcx114 iclcx115 iclcx116 iclcx117 iclcx118 iclcx119 iclcx120 iclcx121 iclcx122 iclcx123 iclcx124 iclcx125 iclcx126 iclcx127 iclcx128 iclcx129 iclcx130 iclcx131 iclcx132 iclcx133 iclcx134 iclcx135 iclcx136 iclcx137 iclcx138 iclcx139 iclcx140 iclcx141 iclcx142 iclcx143 iclcx144 iclcx145 iclcx146 iclcx147 iclcx148 iclcx149 iclcx150 iclcx151 iclcx152 iclcx153 iclcx154 iclcx155 iclcx156 iclcx157 iclcx158 iclcx159 iclcx160 iclcx161 iclcx162 iclcx163 iclcx164 iclcx165 iclcx166 iclcx167 iclcx168 iclcx169 iclcx170 iclcx171 iclcx172 iclcx173 iclcx174 iclcx175 iclcx176 iclcx177 iclcx178 iclcx179 iclcx180 iclcx181 iclcx182 iclcx183 iclcx184 iclcx185 iclcx186 iclcx187 iclcx188 iclcx189 iclcx190 iclcx191 iclcx192 iclcx193 iclcx194 iclcx195 iclcx196 iclcx197 iclcx198 iclcx199 iclcx200 iclcx201 iclcx202 iclcx203 iclcx204 iclcx205 +iclcx601 +iclcx602 +iclcx603 +iclcx604 +iclcx605 +iclcx606 +iclcx607 +iclcx608 +iclcx609 +iclcx610 +iclcx611 +iclcx612 +iclcx613 +iclcx614 +iclcx615: iclcx206 iclcx207 iclcx208 iclcx209 iclcx210 iclcx211 iclcx212 iclcx213 iclcx214 iclcx215 iclcx216 +iclcx217 iclcx218 iclcx219 iclcx220 iclcx221 iclcx222 iclcx223 iclcx224 iclcx225 iclcx226 iclcx227 iclcx228 +iclcx229 iclcx230 iclcx231 iclcx232 iclcx233 iclcx234 iclcx235 iclcx236 iclcx237 iclcx238 iclcx239 iclcx240 +iclcx241 iclcx242 iclcx243 iclcx244 iclcx245 iclcx246 iclcx247 iclcx248 iclcx249 iclcx250 iclcx251 iclcx252 +iclcx253 iclcx254 iclcx255 iclcx256 iclcx257 iclcx258 iclcx259 iclcx260 iclcx261 iclcx262 iclcx263 iclcx264 +iclcx265 iclcx266 iclcx267 iclcx268 iclcx269 iclcx270 iclcx271 iclcx272 iclcx273 iclcx274 iclcx275 iclcx276 +iclcx277 iclcx278 iclcx279 iclcx280 iclcx281 iclcx282 iclcx283 iclcx284 iclcx285 iclcx286 iclcx287 iclcx288 +iclcx289 +iclcx616 +iclcx617 +iclcx618 +iclcx619: iclcx292 iclcx293 iclcx294 iclcx295 iclcx296 iclcx297 iclcx298 iclcx299 iclcx300 iclcx301 iclcx302 +iclcx303 iclcx304 iclcx305 iclcx306 iclcx307 iclcx308 iclcx309 iclcx310 iclcx311 iclcx312 iclcx313 iclcx314 +iclcx315 iclcx316 iclcx317 iclcx318 iclcx319 iclcx320 iclcx321 iclcx322 iclcx323 iclcx324 iclcx325 iclcx326 +iclcx327 +iclcx620: iclcx493 iclcx494 iclcx495 iclcx496 iclcx497 +iclcx621 +iclcx622 +iclcx623: iclcx348 iclcx349 iclcx350 iclcx351 iclcx352 +iclcx624 +iclcx625: iclcx378 iclcx379 iclcx380 iclcx381 iclcx382 iclcx383 iclcx384 iclcx385 iclcx386 iclcx387 +iclcx626: iclcx391 iclcx392 iclcx393 iclcx394 iclcx395 +iclcx627: iclcx499 iclcx500 iclcx501 iclcx502 iclcx508 +iclcx628: iclcx468 iclcx469 iclcx470 iclcx471 iclcx472 iclcx503 iclcx504 iclcx505 iclcx506 iclcx507 +iclcx629: iclcx484 iclcx485 iclcx486 iclcx487 iclcx488 +iclcx630 +iclcx631: iclcx333 iclcx334 iclcx335 iclcx336 iclcx337 iclcx358 iclcx359 iclcx360 iclcx361 iclcx362 iclcx368 +iclcx369 iclcx370 iclcx371 iclcx372 iclcx409 iclcx410 iclcx411 iclcx412 iclcx413 iclcx414 iclcx415 iclcx416 +iclcx417 iclcx418 +iclcx632: iclcx328 iclcx329 iclcx331 iclcx332 iclcx338 iclcx353 iclcx354 iclcx355 iclcx356 iclcx357 +iclcx633: iclcx428 iclcx434 iclcx435 iclcx436 iclcx437 +iclcx634 +iclcx635: iclcx399 iclcx400 iclcx401 iclcx402 iclcx403 iclcx429 iclcx430 iclcx431 iclcx432 iclcx433 iclcx478 +iclcx479 iclcx480 iclcx481 iclcx482 iclcx483 iclcx489 iclcx490 iclcx491 iclcx492 +iclcx636 +iclcx637: iclcx330 iclcx339 iclcx340 iclcx341 iclcx342 iclcx343 iclcx344 iclcx345 iclcx346 iclcx347 iclcx363 +iclcx364 iclcx365 iclcx366 iclcx367 iclcx373 iclcx374 iclcx375 iclcx376 iclcx377 iclcx388 iclcx389 iclcx390 +iclcx396 iclcx397 iclcx398 iclcx404 iclcx405 iclcx406 iclcx407 iclcx408 iclcx419 iclcx420 iclcx421 iclcx422 +iclcx423 iclcx424 iclcx425 iclcx426 iclcx427 +iclcx638: iclcx448 iclcx449 iclcx450 iclcx451 iclcx452 iclcx453 iclcx454 iclcx455 iclcx456 iclcx457 +iclcx639 +iclcx640 +iclcx641 +-rw-r--r-- 1 sysvrsoft audi-vr 47 Aug 16 19:31 /home/sysvrsoft/rtcontrol/var/iclcx/cae-lsf-BT.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 290 Aug 16 19:32 /home/sysvrsoft/rtcontrol/var/iclcx/cae-lsf-ED.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 785 Aug 16 19:32 /home/sysvrsoft/rtcontrol/var/iclcx/cae-lsf-EK.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 335 Aug 16 19:32 /home/sysvrsoft/rtcontrol/var/iclcx/cae-lsf-GQ.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 1802 Aug 16 19:32 /home/sysvrsoft/rtcontrol/var/iclcx/cae-lsf-PG.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 765 Apr 6 10:25 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx615.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 333 Apr 13 09:09 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx619.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 54 Aug 9 08:52 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx620.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 54 Jun 9 08:42 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx623.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 99 Jun 20 11:43 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx625.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 54 Jun 29 09:25 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx626.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 54 Aug 16 10:20 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx627.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 99 Jun 29 09:33 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx628.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 54 Aug 16 06:43 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx629.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 234 Jul 19 15:29 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx631.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 99 Aug 16 08:20 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx632.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 54 Aug 16 07:39 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx633.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 189 Jun 27 08:42 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx635.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 369 Aug 16 17:58 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx637.hostlist +-rw-r--r-- 1 sysvrsoft audi-vr 99 Aug 5 15:06 /home/sysvrsoft/rtcontrol/var/iclcx/iclcx638.hostlist +scinstall: return code 0 +scinstall: elapsed time 00:00:00.5 diff --git a/Testdaten/rtcinfo/rtcinfo.msg b/Testdaten/rtcinfo/rtcinfo.msg new file mode 100644 index 0000000..ed6b3a5 Binary files /dev/null and b/Testdaten/rtcinfo/rtcinfo.msg differ diff --git a/database/database.go b/database/database.go new file mode 100644 index 0000000..538563a --- /dev/null +++ b/database/database.go @@ -0,0 +1,116 @@ +package database + +import ( + "database/sql" + "log" + + "gitlab.dedyn.io/AUDIAG/rtcutr/domain" + + _ "github.com/go-sql-driver/mysql" +) + +var ( + dbConnection = "rtcusertrdbuser:hurtz3585@tcp(ubodroid-1:3306)/rtcusertrdb" + dbType = "mysql" +) + +// Tool Funktionen +func CreateKnoten(knoten domain.KnotenE) (resKnoten domain.KnotenE, err error) { + conn, err := sql.Open(dbType, dbConnection) + if err != nil { + log.Println("Error while connecting DB: ", err) + } + log.Println("Verbindung hergestellt") + log.Println("Name = ", knoten.Fachbereich) + defer conn.Close() + + res, err := conn.Exec("INSERT INTO knoten VALUES(?,?,?,?)", knoten.Id, knoten.Fachbereich, knoten.Anzahl, knoten.Tag) + if err != nil { + log.Println("Error while executing insert statement", err) + } + lastId, err := res.LastInsertId() + knoten.Id = uint(lastId) + resKnoten = knoten + + return resKnoten, err +} + +func DeleteKnoten(knotenId uint) (result, err error) { + conn, err := sql.Open(dbType, dbConnection) + if err != nil { + log.Println("Error while connecting DB: ", err) + } + log.Println("DB Verbindung hergestellt") + defer conn.Close() + + _, err = conn.Exec("DELETE FROM knoten WHERE id = ?", knotenId) + if err != nil { + log.Fatal("Error while executing DELETE statement", err) + } + return result, err +} + +func ShowKnoten() (knotenArray []domain.KnotenE, err error) { + conn, err := sql.Open(dbType, dbConnection) + if err != nil { + log.Println("Error while connecting DB: ", err) + } + log.Println("DB Verbindung hergestellt") + defer conn.Close() + + results, err := conn.Query("SELECT * FROM knoten") + if err != nil { + log.Fatal("Error while executing SELECt statement", err) + } + + var knoten domain.KnotenE + for results.Next() { + err = results.Scan(&knoten.Id, &knoten.Fachbereich, &knoten.Anzahl, &knoten.Tag) + if err != nil { + log.Fatal("Error: ", err) + } + knotenArray = append(knotenArray, knoten) + } + return knotenArray, err +} + +func GetKnoten(id uint) (knoten domain.KnotenE, err error) { + conn, err := sql.Open(dbType, dbConnection) + if err != nil { + log.Println("Error while connecting DB: ", err) + } + log.Println("DB Verbindung hergestellt") + defer conn.Close() + + results, err := conn.Query("SELECT * FROM knoten WHERE id=?", id) + if err != nil { + log.Fatal("Error while executing SELECt statement", err) + } + for results.Next() { + err = results.Scan(&knoten.Id, &knoten.Fachbereich, &knoten.Anzahl, &knoten.Tag) + if err != nil { + log.Fatal("Error: ", err) + } + } + + return knoten, err +} + +func UpdateKnoten(knoten domain.KnotenE) (resKnoten domain.KnotenE, err error) { + conn, err := sql.Open(dbType, dbConnection) + if err != nil { + log.Println("Error while connecting DB: ", err) + } + log.Println("Verbindung hergestellt") + log.Println("Name = ", knoten.Fachbereich) + defer conn.Close() + + _, err = conn.Exec("UPDATE knoten SET fachbereich=?, anzahl=?, tag=? WHERE id=?", knoten.Fachbereich, knoten.Anzahl, knoten.Tag, knoten.Id) + if err != nil { + log.Println("Error while executing insert statement", err) + } + + resKnoten = knoten + + return resKnoten, err +} diff --git a/database/go.mod b/database/go.mod new file mode 100644 index 0000000..e60cd77 --- /dev/null +++ b/database/go.mod @@ -0,0 +1,5 @@ +module gitlab.dedyn.io/AUDIAG/rtcutr/database + +go 1.18 + +require github.com/go-sql-driver/mysql v1.6.0 // indirect diff --git a/database/go.sum b/database/go.sum new file mode 100644 index 0000000..20c16d6 --- /dev/null +++ b/database/go.sum @@ -0,0 +1,2 @@ +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= diff --git a/domain/domain.go b/domain/domain.go new file mode 100644 index 0000000..365b67e --- /dev/null +++ b/domain/domain.go @@ -0,0 +1,8 @@ +package domain + +type KnotenE struct { + Id uint `json:"id"` + Fachbereich string `json:"fachbereich"` + Anzahl int `json:"anzahl"` + Tag string `json:"tag"` +} diff --git a/domain/go.mod b/domain/go.mod new file mode 100644 index 0000000..1dc7eed --- /dev/null +++ b/domain/go.mod @@ -0,0 +1,3 @@ +module gitlab.dedyn.io/AUDIAG/rtcutr/domain + +go 1.18 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9a2bf56 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module gitlab.dedyn.io/AUDIAG/rtcutr + +go 1.18 diff --git a/rtcutr.go b/rtcutr.go new file mode 100644 index 0000000..54ec910 --- /dev/null +++ b/rtcutr.go @@ -0,0 +1,175 @@ +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "log" + "net/http" + "os" + "strconv" + + "gitlab.dedyn.io/AUDIAG/rtcutr/database" + "gitlab.dedyn.io/AUDIAG/rtcutr/domain" + + "github.com/gorilla/mux" + "github.com/sirupsen/logrus" +) + +const MaxBT = 4 +const MaxED = 186 +const MinED = 100 +const MaxEK = 85 +const MaxGQ = 32 +const MaxPG = 200 + +type Master struct { +} + +func main() { + + fmt.Println("This is rtcusertrd!!!") + logFile, err := os.OpenFile("rtcusertr.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644) + if err != nil { + logrus.Fatal(err) + } + + defer logFile.Close() + + logrus.SetOutput(logFile) + logrus.SetLevel(logrus.InfoLevel) + r := mux.NewRouter() + + r.HandleFunc("/api/kn", createKnotenEHandler).Methods("POST", "OPTIONS") + r.HandleFunc("/api/kn/{id:[0-9]+}", deleteKnotenEHandler).Methods("DELETE", "OPTIONS") + r.HandleFunc("/api/kn", showKnotenEHandler).Methods("GET", "OPTIONS") + r.HandleFunc("/api/kn/{id:[0-9]+}", getKnotenEHandler).Methods("GET", "OPTIONS") + r.HandleFunc("/api/kn/{id:[0-9]+}", updateKnotenEHandler).Methods("PUT", "OPTIONS") + + http.Handle("/", r) + r.Use(mux.CORSMethodMiddleware(r)) + http.ListenAndServe(":8081", r) + logrus.Info("running on localhost, Port 8081") + +} + +func createKnotenEHandler(writer http.ResponseWriter, req *http.Request) { + writer.Header().Set("Access-Control-Allow-Origin", "*") + if req.Method == http.MethodOptions { + return + } + body, err := ioutil.ReadAll(req.Body) + if err != nil { + writer.WriteHeader(http.StatusBadRequest) + } + var knoten domain.KnotenE + json.Unmarshal(body, &knoten) + logrus.Println("Name= ", knoten.Fachbereich) + logrus.Info("creating new Knoten-Eintrag", knoten.Fachbereich) + res, err := database.CreateKnoten(knoten) + if err != nil { + writer.WriteHeader(http.StatusInternalServerError) + } + + b, err := json.Marshal(res) + if err != nil { + logrus.Fatal("Error: ", err) + } + + location := fmt.Sprintf("%s/%d", req.URL.String(), res.Id) + writer.Header().Set("Location:", location) + writer.Header().Set("Content-Type", "application/json") + writer.WriteHeader(http.StatusCreated) + writer.Write(b) +} + +func deleteKnotenEHandler(writer http.ResponseWriter, req *http.Request) { + writer.Header().Set("Access-Control-Allow-Origin", "*") + if req.Method == http.MethodOptions { + return + } + knotenId, _ := strconv.ParseUint(mux.Vars(req)["id"], 10, 0) + logrus.Info("Deleting tool with ID", knotenId) + _, err := database.DeleteKnoten(uint(knotenId)) + if err != nil { + logrus.Fatal("Error: Delete could not be executed", err) + } + writer.WriteHeader(http.StatusNoContent) +} + +func showKnotenEHandler(writer http.ResponseWriter, req *http.Request) { + writer.Header().Set("Access-Control-Allow-Origin", "*") + if req.Method == http.MethodOptions { + return + } + res, err := database.ShowKnoten() + if err != nil { + logrus.Fatal("Error: Knoteneintrag can't be shown ", err) + writer.WriteHeader(http.StatusInternalServerError) + } + + b, err := json.Marshal(res) + if err != nil { + logrus.Fatal("Error: ", err) + } + + location := req.URL.String() + writer.Header().Set("Location:", location) + writer.Header().Set("Content-Type", "application/json") + writer.WriteHeader(http.StatusOK) + writer.Write(b) +} + +func getKnotenEHandler(writer http.ResponseWriter, req *http.Request) { + writer.Header().Set("Access-Control-Allow-Origin", "*") + if req.Method == http.MethodOptions { + return + } + knotenId, _ := strconv.ParseUint(mux.Vars(req)["id"], 10, 0) + res, err := database.GetKnoten(uint(knotenId)) + if err != nil { + logrus.Fatal("Error: Knoteneintrag can't be shown ", err) + writer.WriteHeader(http.StatusInternalServerError) + } + + b, err := json.Marshal(res) + if err != nil { + logrus.Fatal("Error: ", err) + } + + location := req.URL.String() + writer.Header().Set("Location:", location) + writer.Header().Set("Content-Type", "application/json") + writer.WriteHeader(http.StatusOK) + writer.Write(b) +} + +func updateKnotenEHandler(writer http.ResponseWriter, req *http.Request) { + writer.Header().Set("Access-Control-Allow-Origin", "*") + if req.Method == http.MethodOptions { + return + } + body, err := ioutil.ReadAll(req.Body) + if err != nil { + writer.WriteHeader(http.StatusBadRequest) + } + var knoten domain.KnotenE + json.Unmarshal(body, &knoten) + logrus.Println("Name = ", knoten.Fachbereich) + logrus.Info("updating Knoteneintrag", knoten.Fachbereich) + res, err := database.UpdateKnoten(knoten) + if err != nil { + writer.WriteHeader(http.StatusInternalServerError) + } + + b, err := json.Marshal(res) + if err != nil { + log.Fatal("Error: ", err) + } + + location := fmt.Sprintf("%s/%d", req.URL.String(), res.Id) + writer.Header().Set("Location:", location) + writer.Header().Set("Content-Type", "application/json") + writer.WriteHeader(http.StatusOK) + writer.Write(b) +}