generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 13
/
facade_security_app.go
58 lines (47 loc) · 2.08 KB
/
facade_security_app.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
47
48
49
50
51
52
53
54
55
56
57
58
package btpcli
import (
"context"
"github.com/SAP/terraform-provider-btp/internal/btpcli/types/xsuaa_authz"
)
func newSecurityAppFacade(cliClient *v2Client) securityAppFacade {
return securityAppFacade{cliClient: cliClient}
}
type securityAppFacade struct {
cliClient *v2Client
}
func (f *securityAppFacade) getCommand() string {
return "security/app"
}
func (f *securityAppFacade) ListByGlobalAccount(ctx context.Context) ([]xsuaa_authz.App, CommandResponse, error) {
return doExecute[[]xsuaa_authz.App](f.cliClient, ctx, NewListRequest(f.getCommand(), map[string]string{
"globalAccount": f.cliClient.GetGlobalAccountSubdomain(),
}))
}
func (f *securityAppFacade) GetByGlobalAccount(ctx context.Context, appId string) (xsuaa_authz.App, CommandResponse, error) {
return doExecute[xsuaa_authz.App](f.cliClient, ctx, NewGetRequest(f.getCommand(), map[string]string{
"globalAccount": f.cliClient.GetGlobalAccountSubdomain(),
"appId": appId,
}))
}
func (f *securityAppFacade) ListBySubaccount(ctx context.Context, subaccountId string) ([]xsuaa_authz.App, CommandResponse, error) {
return doExecute[[]xsuaa_authz.App](f.cliClient, ctx, NewListRequest(f.getCommand(), map[string]string{
"subaccount": subaccountId,
}))
}
func (f *securityAppFacade) GetBySubaccount(ctx context.Context, subaccountId string, appId string) (xsuaa_authz.App, CommandResponse, error) {
return doExecute[xsuaa_authz.App](f.cliClient, ctx, NewGetRequest(f.getCommand(), map[string]string{
"subaccount": subaccountId,
"appId": appId,
}))
}
func (f *securityAppFacade) ListByDirectory(ctx context.Context, directoryId string) ([]xsuaa_authz.App, CommandResponse, error) {
return doExecute[[]xsuaa_authz.App](f.cliClient, ctx, NewListRequest(f.getCommand(), map[string]string{
"directory": directoryId,
}))
}
func (f *securityAppFacade) GetByDirectory(ctx context.Context, directoryId string, appId string) (xsuaa_authz.App, CommandResponse, error) {
return doExecute[xsuaa_authz.App](f.cliClient, ctx, NewGetRequest(f.getCommand(), map[string]string{
"directory": directoryId,
"appId": appId,
}))
}