rename Cluster
This commit is contained in:
parent
f08a241ebf
commit
c7e2a62bbb
14
interface.go
14
interface.go
|
@ -18,10 +18,10 @@ type ViewRepoManager struct {
|
|||
// ViewAPIClient defines the methods required from the API client.
|
||||
// This is useful if you want to mock this client for testing.
|
||||
type ViewAPIClient interface {
|
||||
GetRepoByName(ctx context.Context, name string) (*virtbuf.NewCluster, error)
|
||||
GetRepoByName(ctx context.Context, name string) (*virtbuf.Cluster, error)
|
||||
StartRepo(ctx context.Context, clusterID string) error
|
||||
StopRepo(ctx context.Context, clusterID string) error
|
||||
ListRepos(ctx context.Context) ([]*virtbuf.NewCluster, error)
|
||||
ListRepos(ctx context.Context) ([]*virtbuf.Cluster, error)
|
||||
GetRepoStatus(ctx context.Context, clusterID string) (string, error)
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ func NewViewRepoManager(client ViewAPIClient) *ViewRepoManager {
|
|||
}
|
||||
|
||||
// FindByName retrieves a cluster by name.
|
||||
func (m *ViewRepoManager) FindByName(ctx context.Context, name string) (*virtbuf.NewCluster, error) {
|
||||
func (m *ViewRepoManager) FindByName(ctx context.Context, name string) (*virtbuf.Cluster, error) {
|
||||
cluster, err := m.client.GetRepoByName(ctx, name)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error finding cluster by name %q: %w", name, err)
|
||||
|
@ -40,7 +40,7 @@ func (m *ViewRepoManager) FindByName(ctx context.Context, name string) (*virtbuf
|
|||
}
|
||||
|
||||
// Start initiates the startup process for the specified cluster.
|
||||
func (m *ViewRepoManager) Start(ctx context.Context, cluster *virtbuf.NewCluster) error {
|
||||
func (m *ViewRepoManager) Start(ctx context.Context, cluster *virtbuf.Cluster) error {
|
||||
if cluster == nil {
|
||||
return errors.New("cluster cannot be nil")
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func (m *ViewRepoManager) Start(ctx context.Context, cluster *virtbuf.NewCluster
|
|||
}
|
||||
|
||||
// Stop halts the specified cluster.
|
||||
func (m *ViewRepoManager) Stop(ctx context.Context, cluster *virtbuf.NewCluster) error {
|
||||
func (m *ViewRepoManager) Stop(ctx context.Context, cluster *virtbuf.Cluster) error {
|
||||
if cluster == nil {
|
||||
return errors.New("cluster cannot be nil")
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func (m *ViewRepoManager) Stop(ctx context.Context, cluster *virtbuf.NewCluster)
|
|||
}
|
||||
|
||||
// List retrieves all available clusters.
|
||||
func (m *ViewRepoManager) List(ctx context.Context) ([]*virtbuf.NewCluster, error) {
|
||||
func (m *ViewRepoManager) List(ctx context.Context) ([]*virtbuf.Cluster, error) {
|
||||
/*
|
||||
clusters, err := m.client.ListRepos(ctx)
|
||||
if err != nil {
|
||||
|
@ -80,7 +80,7 @@ func (m *ViewRepoManager) List(ctx context.Context) ([]*virtbuf.NewCluster, erro
|
|||
}
|
||||
|
||||
// Status checks the current status of a specified cluster.
|
||||
func (m *ViewRepoManager) Status(ctx context.Context, cluster *virtbuf.NewCluster) (string, error) {
|
||||
func (m *ViewRepoManager) Status(ctx context.Context, cluster *virtbuf.Cluster) (string, error) {
|
||||
if cluster == nil {
|
||||
return "", errors.New("cluster cannot be nil")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue