Skip to content

Commit 15bde17

Browse files
committed
doc: add basic documentation
1 parent edef8c4 commit 15bde17

File tree

9 files changed

+64
-16
lines changed

9 files changed

+64
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Check the [reference](https://scim2-cli.readthedocs.io/en/latest/reference.html)
5555
Here is an example of resource creation:
5656

5757
```shell
58-
$ scim2 https://auth.example --headers "Authorization: Bearer 12345" create user --user-name "[email protected]"
58+
$ scim2 --url https://auth.example --header "Authorization: Bearer 12345" create user --user-name "[email protected]"
5959
{
6060
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
6161
"id": "2819c223-7f76-453a-919d-413861904646",
@@ -73,7 +73,7 @@ $ scim2 https://auth.example --headers "Authorization: Bearer 12345" create user
7373
Here is an example of resource query:
7474

7575
```shell
76-
$ scim2 https://auth.example --header "Authorization: Bearer 12345" query user 2819c223-7f76-453a-919d-413861904646
76+
$ scim2 --url https://auth.example --header "Authorization: Bearer 12345" query user 2819c223-7f76-453a-919d-413861904646
7777
{
7878
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
7979
"id": "2819c223-7f76-453a-919d-413861904646",

doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Table of contents
77
.. toctree::
88
:maxdepth: 2
99

10+
tutorial
1011
reference
1112
contributing
1213
changelog

doc/tutorial.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Tutorial
2+
========
3+
4+
The :ref:`cli` command allows you to interact with a SCIM server.
5+
6+
Basic parameters
7+
----------------
8+
9+
In order to connect to a SCIM server you will need to pass the :option:`scim --url` parameter.
10+
You can also pass additional headers, such as authentication ones, with :option:`scim --url`.
11+
12+
.. code-block:: shell
13+
14+
$ scim2 --url https://auth.example --header "Authorization: Bearer 12345" create user --user-name "[email protected]"
15+
{
16+
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
17+
"id": "2819c223-7f76-453a-919d-413861904646",
18+
"userName": "[email protected]",
19+
"meta": {
20+
"resourceType": "User",
21+
"created": "2010-01-23T04:56:22Z",
22+
"lastModified": "2011-05-13T04:42:34Z",
23+
"version": 'W\\/"3694e05e9dff590"',
24+
"location": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646",
25+
},
26+
}
27+
28+
However passing those parameters each time you use the command can be annoying.
29+
To make commands shorter, you can set those parameters once for all by using the :ref:`SCIM_CLI_URL <scim-url-scim_cli_url>` and :ref:`SCIM_CLI_HEADERS <scim-header-scim_cli_headers>` environment vars.
30+
31+
.. code-block:: shell
32+
33+
$ export SCIM_CLI_URL="https://auth.example"
34+
$ export SCIM_CLI_HEADERS="Authorization: Bearer 12345"
35+
$ scim2 create user --user-name "[email protected]"
36+
{
37+
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
38+
"id": "2819c223-7f76-453a-919d-413861904646",
39+
"userName": "[email protected]",
40+
"meta": {
41+
"resourceType": "User",
42+
"created": "2010-01-23T04:56:22Z",
43+
"lastModified": "2011-05-13T04:42:34Z",
44+
"version": 'W\\/"3694e05e9dff590"',
45+
"location": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646",
46+
},
47+
}

scim2_cli/create.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,21 @@ def create_command(ctx, indent, obj: model, *args, **kwargs):
5252
5353
.. code-block:: bash
5454
55-
scim https://scim.example create user --user-name "foo" --name-given-name "bar"
55+
scim create user --user-name "foo" --name-given-name "bar"
5656
5757
Multiple attributes should be passed as JSON payloads:
5858
5959
.. code-block:: bash
6060
61-
scim https://scim.example create user \\
61+
scim create user \\
6262
--user-name "foo" \\
6363
--emails '[{"value":"[email protected]", "primary": true}, {"value": "[email protected]"}]'
6464
6565
Input can also be passed through stdin in JSON format:
6666
6767
.. code-block:: bash
6868
69-
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | scim https://scim.example create user
69+
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | create user
7070
7171
"""
7272
if obj == model():
@@ -103,13 +103,13 @@ def create_cli(ctx, indent):
103103
104104
.. code-block:: bash
105105
106-
scim https://scim.example create user --help
106+
create user --help
107107
108108
If no subcommand is executed, input data is expected to be passed in JSON format to stdin:
109109
110110
.. code-block:: bash
111111
112-
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | scim https://scim.example create
112+
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | create
113113
114114
"""
115115
if ctx.invoked_subcommand is not None:

scim2_cli/delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def delete_cli(ctx, resource_type, id, indent):
2626
2727
.. code-block:: bash
2828
29-
scim https://scim.example delete user 1234
29+
delete user 1234
3030
"""
3131
try:
3232
resource_model = ctx.obj["resource_models"][resource_type]

scim2_cli/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def query_cli(
7474
7575
.. code-block:: bash
7676
77-
echo '{"startIndex": 50, "count": 10}' | scim https://scim.example query user
77+
echo '{"startIndex": 50, "count": 10}' | query user
7878
7979
"""
8080
if resource_type:

scim2_cli/replace.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ def replace_command(ctx, indent, obj: model, *args, **kwargs):
5353
5454
.. code-block:: bash
5555
56-
scim https://scim.example replace user --id "xxxx-yyyy" --user-name "foo" --name-given-name "bar"
56+
replace user --id "xxxx-yyyy" --user-name "foo" --name-given-name "bar"
5757
5858
Multiple attributes should be passed as JSON payloads:
5959
6060
.. code-block:: bash
6161
62-
scim https://scim.example replace user \\
62+
replace user \\
6363
--id "xxxx-yyyy" \\
6464
--user-name "foo" \\
6565
--emails '[{"value":"[email protected]", "primary": true}, {"value": "[email protected]"}]'
@@ -68,7 +68,7 @@ def replace_command(ctx, indent, obj: model, *args, **kwargs):
6868
6969
.. code-block:: bash
7070
71-
echo '{"id": "xxxx-yyyy", "userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | scim https://scim.example replace user
71+
echo '{"id": "xxxx-yyyy", "userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | replace user
7272
7373
"""
7474
if obj == model():
@@ -109,13 +109,13 @@ def replace_cli(ctx, indent):
109109
110110
.. code-block:: bash
111111
112-
scim https://scim.example replace user --help
112+
replace user --help
113113
114114
If no subcommand is executed, input data is expected to be passed in JSON format to stdin:
115115
116116
.. code-block:: bash
117117
118-
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "id": "1234"}' | scim https://scim.example replace user
118+
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "id": "1234"}' | replace user
119119
120120
"""
121121
if ctx.invoked_subcommand is not None:

scim2_cli/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def search_cli(
6666
6767
.. code-block:: bash
6868
69-
echo '{"startIndex": 50, "count": 10}' | scim https://scim.example search user
69+
echo '{"startIndex": 50, "count": 10}' | search user
7070
7171
"""
7272
if ctx.obj.get("stdin"):

scim2_cli/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_cli(ctx, verbose):
1515
1616
.. code-block:: bash
1717
18-
scim https://scim.example test
18+
test
1919
"""
2020
client = ctx.obj["client"]
2121
results = check_server(client)

0 commit comments

Comments
 (0)