rename Cluster

This commit is contained in:
Jeff Carr 2024-11-07 05:16:16 -06:00
parent f08a241ebf
commit c7e2a62bbb
1 changed files with 7 additions and 7 deletions

View File

@ -18,10 +18,10 @@ type ViewRepoManager struct {
// ViewAPIClient defines the methods required from the API client. // ViewAPIClient defines the methods required from the API client.
// This is useful if you want to mock this client for testing. // This is useful if you want to mock this client for testing.
type ViewAPIClient interface { 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 StartRepo(ctx context.Context, clusterID string) error
StopRepo(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) GetRepoStatus(ctx context.Context, clusterID string) (string, error)
} }
@ -31,7 +31,7 @@ func NewViewRepoManager(client ViewAPIClient) *ViewRepoManager {
} }
// FindByName retrieves a cluster by name. // 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) cluster, err := m.client.GetRepoByName(ctx, name)
if err != nil { if err != nil {
return nil, fmt.Errorf("error finding cluster by name %q: %w", name, err) 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. // 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 { if cluster == nil {
return errors.New("cluster cannot be 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. // 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 { if cluster == nil {
return errors.New("cluster cannot be 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. // 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) clusters, err := m.client.ListRepos(ctx)
if err != nil { 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. // 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 { if cluster == nil {
return "", errors.New("cluster cannot be nil") return "", errors.New("cluster cannot be nil")
} }