-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.go
40 lines (30 loc) · 884 Bytes
/
bundle.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
package cli
import (
"context"
"errors"
api "github.com/atricore/josso-api-go"
)
func (c *IdbusApiClient) GetOSGiBundles() ([]api.BundleDescr, error) {
c.logger.Debug("get OSGiBundles: all")
var result []api.BundleDescr
sc, err := c.IdbusServerForOperation("DefaultApiService.GetBundles") // Also hard-coded in generated client
if err != nil {
return result, err
}
ctx := context.WithValue(context.Background(), api.ContextAccessToken, sc.Authn.AccessToken)
req := c.apiClient.DefaultApi.GetBundles(ctx)
req = req.GetBundlesReq(api.GetBundlesReq{})
res, _, err := c.apiClient.DefaultApi.GetBundlesExecute(req)
if err != nil {
c.logger.Errorf("GetBundlesReq. Error %v", err)
return result, err
}
if res.Error != nil {
return result, errors.New(*res.Error)
}
if res.Bundles == nil {
return result, nil
}
result = res.Bundles
return result, nil
}