Skip to content

Commit f4fd2f2

Browse files
bkircherbegotxe
authored andcommitted
Clean-up markdown a bit
Clean-up markdown files a bit. Get section headers right, use `python` block marker (instead of `Python`), make sure example code is formatted uniformly, and a couple of capitalization fixes.
1 parent 0d8a012 commit f4fd2f2

File tree

2 files changed

+58
-50
lines changed

2 files changed

+58
-50
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ GitHub project.
1616

1717
## Submitting Patches
1818

19-
The gridscale_api_client_python source code is managed using the git distributed source control
19+
The gridscale_api_client_python source code is managed using the git distributed source control
2020
management tool <https://www.git-scm.org/>. Please submit patches accordingly.
21-

README.md

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1+
# gridscale_api_client_python
2+
13
This the official Python wrapper for gridscale's [API](https://gridscale.io/en//api-documentation/index.html). Allowing you to manage your own infrastructure from your own applications.
24

3-
# Prerequisites
5+
## Prerequisites
46

57
First, the Python programming language needs to be installed. This can be done by using the [official downloads](https://www.python.org/downloads/) page.
68

7-
Once done, download and install via [pypi](https://pypi.org)
9+
Once done, download and install via [PyPI](https://pypi.org)
10+
11+
```shell
12+
$ pip3 install gs_api_client
13+
```
814

9-
`pip3 install gs_api_client`
15+
## Introduction
1016

11-
# Introduction
1217
First, you will need your [API credentials](https://my.gridscale.io/Easy/APIs/).
1318

1419
In the [examples.py](examples/examples.py) replace the `AUTH_TOKEN` & `USER_UUID` with your credentials.
1520

16-
# Authentication
21+
## Authentication
1722

1823
These imports and configs need to be setup before other commands can be run. If you do not need synchronous or asynchronous requests, you can leave out `SyncGridscaleApiClient` & `GridscaleApiClient` respectively.
1924

@@ -22,72 +27,76 @@ from gs_api_client import Configuration
2227
from gs_api_client import SyncGridscaleApiClient, GridscaleApiClient
2328

2429
# Initiate the configuration
25-
api_config = Configuration()
26-
api_config.api_key['X-Auth-Token'] = "AUTH_TOKEN"
27-
api_config.api_key['X-Auth-UserId'] = "USER_UUID"
30+
config = Configuration()
31+
config.api_key['X-Auth-Token'] = "AUTH_TOKEN"
32+
config.api_key['X-Auth-UserId'] = "USER_UUID"
2833

2934
# Setup the client
30-
sync_api = SyncGridscaleApiClient(configuration=api_config)
31-
async_api = GridscaleApiClient(configuration=api_config)
35+
sync_api = SyncGridscaleApiClient(configuration=config)
36+
async_api = GridscaleApiClient(configuration=config)
3237
```
3338

34-
# Async vs Sync Clients
39+
## Async vs. sync client
3540

36-
We provide two clients `SyncGridscaleApiClient` & `GridscaleApiClient`. gridscale's API performs long running operations asynchronously in the background while returning a 202 response code, with the request identifier in the `x-request-id` response header.
41+
We provide two clients `SyncGridscaleApiClient` and `GridscaleApiClient`. gridscale's API performs long running operations asynchronously in the background while returning a 202 response code, with the request identifier in the `x-request-id` response header.
3742

3843
The main differences are:
44+
3945
- `GridscaleApiClient` exposes bare gridscale API functionality, while `SyncGridscaleApiClient` adds a convenience layer on top.
4046
- `SyncGridscaleApiClient` determines whether the request is sync or async.
4147
- Makes asynchronous operations behave as if they were synchronous:
4248
- The client will block until the request has finished, successful or not.
4349
- Throws an `AsynchronousApiError` exception, in the case of failure.
4450
- With most `PATCH` and `POST` requests, the synchronous client will return the resulting object instead of an empty body or just the reference.
4551

46-
# Debugging
52+
## Debugging
4753

4854
Adding this line below, will output further information for debugging
4955

50-
```Python
51-
api_config.debug = True
56+
```python
57+
config.debug = True
5258
```
5359

54-
# Access response header
60+
## Access response header
5561

5662
Adding `http_info=True` when instantiating the client, return value will be a tuple of response, response code and response headers (dict).
5763

58-
```Python
64+
```python
5965
sync_api = SyncGridscaleApiClient(http_info=True)
6066
async_api = GridscaleApiClient(http_info=True)
6167
```
6268

63-
# Basic request examples
64-
from pprint import pprint
69+
## Basic request examples
70+
71+
```python
72+
from pprint import pprint
6573

66-
# Get all Servers
67-
pprint(async_api.get_servers())
74+
# Get all servers
75+
pprint(async_api.get_servers())
6876

69-
# Create a Server
70-
pprint(async_api.create_server({'name':'test', 'cores': 1, 'memory': 2}))
77+
# Create a server
78+
pprint(async_api.create_server({'name':'test', 'cores': 1, 'memory': 2}))
7179

72-
# Update a Server
73-
pprint(async_api.update_server('<UUID>', {
74-
'name':'windows production Server',
75-
'cores': 2,
76-
'memory': 4
77-
}))
80+
# Update a server
81+
pprint(async_api.update_server('<UUID>', {
82+
'name':'windows production Server',
83+
'cores': 2,
84+
'memory': 4
85+
}))
7886

79-
# Delete a Server
80-
pprint(client.delete_storage('<UUID>'))
87+
# Delete a server
88+
pprint(client.delete_storage('<UUID>'))
89+
```
8190

82-
# Exhaustive list of all functions
91+
## Exhaustive list of all functions
8392

8493
Inside the [examples.py](examples/examples.py) file, you can see some example requests to get your started. All endpoints are fully documented in our [API](https://gridscale.io/en//api-documentation/index.html)
8594

86-
## Requests
95+
### Requests
8796

8897
- get_request
8998

90-
## Locations
99+
### Locations
91100

92101
- get_locations
93102
- get_location
@@ -99,7 +108,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
99108
- get_location_storages
100109
- get_location_templates
101110

102-
## Servers
111+
### Servers
103112

104113
- get_servers
105114
- get_server
@@ -113,7 +122,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
113122
- update_server_power
114123
- server_power_shutdown
115124

116-
### Server Relations
125+
### Server relations
117126

118127
- get_server_linked_ip
119128
- get_server_linked_ips
@@ -135,7 +144,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
135144
- unlink_network_from_server
136145
- unlink_storage_from_server
137146

138-
## Storages
147+
### Storages
139148

140149
- get_storages
141150
- get_storage
@@ -172,7 +181,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
172181
- get_template_events
173182
- get_deleted_templates
174183

175-
### Marketplace Templates
184+
### Marketplace templates
176185

177186
- get_marketplace_templates
178187
- get_marketplace_template
@@ -181,7 +190,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
181190
- delete_marketplace_template
182191
- get_marketplace_template_events
183192

184-
## Networks
193+
### Networks
185194

186195
- get_network
187196
- get_networks
@@ -191,7 +200,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
191200
- get_network_events
192201
- get_deleted_networks
193202

194-
## IPs
203+
### IP addresses
195204

196205
- get_ips
197206
- get_ip
@@ -201,7 +210,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
201210
- get_ip_events
202211
- get_deleted_ips
203212

204-
## Load Balancers
213+
### Load balancers
205214

206215
- get_loadbalancers
207216
- get_loadbalancer
@@ -211,7 +220,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
211220
- get_loadbalancer_events
212221
- get_deleted_loadbalancers
213222

214-
## PaaS
223+
### PaaS
215224

216225
- get_paas_services
217226
- get_paas_service
@@ -228,7 +237,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
228237
- get_paas_service_templates
229238
- get_deleted_paas_services
230239

231-
## Firewalls
240+
### Firewalls
232241

233242
- get_firewalls
234243
- get_firewall
@@ -237,7 +246,7 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
237246
- delete_firewall
238247
- get_firewall_events
239248

240-
## Iso Images
249+
### ISO images
241250

242251
- get_isoimages
243252
- get_isoimage
@@ -247,12 +256,12 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
247256
- get_isoimage_events
248257
- get_deleted_isoimages
249258

250-
## Labels
259+
### Labels
251260

252261
- get_labels
253262
- get_label
254263

255-
## SSH Keys
264+
### SSH keys
256265

257266
- get_ssh_keys
258267
- get_ssh_key
@@ -261,11 +270,11 @@ Inside the [examples.py](examples/examples.py) file, you can see some example re
261270
- delete_ssh_key
262271
- get_ssh_key_events
263272

264-
## Events
273+
### Events
265274

266275
- event_get_all
267276

268-
## Object Storage
277+
### Object storage
269278

270279
- get_buckets
271280
- get_access_keys

0 commit comments

Comments
 (0)