diff --git a/pkg/apis/servicecatalog/v1beta1/class.go b/pkg/apis/servicecatalog/v1beta1/class.go new file mode 100644 index 00000000000..940afd81d6a --- /dev/null +++ b/pkg/apis/servicecatalog/v1beta1/class.go @@ -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 +} diff --git a/pkg/svcat/service-catalog/class.go b/pkg/svcat/service-catalog/class.go index 74053e02eb0..84d6befde31 100644 --- a/pkg/svcat/service-catalog/class.go +++ b/pkg/svcat/service-catalog/class.go @@ -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{})