github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/cmd/srv-applet-mgr/apis/account_access_key/get.go (about) 1 package account_access_key 2 3 import ( 4 "context" 5 6 "github.com/machinefi/w3bstream/cmd/srv-applet-mgr/apis/middleware" 7 "github.com/machinefi/w3bstream/pkg/depends/kit/httptransport/httpx" 8 "github.com/machinefi/w3bstream/pkg/modules/access_key" 9 ) 10 11 // ListAccountAccessKey get api access key list under current account 12 type ListAccountAccessKey struct { 13 httpx.MethodGet 14 access_key.ListReq 15 } 16 17 func (r *ListAccountAccessKey) Path() string { return "/datalist" } 18 19 func (r *ListAccountAccessKey) Output(ctx context.Context) (interface{}, error) { 20 ca := middleware.MustCurrentAccountFromContext(ctx) 21 r.AccountID = ca.AccountID 22 return access_key.List(ctx, &r.ListReq) 23 } 24 25 type ListAccessGroupMetas struct { 26 httpx.MethodGet `summary:"List operator group metas"` 27 } 28 29 func (r *ListAccessGroupMetas) Path() string { return "/operator_group_metas" } 30 31 func (r *ListAccessGroupMetas) Output(_ context.Context) (interface{}, error) { 32 return access_key.OperatorGroupMetaList(), nil 33 } 34 35 type GetAccessKeyByName struct { 36 httpx.MethodGet 37 Name string `in:"path" name:"name"` 38 } 39 40 func (r *GetAccessKeyByName) Path() string { return "/data/:name" } 41 42 func (r *GetAccessKeyByName) Output(ctx context.Context) (interface{}, error) { 43 ca := middleware.MustCurrentAccountFromContext(ctx) 44 return access_key.GetByName(ca.WithAccount(ctx), r.Name) 45 }