|
| 1 | +:- module(ex1, []). |
| 2 | + |
| 3 | +:- use_module(library(kubepl/sugar)). |
| 4 | +:- use_module(library(kubepl/kubepl)). |
| 5 | + |
| 6 | +:- debug(ex1). |
| 7 | + |
| 8 | +ex1_1(IP) :- |
| 9 | + %% don't ask me why they are here |
| 10 | + expand_file_name('~/Developer/ms_store/ssl/ca.pem', [CA]), |
| 11 | + expand_file_name('~/Developer/ms_store/ssl/admin.pem', [Cert]), |
| 12 | + expand_file_name('~/Developer/ms_store/ssl/admin-key.pem', [Key]), |
| 13 | + atomic_list_concat(['https://',IP,'/api'], URI), |
| 14 | + initialize(URI, |
| 15 | + 'v1', |
| 16 | + auth(ssl, [ |
| 17 | + cacert_file(CA), |
| 18 | + certificate_file(Cert), |
| 19 | + key_file(Key), |
| 20 | + cert_verify_hook(cert_accept_any) |
| 21 | + ]), |
| 22 | + [], |
| 23 | + Client), |
| 24 | + Client=>create(namespaces, _{}, [pretty=true], _{metadata:_{name:test1}}, Response), |
| 25 | + debug(ex1, 'Response ~w', [Response]). |
| 26 | + |
| 27 | +ex1_2(IP) :- |
| 28 | + %% don't ask me why they are here |
| 29 | + expand_file_name('~/Developer/ms_store/ssl/ca.pem', [CA]), |
| 30 | + expand_file_name('~/Developer/ms_store/ssl/admin.pem', [Cert]), |
| 31 | + expand_file_name('~/Developer/ms_store/ssl/admin-key.pem', [Key]), |
| 32 | + atomic_list_concat(['https://',IP,'/api'], URI), |
| 33 | + initialize(URI, |
| 34 | + auth(ssl, [ |
| 35 | + cacert_file(CA), |
| 36 | + certificate_file(Cert), |
| 37 | + key_file(Key), |
| 38 | + cert_verify_hook(cert_accept_any) |
| 39 | + ]), |
| 40 | + [], |
| 41 | + Client), |
| 42 | + Client=>get('', _{}, [pretty=true], Response), |
| 43 | + debug(ex1, 'Response ~w', [Response]). |
| 44 | + |
| 45 | +ex1_3(IP) :- |
| 46 | + %% don't ask me why they are here |
| 47 | + expand_file_name('~/Developer/ms_store/ssl/ca.pem', [CA]), |
| 48 | + expand_file_name('~/Developer/ms_store/ssl/admin.pem', [Cert]), |
| 49 | + expand_file_name('~/Developer/ms_store/ssl/admin-key.pem', [Key]), |
| 50 | + atomic_list_concat(['https://',IP,'/apis'], URI), |
| 51 | + initialize(URI, |
| 52 | + auth(ssl, [ |
| 53 | + cacert_file(CA), |
| 54 | + certificate_file(Cert), |
| 55 | + key_file(Key), |
| 56 | + cert_verify_hook(cert_accept_any) |
| 57 | + ]), |
| 58 | + [], |
| 59 | + Client), |
| 60 | + Client=>get('', _{}, [pretty=true], Response1), |
| 61 | + debug(ex1, 'Response ~w', [Response1]), |
| 62 | + Client=>get('extensions', _{}, [pretty=true], Response2), |
| 63 | + debug(ex1, 'Response ~w', [Response2]). |
| 64 | + |
| 65 | +ex1_4(IP) :- |
| 66 | + %% don't ask me why they are here |
| 67 | + expand_file_name('~/Developer/ms_store/ssl/ca.pem', [CA]), |
| 68 | + expand_file_name('~/Developer/ms_store/ssl/admin.pem', [Cert]), |
| 69 | + expand_file_name('~/Developer/ms_store/ssl/admin-key.pem', [Key]), |
| 70 | + atomic_list_concat(['https://',IP,'/version'], URI), |
| 71 | + initialize(URI, |
| 72 | + auth(ssl, [ |
| 73 | + cacert_file(CA), |
| 74 | + certificate_file(Cert), |
| 75 | + key_file(Key), |
| 76 | + cert_verify_hook(cert_accept_any) |
| 77 | + ]), |
| 78 | + [], |
| 79 | + Client), |
| 80 | + Client=>get('', _{}, [pretty=true], Response), |
| 81 | + debug(ex1, 'Response ~w', [Response]). |
| 82 | + |
| 83 | +ex1_5(IP) :- |
| 84 | + %% don't ask me why they are here |
| 85 | + expand_file_name('~/Developer/ms_store/ssl/ca.pem', [CA]), |
| 86 | + expand_file_name('~/Developer/ms_store/ssl/admin.pem', [Cert]), |
| 87 | + expand_file_name('~/Developer/ms_store/ssl/admin-key.pem', [Key]), |
| 88 | + atomic_list_concat(['https://',IP,'/api'], URI), |
| 89 | + initialize(URI, |
| 90 | + 'v1', |
| 91 | + auth(ssl, [ |
| 92 | + cacert_file(CA), |
| 93 | + certificate_file(Cert), |
| 94 | + key_file(Key), |
| 95 | + cert_verify_hook(cert_accept_any) |
| 96 | + ]), |
| 97 | + [], |
| 98 | + Client), |
| 99 | + Client=>proxy_get(pods, _{namespace:'ms-store', name:wso2am}, [path='test'], Response), |
| 100 | + debug(ex1, 'Response ~w', [Response]). |
0 commit comments