github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/cmd/srv-applet-mgr/apis/account_access_key/del.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  // DeleteAccountAccessKeyByName delete access key by name under current account
    12  type DeleteAccountAccessKeyByName struct {
    13  	httpx.MethodDelete
    14  	Name string `in:"path" name:"name"`
    15  }
    16  
    17  func (r *DeleteAccountAccessKeyByName) Path() string { return "/:name" }
    18  
    19  func (r *DeleteAccountAccessKeyByName) Output(ctx context.Context) (interface{}, error) {
    20  	ca := middleware.MustCurrentAccountFromContext(ctx)
    21  	return nil, access_key.DeleteByName(ca.WithAccount(ctx), r.Name)
    22  }