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