@@ -3,6 +3,7 @@ package ovh
3
3
import (
4
4
"fmt"
5
5
"log"
6
+ "time"
6
7
7
8
"github.com/ovh/go-ovh/ovh"
8
9
)
@@ -15,10 +16,15 @@ type Config struct {
15
16
OVHClient * ovh.Client
16
17
}
17
18
18
- /* type used to verify client access to ovh api
19
- */
20
- type PartialMe struct {
21
- Firstname string `json:"firstname"`
19
+ type OvhAuthCurrentCredential struct {
20
+ OvhSupport bool `json:"ovhSupport"`
21
+ Status string `json:"status"`
22
+ ApplicationId int64 `json:"applicationId"`
23
+ CredentialId int64 `json:"credentialId"`
24
+ Rules []ovh.AccessRule `json:"rules"`
25
+ Expiration time.Time `json:"expiration"`
26
+ LastUse time.Time `json:"lastUse"`
27
+ Creation time.Time `json:"creation"`
22
28
}
23
29
24
30
func clientDefault (c * Config ) (* ovh.Client , error ) {
@@ -54,13 +60,13 @@ func (c *Config) loadAndValidate() error {
54
60
return fmt .Errorf ("Error getting ovh client: %q\n " , err )
55
61
}
56
62
57
- var me PartialMe
58
- err = targetClient .Get ("/me " , & me )
63
+ var cred OvhAuthCurrentCredential
64
+ err = targetClient .Get ("/auth/currentCredential " , & cred )
59
65
if err != nil {
60
66
return fmt .Errorf ("OVH client seems to be misconfigured: %q\n " , err )
61
67
}
62
68
63
- log .Printf ("[DEBUG] Logged in on OVH API as %s!" , me . Firstname )
69
+ log .Printf ("[DEBUG] Logged in on OVH API" )
64
70
c .OVHClient = targetClient
65
71
66
72
return nil
0 commit comments