Skip to content

Commit ca35c33

Browse files
committed
📝 docs: Rewrite README; move detailed information into docs/ 🚚
1 parent a64c39e commit ca35c33

17 files changed

+419
-209
lines changed

CODE_OF_CONDUCT.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Code of Conduct
2+
3+
This project follows the [Contributor Covenant](https://www.contributor-covenant.org) Code of Conduct.
4+
5+
## Our Pledge
6+
7+
We as members, contributors, and leaders pledge to make participation in our project and community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
8+
9+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
10+
11+
## Our Standards
12+
13+
Examples of behavior that contributes to a positive environment include:
14+
15+
- Demonstrating empathy and kindness
16+
- Being respectful of differing viewpoints and experiences
17+
- Giving and gracefully accepting constructive feedback
18+
- Taking responsibility and apologizing to those affected by mistakes
19+
- Focusing on what is best for the community
20+
21+
Examples of unacceptable behavior include:
22+
23+
- The use of sexualized language or imagery
24+
- Trolling, insulting, or derogatory comments
25+
- Public or private harassment
26+
- Publishing others’ private information without explicit permission
27+
- Other conduct which could reasonably be considered inappropriate
28+
29+
## Enforcement Responsibilities
30+
31+
Project maintainers are responsible for clarifying and enforcing this code of conduct and will take appropriate and fair corrective action in response to any behavior they deem inappropriate.
32+
33+
## Reporting
34+
35+
If you experience or witness unacceptable behavior, please report it via one of the following channels:
36+
37+
- 💬 [Discord](https://discord.gg/HUVtY5gT6s)
38+
- 📧 [opensource@outscale.com](mailto:opensource@outscale.com)
39+
40+
Reports will be handled confidentially and reviewed promptly.
41+
42+
## Attribution
43+
44+
This Code of Conduct is adapted from the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).

README.md

Lines changed: 44 additions & 209 deletions
Original file line numberDiff line numberDiff line change
@@ -1,242 +1,77 @@
11
[![Project Graduated](https://docs.outscale.com/fr/userguide/_images/Project-Graduated-green.svg)](https://docs.outscale.com/en/userguide/Open-Source-Projects.html)
2-
3-
# Outscale CLI
4-
5-
Official Outscale CLI providing connectors to Outscale API.
6-
72
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
3+
[![](https://dcbadge.limes.pink/api/server/HUVtY5gT6s?style=flat&theme=default-inverted)](https://discord.gg/HUVtY5gT6s)
84

9-
## Maintenance mode !
10-
11-
This project is now in maintenance mode, we will still fix bugs here, but no new features will be work on.
12-
If you want new features, you should use [oapi-cli](https://github.com/outscale/oapi-cli),
13-
which support all of osc-api, and have some syntax suggar to ease complex argument manipulation in comparaison to osc-cli usage.
14-
15-
## Getting Started
16-
17-
18-
### Installing on Macos
19-
20-
osc-cli is available on [brew](https://formulae.brew.sh/formula/osc-cli).
21-
22-
### Installing on Linux
23-
24-
osc-cli is pre-packaged for Linux as a standalone [AppImage](https://appimage.org/).
25-
- Download `osc-cli-x86_64.AppImage` from latest version in [releases](https://github.com/outscale/osc-cli/releases).
26-
- Allow file to be executed by running `chmod a+x osc-cli-x86_64.AppImage`
27-
- Run osc-cli: `./osc-cli-x86_64.AppImage`
28-
29-
Optionally, you can install it for all users: `sudo mv osc-cli-x86_64.AppImage /usr/local/bin/osc-cli` and just run `osc-cli`.
30-
31-
you can also install `osc-cli-git` on Arch Linux using AUR: (`yay -S osc-cli-git`)
32-
33-
#### Note:
34-
35-
if you have this error (or one similar about fuse):
36-
```
37-
fuse: failed to exec fusermount: No such file or directory
38-
39-
Cannot mount AppImage, please check your FUSE setup.
40-
You might still be able to extract the contents of this AppImage
41-
if you run it with the --appimage-extract option.
42-
See https://github.com/AppImage/AppImageKit/wiki/FUSE
43-
for more information
44-
open dir error: No such file or directory
45-
```
46-
47-
You can either install fuse yourself, or execute the appimage with `--appimage-extract-and-run` option
48-
49-
Example:
50-
```
51-
./osc-cli-x86_64.AppImage --appimage-extract-and-run osc-cli api ReadImages --profile=my
52-
```
53-
54-
using `appimage-extract-and-run` extract the content of the AppImage in a temporary directory and execute it,
55-
this operation is a **lot** slower than using fuse, and the fuse solution should be use if posible.
56-
57-
58-
### Installing on Windows
59-
60-
[Check dedicated documentation](windows-setup.md) regarding windows installation.
5+
<p align="center">
6+
<img alt="Terminal Icon" src="https://img.icons8.com/ios-filled/100/console.png" width="100px">
7+
</p>
618

62-
### Installing from Python package
9+
# Outscale CLI (osc-cli)
6310

64-
#### Prerequisites
11+
Official command-line interface for the OUTSCALE API.
6512

66-
You will need [Python 3.6+](https://www.python.org/) or later. Earlier versions including Python 2 are not supported.
67-
68-
#### Pip
69-
70-
You can get the package from [pypi](https://pypi.org/project/osc-sdk/):
71-
```
72-
pip3 install osc-sdk
73-
```
13+
> **Maintenance mode**: bug fixes only; no new features.
14+
> Looking for new features and an improved UX? See **[oapi-cli](https://github.com/outscale/oapi-cli)**.
7415
75-
If you are using Microsoft Windows, see [how to setup osc-cli on Windows](windows-setup.md).
16+
## Quick start
7617

77-
### Installing from sources
18+
**macOS (Homebrew)**
19+
```bash
20+
brew install osc-cli
21+
````
7822

79-
It is a good practice to create a [dedicated virtualenv](https://virtualenv.pypa.io/en/latest/) first. Even if it usually won't harm to install Python libraries directly on the system, better to contain dependencies in a virtual environment.
23+
**Linux (AppImage)**
8024

8125
```bash
82-
python3 -m venv .venv
83-
source .venv/bin/activate
26+
# get the latest release from GitHub
27+
chmod a+x osc-cli-x86_64.AppImage
28+
./osc-cli-x86_64.AppImage
29+
# (optional) sudo mv osc-cli-x86_64.AppImage /usr/local/bin/osc-cli
8430
```
8531

86-
Then install osc-cli in your virtual env:
32+
**Python package**
33+
8734
```bash
88-
pip install -e .
35+
pip3 install osc-sdk
8936
```
9037

91-
## Configure osc-cli
38+
**Windows**
39+
See [docs/install/windows.md](docs/install/windows.md).
9240

93-
The CLI requires a configuration file in `~/.osc/config.json` The content must be a JSON whose contents look like this:
94-
/!\ the old configuration path using `.osc_sdk` folder is **deprecated**. Please use the new one with `.osc`.
95-
```json
96-
{"default":
97-
{"access_key": "MYACCESSKEY",
98-
"secret_key": "MYSECRETKEY",
99-
"region": "eu-west-2"
100-
},
101-
"us":
102-
{"access_key": "MYACCESSKEY",
103-
"secret_key": "MYSECRETKEY",
104-
"host": "outscale.com",
105-
"https": true,
106-
"method": "POST",
107-
"region": "us-east-2"
108-
}
109-
}
110-
```
111-
You can add several profiles for different regions or users.
41+
## Minimal configuration
11242

113-
Optional parameters can be applied to each profile :
114-
* client_certificate: if you need additional security, your pem must include your private key and your certificate
115-
* version: if you want to query another version of the API
43+
Create `~/.osc/config.json`:
11644

11745
```json
118-
{"default":
119-
{"access_key": "MYACCESSKEY",
120-
"secret_key": "MYSECRETKEY",
121-
"client_certificate" : "path_to_your_pem",
122-
"host": "outscale.com",
123-
"https": true,
124-
"method": "POST",
125-
"region": "eu-west-2",
126-
"version": "2018-11-19"
127-
}
46+
{
47+
"default": {
48+
"access_key": "MYACCESSKEY",
49+
"secret_key": "MYSECRETKEY",
50+
"region": "eu-west-2"
51+
}
12852
}
12953
```
13054

131-
## Get osc-cli version
132-
133-
`--version` option will print osc-cli version and exit.
134-
```
135-
osc-cli --version
136-
```
137-
138-
## Activate bash-completion
139-
140-
### Activate the completion for the current bash session
141-
142-
```
143-
source <(osc-cli --bash_completion)
144-
```
145-
146-
### Generate the file to add it in your bach rc:
147-
```
148-
osc-cli --bash_completion > ~/.osc/cli-completion.bash
149-
```
150-
then in your bashrc add:
151-
152-
```
153-
source ~/.osc/cli-completion.bash
154-
```
155-
15655
## Usage
15756

158-
```
159-
osc-cli SERVICE CALL [PROFILE] [CALL-PARAMETERS]
160-
```
161-
or
162-
```
163-
osc-cli --service SERVICE --call CALL [PROFILE] [--CALL_PARAMS ...]
164-
```
165-
with
166-
* SERVICE one of the [services](http://docs.outscale.com) provided by Outscale (`fcu`, `lbu`, `icu`, `eim`, `directlink`, `okms` and `api`)
167-
* CALL the call you request (ie ReadVms, DescribeInstances...)
168-
* PROFILE the profile you want to connect to (optional)
169-
* CALL_PARAMS call arguments which are case-sensitive (optional)
170-
171-
172-
Here is an example of a simple volume creation:
17357
```bash
174-
osc-cli fcu CreateVolume --AvailabilityZone eu-west-2a --Size 10
175-
{
176-
"CreateVolumeResponse": {
177-
"@xmlns": "http://ec2.amazonaws.com/doc/2014-06-15/",
178-
"requestId": "508f428a-9fd8-4a49-9fe6-d0bf311de3b4",
179-
"volumeId": "vol-6a2aa442",
180-
"size": "10",
181-
"snapshotId": null,
182-
"availabilityZone": "eu-west-2a",
183-
"status": "creating",
184-
"createTime": "2019-01-17T12:53:57.836Z",
185-
"volumeType": "standard"
186-
}
187-
}
58+
osc-cli SERVICE CALL [PROFILE] [CALL-PARAMETERS]
59+
# example:
60+
osc-cli api ReadVms
18861
```
18962

190-
Be careful with your quotes ! If you want to pass the string `"12345678"` rather than the integer `12345678` you'll need to quote your quotes:
191-
```bash
192-
$ osc-cli icu CreateAccount --Email "example@email.com" \
193-
--FirstName "Osc" \
194-
--LastName "Cli" \
195-
--Password "12345toto" \
196-
--ZipCode '"92000"' \
197-
--Country "France" \
198-
--CustomerId '"12345678"'
199-
```
63+
## Documentation
20064

201-
Another example with an array of strings into args:
202-
```bash
203-
$ osc-cli api CreateDhcpOptions --DomainName="toot.toot" \
204-
--DomainNameServers="['1.1.1.1']" \
205-
--NtpServers="['1.1.1.1']"
206-
```
65+
* Installation guides (macOS, Linux/AppImage, Windows, pip, source): [docs/install/](docs/install/)
66+
* Configuration and profiles: [docs/configuration.md](docs/configuration.md)
67+
* Usage and argument parsing: [docs/usage.md](docs/usage.md), [docs/argument-parsing.md](docs/argument-parsing.md)
68+
* Shell completion: [docs/completion.md](docs/completion.md)
69+
* Troubleshooting & FAQ: [docs/troubleshooting.md](docs/troubleshooting.md)
20770

208-
Example with a complex structure:
209-
```bash
210-
osc-cli icu CreateListenerRule \
211-
--Instances '[{"InstanceId": "i-12345678"}]' \
212-
--ListenerDescription '{"LoadBalancerName": "osc", "LoadBalancerPort": 80}'
213-
--ListenerRuleDescription '{"RuleName": "hello", "Priority": 100, "PathPattern": "/"}'
214-
```
215-
216-
**Argument Parsing**
217-
```bash
218-
$ osc-cli api example --obj=[1,2] # list
219-
$ osc-cli api example --obj=10 # int
220-
$ osc-cli api example --obj="10" # int
221-
$ osc-cli api example --obj="'10'" # str
222-
$ osc-cli api example --obj=\"10\" # str
223-
224-
$ osc-cli api example --obj="hello" # str
225-
$ osc-cli api example --obj=hello # str
226-
```
227-
**Warning** if you're adding a list which contain strings with specifics characteres, there is a workaround:
228-
```bash
229-
$ osc-cli api example --obj="['vol-12345678', 'vol-87654322']" # list
230-
```
71+
## Contributing
23172

232-
## Authentication
73+
See [CONTRIBUTING.md](CONTRIBUTING.md).
23374

234-
You API crendentials are composed of an Access Key and a Secret Key located in `.osc_sdk/config.json`.
235-
You can list you access keys using your user and password:
236-
```bash
237-
osc-cli icu ListAccessKeys --authentication-method=password --login youremail@company.com --password=Y0URpAssOrd
238-
```
239-
## Contributing
240-
OSC-CLI is an **open source software** licensed under **BSD-3-Clause.**
75+
## License
24176

242-
Patches and discussions are welcome about bugs you've found or features you think are missing. If you would like to help making **osc-cli** better, take a look to [CONTRIBUTING.md](https://github.com/outscale/osc-cli/blob/master/CONTRIBUTING.md) file.
77+
BSD-3-Clause. See [LICENSE](LICENSE).

docs/argument-parsing.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Argument parsing and quoting
2+
3+
Passing strings vs integers:
4+
```bash
5+
# pass "12345678" (string) instead of 12345678 (int)
6+
osc-cli icu CreateAccount --Email "example@email.com" --FirstName "Osc" --LastName "Cli" --Password "12345toto" --ZipCode '"92000"' --Country "France" --CustomerId '"12345678"'
7+
```
8+
9+
Arrays of strings:
10+
```bash
11+
osc-cli api CreateDhcpOptions --DomainName="toot.toot" --DomainNameServers="['1.1.1.1']" --NtpServers="['1.1.1.1']"
12+
```
13+
14+
Complex structures:
15+
```bash
16+
osc-cli icu CreateListenerRule --Instances '[{"InstanceId": "i-12345678"}]' --ListenerDescription '{"LoadBalancerName": "osc", "LoadBalancerPort": 80}' --ListenerRuleDescription '{"RuleName": "hello", "Priority": 100, "PathPattern": "/"}'
17+
```
18+
19+
Type hints:
20+
```bash
21+
osc-cli api example --obj=[1,2] # list
22+
osc-cli api example --obj=10 # int
23+
osc-cli api example --obj="10" # int
24+
osc-cli api example --obj="'10'" # str
25+
osc-cli api example --obj=\"10\" # str
26+
27+
osc-cli api example --obj="hello" # str
28+
osc-cli api example --obj=hello # str
29+
# If your list contains strings with special characters:
30+
osc-cli api example --obj="['vol-12345678', 'vol-87654322']" # list
31+
```

docs/authentication.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Authentication
2+
3+
Credentials live in `~/.osc/config.json` under your profiles.
4+
5+
List your access keys using login/password:
6+
```bash
7+
osc-cli icu ListAccessKeys --authentication-method=password --login youremail@company.com --password Y0URpAsswOrd
8+
```

docs/completion.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Shell completion (bash)
2+
3+
Activate for the current shell:
4+
```bash
5+
source <(osc-cli --bash_completion)
6+
```
7+
8+
Persist it:
9+
```bash
10+
osc-cli --bash_completion > ~/.osc/cli-completion.bash
11+
# then in your ~/.bashrc
12+
source ~/.osc/cli-completion.bash
13+
```

0 commit comments

Comments
 (0)