Skip to content

Commit 3d490f3

Browse files
committed
DOC: Example one-liners
Command examples are provided to serve as a quick use manual. - Examples.md: add the command examples - README.md: link Examples.md
1 parent 529a801 commit 3d490f3

File tree

2 files changed

+169
-1
lines changed

2 files changed

+169
-1
lines changed

Examples.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Usage examples
2+
3+
## Tables of contents
4+
5+
1. [Entity creation and deletion](#entity-creation-and-deletion)
6+
1. [create-account](#create-account)
7+
2. [delete-account](#delete-account)
8+
3. [create-user](#create-user)
9+
4. [delete-user](#delete-user)
10+
5. [create-access-key](#create-access-key)
11+
1. [for an account](#for-an-account)
12+
2. [for a user](#for-a-user)
13+
6. [delete-access-key](#delete-access-key)
14+
15+
## Entity creation and deletion
16+
17+
This page provides quick example one-liners on how to create and delete entities
18+
by using the different routes supported by vaultclient and Vault.
19+
20+
See [Vault's design document]
21+
(https://github.com/scality/IronMan-Vault/blob/master/Design.md) for a recap
22+
on how entities are related in our supported IAM model.
23+
24+
The Vault server is assumed to be running at 127.0.0.1:8500 in the following
25+
examples.
26+
27+
### Accounts
28+
29+
#### create-account
30+
31+
```sh
32+
$ bin/vaultclient create-account --name TestAccount --email account@test.com \
33+
--password accountpassword --host 127.0.0.1
34+
35+
{
36+
"message": {
37+
"code": 201,
38+
"message": "Created",
39+
"body": {
40+
"arn": "arn:aws:iam::117099473272:/TestAccount/",
41+
"id": "117099473272",
42+
"canonicalId": "CER9UNUF89LNFWQCS90RHR0WHTYUW9Q3HY9KBUMSR75V9B4VXG \
43+
J0RF89X8SQEBSG"
44+
}
45+
}
46+
}
47+
```
48+
49+
#### delete-account
50+
51+
```sh
52+
$ bin/vaultclient delete-account --name TestAccount --host 127.0.0.1
53+
54+
{
55+
"message": {
56+
"code": 204,
57+
"message": "No content."
58+
}
59+
}
60+
```
61+
62+
### Users
63+
64+
NB: to create a user, you need to have created an account to which the user
65+
will belong
66+
67+
#### create-user
68+
69+
```sh
70+
$ bin/vaultclient create-user --account-name TestAccount --name TestUser \
71+
--email user@test.com --password userpassword \
72+
--host 127.0.0.1
73+
74+
{
75+
"message": {
76+
"code": 201,
77+
"message": "Created",
78+
"body": {
79+
"arn": "arn:aws:iam::117099473272:/TestUser/",
80+
"id": "5EF3TQIXSXP3QFLF8783TT8ZLO37XJLK",
81+
"name": "TestUser",
82+
"createDate": "2016-02-22T11:24:39+01:00"
83+
}
84+
}
85+
}
86+
```
87+
88+
#### delete-user
89+
90+
```sh
91+
$ bin/vaultclient delete-user --account-name TestAccount --name TestUser \
92+
--host 127.0.0.1
93+
94+
{
95+
"message": {
96+
"code": 204,
97+
"message": "No content."
98+
}
99+
}
100+
```
101+
102+
### Access keys
103+
104+
NB: an access-key is created for a user or for account (not recommended as
105+
it poses security threats)
106+
107+
#### create-access-key
108+
109+
##### for a user
110+
111+
```sh
112+
$ bin/vaultclient create-access-key --account-name TestAccount \
113+
--user-name TestUser --host 127.0.0.1
114+
115+
{
116+
"message": {
117+
"code": 201,
118+
"message": "Created",
119+
"body": {
120+
"accountName": "TestAccount",
121+
"userName": "TestUser",
122+
"status": "Active",
123+
"createDate": "2016-02-22T11:25:10+01:00",
124+
"id": "D4IT2AWSB588GO5J9T00",
125+
"value": "UEEu8tYlsOGGrgf4DAiSZD6apVNPUWqRiPG0nTB6"
126+
}
127+
}
128+
}
129+
```
130+
131+
##### for an account
132+
133+
Creation for account TestAccount (requests authenticated with this key will
134+
be considered as performed by the account itself, not advisable):
135+
136+
```sh
137+
$ bin/vaultclient create-access-key --account-name TestAccount --host 127.0.0.1
138+
139+
{
140+
"message": {
141+
"code": 201,
142+
"message": "Created",
143+
"body": {
144+
"accountName": "TestAccount",
145+
"status": "Active",
146+
"createDate": "2016-02-22T11:25:37+01:00",
147+
"id": "7C66DCVN609K7ZHDBVZ0",
148+
"value": "JXxTT04NxiWb6NcES+rpkHnkXszDq3KxexocJIJ9"
149+
}
150+
}
151+
}
152+
```
153+
154+
#### delete-access-key
155+
156+
```sh
157+
$ bin/vaultclient delete-access-key --id 7C66DCVN609K7ZHDBVZ0 --host 127.0.0.1
158+
159+
{
160+
"message": {
161+
"code": 204,
162+
"message": "No content."
163+
}
164+
}
165+
```

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Vault. This repository also provides an executable shell for Vault, usable as
55
either a CLI or an interactive shell.
66

77
This client supports the protocol described in Vault's
8-
[repository](https://github.com/scality/Vault/blob/master/Protocol.md)
8+
[repository](https://github.com/scality/Vault/blob/master/Protocol.md).
99

1010
## Command-line usage
1111

@@ -52,6 +52,9 @@ $ bin/vaultclient create-account --name account0 --email d3v@null \
5252
}
5353
```
5454

55+
See [examples](./Examples.md) on how to create and delete entities such as
56+
accounts, users and access keys.
57+
5558
## Javascript API usage
5659

5760
Here is a basic example showing how to use the library, and what type of objects

0 commit comments

Comments
 (0)