scim2-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
scim2_cli/__init__.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
import requests
|
|
5
|
+
from sphinx_click.rst_to_ansi_formatter import make_rst_to_ansi_formatter
|
|
6
|
+
|
|
7
|
+
DOC_URL = "https://scim2-cli.readthedocs.io/"
|
|
8
|
+
BASE_HEADERS = {
|
|
9
|
+
"Accept": "application/scim+json",
|
|
10
|
+
"Content-Type": "application/scim+json",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@click.group(cls=make_rst_to_ansi_formatter(DOC_URL, group=True))
|
|
15
|
+
@click.argument("url")
|
|
16
|
+
@click.pass_context
|
|
17
|
+
def cli(ctx, url):
|
|
18
|
+
"""SCIM application development CLI."""
|
|
19
|
+
ctx.ensure_object(dict)
|
|
20
|
+
ctx.obj["URL"] = url
|
|
21
|
+
|
|
22
|
+
if not click.get_text_stream("stdin").isatty(): # pragma: no cover
|
|
23
|
+
stdin = click.get_text_stream("stdin").read().strip()
|
|
24
|
+
ctx.obj["STDIN"] = json.loads(stdin)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
|
|
28
|
+
@click.pass_context
|
|
29
|
+
def get(ctx):
|
|
30
|
+
"""Perform a `SCIM GET <https://www.rfc-editor.org/rfc/rfc7644#section-3.4.1>`_ request.
|
|
31
|
+
|
|
32
|
+
Data passed in JSON format to stdin is sent as request arguments:
|
|
33
|
+
|
|
34
|
+
.. code-block:: bash
|
|
35
|
+
|
|
36
|
+
echo '{"foo": "bar"}' | scim https://scim.example get
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
response = requests.get(
|
|
40
|
+
ctx.obj["URL"],
|
|
41
|
+
params=ctx.obj.get("STDIN"),
|
|
42
|
+
headers=BASE_HEADERS,
|
|
43
|
+
allow_redirects=True,
|
|
44
|
+
)
|
|
45
|
+
click.echo(response.text)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
|
|
49
|
+
@click.pass_context
|
|
50
|
+
def post(ctx):
|
|
51
|
+
"""Perform a `SCIM POST <https://www.rfc-editor.org/rfc/rfc7644#section-3.3>`_ request.
|
|
52
|
+
|
|
53
|
+
Data passed in JSON format to stdin is sent as request payload:
|
|
54
|
+
|
|
55
|
+
.. code-block:: bash
|
|
56
|
+
|
|
57
|
+
echo '{"foo": "bar"}' | scim https://scim.example post
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
response = requests.post(
|
|
61
|
+
ctx.obj["URL"],
|
|
62
|
+
json=ctx.obj.get("STDIN"),
|
|
63
|
+
headers=BASE_HEADERS,
|
|
64
|
+
allow_redirects=True,
|
|
65
|
+
)
|
|
66
|
+
click.echo(response.text)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
|
|
70
|
+
@click.pass_context
|
|
71
|
+
def put(ctx):
|
|
72
|
+
"""Perform a `SCIM PUT <https://www.rfc-editor.org/rfc/rfc7644#section-3.5.1>`_ request.
|
|
73
|
+
|
|
74
|
+
Data passed in JSON format to stdin is sent as request payload:
|
|
75
|
+
|
|
76
|
+
.. code-block:: bash
|
|
77
|
+
|
|
78
|
+
echo '{"foo": "bar"}' | scim https://scim.example put
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
response = requests.put(
|
|
82
|
+
ctx.obj["URL"],
|
|
83
|
+
json=ctx.obj.get("STDIN"),
|
|
84
|
+
headers=BASE_HEADERS,
|
|
85
|
+
allow_redirects=True,
|
|
86
|
+
)
|
|
87
|
+
click.echo(response.text)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
|
|
91
|
+
@click.pass_context
|
|
92
|
+
def patch(ctx):
|
|
93
|
+
"""Perform a `SCIM PATCH <https://www.rfc-editor.org/rfc/rfc7644#section-3.5.2>`_ request.
|
|
94
|
+
|
|
95
|
+
Data passed in JSON format to stdin is sent as request payload:
|
|
96
|
+
|
|
97
|
+
.. code-block:: bash
|
|
98
|
+
|
|
99
|
+
echo '{"foo": "bar"}' | scim https://scim.example patch
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
response = requests.patch(
|
|
103
|
+
ctx.obj["URL"],
|
|
104
|
+
json=ctx.obj.get("STDIN"),
|
|
105
|
+
headers=BASE_HEADERS,
|
|
106
|
+
allow_redirects=True,
|
|
107
|
+
)
|
|
108
|
+
click.echo(response.text)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
|
|
112
|
+
@click.pass_context
|
|
113
|
+
def delete(ctx):
|
|
114
|
+
"""Perform a `SCIM DELETE <https://www.rfc-editor.org/rfc/rfc7644#section-3.6>`_ request.
|
|
115
|
+
|
|
116
|
+
Data passed in JSON format to stdin is sent as request payload:
|
|
117
|
+
|
|
118
|
+
.. code-block:: bash
|
|
119
|
+
|
|
120
|
+
echo '{"foo": "bar"}' | scim https://scim.example delete
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
response = requests.delete(
|
|
124
|
+
ctx.obj["URL"],
|
|
125
|
+
json=ctx.obj.get("STDIN"),
|
|
126
|
+
headers=BASE_HEADERS,
|
|
127
|
+
allow_redirects=True,
|
|
128
|
+
)
|
|
129
|
+
click.echo(response.text)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: scim2-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: SCIM application development CLI
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: scim,scim2,provisioning
|
|
7
|
+
Author: Yaal Coop
|
|
8
|
+
Author-email: contact@yaal.coop
|
|
9
|
+
Requires-Python: >=3.10,<4.0
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Web Environment
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
22
|
+
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
23
|
+
Requires-Dist: requests (>=2.32.2,<3.0.0)
|
|
24
|
+
Requires-Dist: sphinx-click-rst-to-ansi-formatter (>=0.1.0,<0.2.0)
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# scim2-cli
|
|
28
|
+
|
|
29
|
+
A scim utility command line.
|
|
30
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
scim2_cli/__init__.py,sha256=7nY5YmPajCgr_s1YjPwJt4h8Sdl6MqnuyDmfzKjTmd8,3367
|
|
2
|
+
scim2_cli-0.1.0.dist-info/METADATA,sha256=YI9rWL5kV2XhjceTY1fO0qhwbXFl1153cIpLX8VWJjc,1047
|
|
3
|
+
scim2_cli-0.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
4
|
+
scim2_cli-0.1.0.dist-info/entry_points.txt,sha256=2OHJdHTlhbxDi3-oT2_nJMa0eoBOKNrKpiL7qFnXiDw,58
|
|
5
|
+
scim2_cli-0.1.0.dist-info/RECORD,,
|