github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/cmd/srv-applet-mgr/apis/account_access_key/pos.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/enums" 9 "github.com/machinefi/w3bstream/pkg/modules/access_key" 10 ) 11 12 // CreateAccountAccessKey create account access key 13 type CreateAccountAccessKey struct { 14 httpx.MethodPost 15 access_key.CreateAccountAccessKeyReq `in:"body"` 16 } 17 18 func (r *CreateAccountAccessKey) Output(ctx context.Context) (interface{}, error) { 19 ca := middleware.MustCurrentAccountFromContext(ctx) 20 return access_key.Create(ca.WithAccount(ctx), &access_key.CreateReq{ 21 IdentityID: ca.AccountID, 22 IdentityType: enums.ACCESS_KEY_IDENTITY_TYPE__ACCOUNT, 23 CreateReqBase: r.CreateAccountAccessKeyReq, 24 }) 25 }