- Fix target delete URL path mismatch (/targets/ -> /target/) - Implement target create/delete server handlers with proper validation - Add DeleteTarget method with force flag and mutex locking to SCSITargetService - Implement full LU management: create/list/delete through CLI, client, and server - Add TPGT list command to show target portal group tags - Add unit tests for target/LU router handlers and SCSI service Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
26 lines
602 B
Go
26 lines
602 B
Go
package client
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/url"
|
|
|
|
"github.com/gostor/gotgt/pkg/api"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
// TpgtList lists TPGTs for a target in the SCSI Target.
|
|
func (cli *Client) TpgtList(ctx context.Context, options api.TpgtListOptions) ([]api.TpgtInfo, error) {
|
|
var tpgts []api.TpgtInfo
|
|
query := url.Values{}
|
|
if options.TargetName != "" {
|
|
query.Set("target", options.TargetName)
|
|
}
|
|
resp, err := cli.get(ctx, "/target/tpgt/list", query, nil)
|
|
if err != nil {
|
|
return tpgts, err
|
|
}
|
|
err = json.NewDecoder(resp.body).Decode(&tpgts)
|
|
ensureReaderClosed(resp)
|
|
return tpgts, err
|
|
}
|