-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_secrets.go
46 lines (38 loc) · 1.12 KB
/
app_secrets.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
44
45
46
package nuon
import (
"context"
"github.com/nuonco/nuon-go/client/operations"
"github.com/nuonco/nuon-go/models"
)
func (c *client) GetAppSecrets(ctx context.Context, appID string) ([]*models.AppAppSecret, error) {
resp, err := c.genClient.Operations.GetAppSecrets(&operations.GetAppSecretsParams{
AppID: appID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) CreateAppSecret(ctx context.Context, appID string, req *models.ServiceCreateAppSecretRequest) (*models.AppAppSecret, error) {
resp, err := c.genClient.Operations.CreateAppSecret(&operations.CreateAppSecretParams{
AppID: appID,
Req: req,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) DeleteAppSecret(ctx context.Context, appID, secretID string) (bool, error) {
resp, err := c.genClient.Operations.DeleteAppSecret(&operations.DeleteAppSecretParams{
AppID: appID,
SecretID: secretID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return false, err
}
return resp.IsSuccess(), nil
}