Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Implement Class interface for cluster and ns classes
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynvs-msft committed Jul 19, 2018
1 parent 3019df2 commit c26a8ae
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
31 changes: 31 additions & 0 deletions pkg/apis/servicecatalog/v1beta1/class.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package v1beta1

// GetName returns the class's name.
func (c *ClusterServiceClass) GetName() string {
return c.Name
}

// GetName returns the class's name.
func (c *ServiceClass) GetName() string {
return c.Name
}

// GetExternalName returns the class's external name.
func (c *ClusterServiceClass) GetExternalName() string {
return c.Spec.ExternalName
}

// GetExternalName returns the class's external name.
func (c *ServiceClass) GetExternalName() string {
return c.Spec.ExternalName
}

// GetDescription returns the class description.
func (c *ClusterServiceClass) GetDescription() string {
return c.Spec.Description
}

// GetDescription returns the class description.
func (c *ServiceClass) GetDescription() string {
return c.Spec.Description
}
13 changes: 13 additions & 0 deletions pkg/svcat/service-catalog/class.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ const (
FieldExternalClassName = "spec.externalName"
)

// Class provides a unifying layer of cluster and namespace scoped class resources.
type Class interface {

// GetName returns the class's name.
GetName() string

// GetExternalName returns the class's external name.
GetExternalName() string

// GetDescription returns the class description.
GetDescription() string
}

// RetrieveClasses lists all classes defined in the cluster.
func (sdk *SDK) RetrieveClasses() ([]v1beta1.ClusterServiceClass, error) {
classes, err := sdk.ServiceCatalog().ClusterServiceClasses().List(v1.ListOptions{})
Expand Down

0 comments on commit c26a8ae

Please sign in to comment.