Skip to content

Commit 068cff5

Browse files
committed
initial project
0 parents  commit 068cff5

File tree

7 files changed

+543
-0
lines changed

7 files changed

+543
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
all::
2+
check::
3+
install::

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# kubepl
2+
3+
A [Kubernetes](http://kubernetes.io) client.
4+
5+
## Installation
6+
7+
Using SWI-Prolog 7 or later.
8+
9+
?- pack_install('https://github.com/honnix/kubepl.git').
10+
11+
Source code available and pull requests accepted
12+
[here](https://github.com/honnix/kubepl).
13+
14+
@author Hongxin Liang <hxliang1982@gmail.com>
15+
16+
@license Apache License Version 2.0
17+
18+
## Examples
19+
20+
## License
21+
22+
Licensed under the Apache License, Version 2.0 (the "License");
23+
you may not use this file except in compliance with the License.
24+
You may obtain a copy of the License at
25+
26+
http://www.apache.org/licenses/LICENSE-2.0
27+
28+
Unless required by applicable law or agreed to in writing, software
29+
distributed under the License is distributed on an "AS IS" BASIS,
30+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31+
See the License for the specific language governing permissions and
32+
limitations under the License.

examples/ex1.pl

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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]).

pack.pl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name(kubepl).
2+
version('0.1').
3+
title('Kubernetes Client').
4+
keywords([kubernetes,client]).
5+
author('Hongxin Liang', 'hxliang1982@gmail.com').
6+
packager('Hongxin Liang', 'hxliang1982@gmail.com').
7+
maintainer('Hongxin Liang', 'hxliang1982@gmail.com').
8+
home('https://github.com/honnix/kubepl').
9+
download('https://github.com/honnix/kubepl/archive/v0.1.zip').

0 commit comments

Comments
 (0)