scim2-cli 0.1.0__tar.gz
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-0.1.0/PKG-INFO +30 -0
- scim2_cli-0.1.0/README.md +3 -0
- scim2_cli-0.1.0/pyproject.toml +121 -0
- scim2_cli-0.1.0/scim2_cli/__init__.py +129 -0
scim2_cli-0.1.0/PKG-INFO
ADDED
|
@@ -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,121 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["poetry-core"]
|
|
3
|
+
build-backend = "poetry.core.masonry.api"
|
|
4
|
+
|
|
5
|
+
[tool.poetry]
|
|
6
|
+
name = "scim2-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "SCIM application development CLI"
|
|
9
|
+
authors = ["Yaal Coop <contact@yaal.coop>"]
|
|
10
|
+
license = "MIT"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
keywords = ["scim", "scim2", "provisioning"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Programming Language :: Python :: 3.9",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Environment :: Web Environment",
|
|
23
|
+
"Programming Language :: Python",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[tool.poetry.dependencies]
|
|
28
|
+
python = "^3.10"
|
|
29
|
+
click = "^8.1.7"
|
|
30
|
+
requests = "^2.32.2"
|
|
31
|
+
sphinx-click-rst-to-ansi-formatter = "^0.1.0"
|
|
32
|
+
|
|
33
|
+
[tool.poetry.group.doc]
|
|
34
|
+
optional = true
|
|
35
|
+
|
|
36
|
+
[tool.poetry.group.dev.dependencies]
|
|
37
|
+
pytest = "^8.2.1"
|
|
38
|
+
pytest-coverage = "^0.0"
|
|
39
|
+
pytest-httpserver = "^1.0.10"
|
|
40
|
+
|
|
41
|
+
[tool.poetry.group.doc.dependencies]
|
|
42
|
+
shibuya = "^2024.5.15"
|
|
43
|
+
sphinx = "^7.3.7"
|
|
44
|
+
sphinx-click = "^6.0.0"
|
|
45
|
+
myst-parser = "^3.0.1"
|
|
46
|
+
|
|
47
|
+
[tool.poetry.scripts]
|
|
48
|
+
scim = "scim2_cli:cli"
|
|
49
|
+
scim2 = "scim2_cli:cli"
|
|
50
|
+
|
|
51
|
+
[tool.coverage.run]
|
|
52
|
+
source = [
|
|
53
|
+
"scim2_cli",
|
|
54
|
+
"tests",
|
|
55
|
+
]
|
|
56
|
+
omit = [".tox/*"]
|
|
57
|
+
branch = true
|
|
58
|
+
|
|
59
|
+
[tool.coverage.report]
|
|
60
|
+
exclude_lines = [
|
|
61
|
+
"@pytest.mark.skip",
|
|
62
|
+
"pragma: no cover",
|
|
63
|
+
"raise NotImplementedError",
|
|
64
|
+
"except ImportError",
|
|
65
|
+
"if app.debug",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[tool.ruff.lint]
|
|
69
|
+
select = [
|
|
70
|
+
"E", # pycodestyle
|
|
71
|
+
"F", # pyflakes
|
|
72
|
+
"I", # isort
|
|
73
|
+
"UP", # pyupgrade
|
|
74
|
+
]
|
|
75
|
+
ignore = [
|
|
76
|
+
"E501", # line-too-long
|
|
77
|
+
"E722", # bare-except
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[tool.ruff.lint.isort]
|
|
81
|
+
force-single-line = true
|
|
82
|
+
|
|
83
|
+
[too.ruff.format]
|
|
84
|
+
docstring-code-format = true
|
|
85
|
+
|
|
86
|
+
[tool.tox]
|
|
87
|
+
legacy_tox_ini = """
|
|
88
|
+
[tox]
|
|
89
|
+
isolated_build = true
|
|
90
|
+
skipsdist = true
|
|
91
|
+
envlist =
|
|
92
|
+
style
|
|
93
|
+
py310
|
|
94
|
+
py311
|
|
95
|
+
py312
|
|
96
|
+
doc
|
|
97
|
+
coverage
|
|
98
|
+
|
|
99
|
+
[testenv]
|
|
100
|
+
allowlist_externals = poetry
|
|
101
|
+
commands =
|
|
102
|
+
poetry install
|
|
103
|
+
poetry run pytest --showlocals --full-trace {posargs}
|
|
104
|
+
|
|
105
|
+
[testenv:style]
|
|
106
|
+
commands =
|
|
107
|
+
pip install pre-commit
|
|
108
|
+
pre-commit run --all-files
|
|
109
|
+
|
|
110
|
+
[testenv:doc]
|
|
111
|
+
commands =
|
|
112
|
+
poetry install --with doc --without dev
|
|
113
|
+
poetry run sphinx-build --builder html doc build/sphinx/html
|
|
114
|
+
poetry run sphinx-build --builder man doc build/sphinx/html
|
|
115
|
+
|
|
116
|
+
[testenv:coverage]
|
|
117
|
+
commands =
|
|
118
|
+
poetry install
|
|
119
|
+
poetry run pytest --cov --cov-fail-under=100 --cov-report term:skip-covered {posargs}
|
|
120
|
+
poetry run coverage html
|
|
121
|
+
"""
|
|
@@ -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)
|