-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneral.go
43 lines (35 loc) · 1.01 KB
/
general.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package nuon
import (
"context"
"github.com/nuonco/nuon-go/client/operations"
"github.com/nuonco/nuon-go/models"
)
// general methods
func (c *client) GetCurrentUser(ctx context.Context) (*models.AppAccount, error) {
resp, err := c.genClient.Operations.GetCurrentUser(&operations.GetCurrentUserParams{
Context: ctx,
}, c.getApiKeyAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) GetCLIConfig(ctx context.Context) (*models.ServiceCLIConfig, error) {
resp, err := c.genClient.Operations.GetCLIConfig(&operations.GetCLIConfigParams{
Context: ctx,
})
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) GetCloudPlatformRegions(ctx context.Context, cloudPlatform string) ([]*models.AppCloudPlatformRegion, error) {
resp, err := c.genClient.Operations.GetCloudPlatformRegions(&operations.GetCloudPlatformRegionsParams{
Context: ctx,
CloudPlatform: cloudPlatform,
})
if err != nil {
return nil, err
}
return resp.Payload, nil
}