1
1
go-ovh
2
2
======
3
3
4
- Lightweight Go wrapper around OVH 's APIs. Handles all the hard work including credential creation and requests signing.
4
+ Lightweight Go wrapper around OVHcloud 's APIs. Handles all the hard work including credential creation and requests signing.
5
5
6
6
[ ![ GoDoc] ( https://godoc.org/github.com/ovh/go-ovh/go-ovh?status.svg )] ( http://godoc.org/github.com/ovh/go-ovh/ovh )
7
7
[ ![ Build Status] ( https://github.com/ovh/go-ovh/actions/workflows/golang-build.yaml/badge.svg?branch=master )] ( https://github.com/ovh/go-ovh/actions?query=workflow:golang-build )
@@ -53,7 +53,7 @@ import (
53
53
54
54
## Configuration
55
55
56
- The straightforward way to use OVH 's API keys is to embed them directly in the
56
+ The straightforward way to use OVHcloud 's API keys is to embed them directly in the
57
57
application code. While this is very convenient, it lacks of elegance and
58
58
flexibility.
59
59
@@ -80,9 +80,9 @@ consumer_key=my_consumer_key
80
80
81
81
Depending on the API you want to use, you may set the `` endpoint `` to:
82
82
83
- * `` ovh-eu `` for OVH Europe API
84
- * `` ovh-us `` for OVH US API
85
- * `` ovh-ca `` for OVH Canada API
83
+ * `` ovh-eu `` for OVHcloud Europe API
84
+ * `` ovh-us `` for OVHcloud US API
85
+ * `` ovh-ca `` for OVHcloud Canada API
86
86
* `` soyoustart-eu `` for So you Start Europe API
87
87
* `` soyoustart-ca `` for So you Start Canada API
88
88
* `` kimsufi-eu `` for Kimsufi Europe API
@@ -100,15 +100,15 @@ project or user.
100
100
101
101
## Register your app
102
102
103
- OVH 's API, like most modern APIs is designed to authenticate both an application and
103
+ OVHcloud 's API, like most modern APIs is designed to authenticate both an application and
104
104
a user, without requiring the user to provide a password. Your application will be
105
105
identified by its "application secret" and "application key" tokens.
106
106
107
107
Hence, to use the API, you must first register your application and then ask your
108
108
user to authenticate on a specific URL. Once authenticated, you'll have a valid
109
109
"consumer key" which will grant your application on specific APIs.
110
110
111
- The user may choose the validity period of its authorization. The default period is
111
+ The user may choose the validity period of his authorization. The default period is
112
112
24h. He may also revoke an authorization at any time. Hence, your application should
113
113
be prepared to receive 403 HTTP errors and prompt the user to re-authenticated.
114
114
@@ -126,7 +126,6 @@ The consumer key has two types of restriction:
126
126
* path: eg. only the ``` GET ``` method on ``` /me ```
127
127
* time: eg. expire in 1 day
128
128
129
-
130
129
Then, get a consumer key. Here's an example on how to generate one.
131
130
132
131
First, create a 'ovh.conf' file in the current directory with the application key and
@@ -282,6 +281,30 @@ func main() {
282
281
}
283
282
```
284
283
284
+ ### Use v1 and v2 API versions
285
+
286
+ When using OVHcloud APIs (not So you Start or Kimsufi ones), you are given the
287
+ opportunity to aim for two API versions. For the European API, for example:
288
+
289
+ - the v1 is reachable through https://eu.api.ovh.com/v1
290
+ - the v2 is reachable through https://eu.api.ovh.com/v2
291
+ - the legacy URL is https://eu.api.ovh.com/1.0
292
+
293
+ Calling ` client.Get ` , you can target the API version you want:
294
+
295
+ ``` go
296
+ client , _ := ovh.NewEndpointClient (" ovh-eu" )
297
+
298
+ // Call to https://eu.api.ovh.com/v1/xdsl/xdsl-yourservice
299
+ client.Get (" /v1/xdsl/xdsl-yourservice" , nil )
300
+
301
+ // Call to https://eu.api.ovh.com/v2/xdsl/xdsl-yourservice
302
+ client.Get (" /v2/xdsl/xdsl-yourservice" , nil )
303
+
304
+ // Legacy call to https://eu.api.ovh.com/1.0/xdsl/xdsl-yourservice
305
+ client.Get (" /xdsl/xdsl-yourservice" , nil )
306
+ ```
307
+
285
308
## API Documentation
286
309
287
310
### Create a client
@@ -310,7 +333,7 @@ Alternatively, you may directly use the low level ``CallAPI`` method.
310
333
- Use `` client.Put() `` for PUT requests
311
334
- Use `` client.Delete() `` for DELETE requests
312
335
313
- Or, for unautenticated requests:
336
+ Or, for unauthenticated requests:
314
337
315
338
- Use `` client.GetUnAuth() `` for GET requests
316
339
- Use `` client.PostUnAuth() `` for POST requests
@@ -444,22 +467,22 @@ go vet ./...
444
467
445
468
## Supported APIs
446
469
447
- ### OVH Europe
470
+ ### OVHcloud Europe
448
471
449
472
- ** Documentation** : https://eu.api.ovh.com/
450
473
- ** Community support
** :
[email protected]
451
474
- ** Console** : https://eu.api.ovh.com/console
452
475
- ** Create application credentials** : https://eu.api.ovh.com/createApp/
453
476
- ** Create script credentials** (all keys at once): https://eu.api.ovh.com/createToken/
454
477
455
- ### OVH US
478
+ ### OVHcloud US
456
479
457
480
- ** Documentation** : https://api.us.ovhcloud.com/
458
481
- ** Console** : https://api.us.ovhcloud.com/console/
459
482
- ** Create application credentials** : https://api.us.ovhcloud.com/createApp/
460
483
- ** Create script credentials** (all keys at once): https://api.us.ovhcloud.com/createToken/
461
484
462
- ### OVH Canada
485
+ ### OVHcloud Canada
463
486
464
487
- ** Documentation** : https://ca.api.ovh.com/
465
488
- ** Community support
** :
[email protected]
0 commit comments