You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-6Lines changed: 37 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,23 @@
1
-
# UpCloud-python-api
2
-
Python client for [UpCloud's API](https://www.upcloud.com/documentation/api/).
1
+
# UpCloud's Python API Client
2
+
OOP-based api client for [UpCloud's API](https://www.upcloud.com/documentation/api/). Features most of the API's functionality and some convenience functions that combine several API endpoints and logic.
3
3
4
-
NOTE: This Python client is still work-in-progress and is not considered production ready.
4
+
NOTE: This Python client is still evolving. Please test all of your use cases thoroughly before actual production use. Using a separate UpCloud account for testing / developing the client is recommended.
5
5
6
6
## Installation
7
7
8
8
```
9
-
pip install --pre upcloud-api-python
9
+
pip install --pre upcloud-api
10
10
11
11
# with older pip:
12
-
pip install upcloud-api-python
12
+
pip install upcloud-api
13
13
```
14
14
15
15
Alternatively, clone the project and run
16
16
```
17
17
python setup.py install
18
18
```
19
19
20
-
**Supported versions** (offline tests pass with tox):
20
+
**Supported versions as of 0.3.0** (offline tests pass with tox):
21
21
22
22
* python 2.6
23
23
* python 2.7
@@ -112,6 +112,11 @@ for server in cluster:
112
112
113
113
```
114
114
115
+
New in 0.3.0: servers can now be defined as dicts without using Server or Storage classes.
116
+
The syntax/attributes are exactly like above and under the hood they are converted to Server and Storage classes.
117
+
This feature is mainly for easier usage of the module from Ansible, but may provide useful elsewhere.
118
+
119
+
115
120
### Stop / Start / Destroy Servers
116
121
```python
117
122
@@ -126,6 +131,18 @@ for server in cluster:
126
131
127
132
```
128
133
134
+
New in 0.3.0: as the success of server.start() or server.destroy() and storage.destroy()
135
+
depend on the Server's `state`, new helpers have been added. The helpers may be called regardless of
136
+
the server's current state.
137
+
138
+
```python
139
+
# makes sure that the server is stopped (blocking wait) and then destroys the server and its storages
140
+
server.stop_and_destroy()
141
+
142
+
# makes sure that the server is started (blocking wait)
143
+
server.ensure_started()
144
+
```
145
+
129
146
### Upgrade a Server
130
147
```python
131
148
@@ -138,6 +155,20 @@ server.start()
138
155
139
156
```
140
157
158
+
### Easy access to servers and their information:
159
+
160
+
New in 0.3.0.
161
+
162
+
```python
163
+
164
+
# returns a public IPv4 (preferred) IPv6 (no public IPv4 was attached) address
165
+
server.get_public_ip()
166
+
167
+
# returns a JSON serializable dict with the server's information (storages and ip-addresses included)
0 commit comments