diff --git a/pkg/apis/servicecatalog/v1beta1/plan.go b/pkg/apis/servicecatalog/v1beta1/plan.go new file mode 100644 index 00000000000..7b688bfffdc --- /dev/null +++ b/pkg/apis/servicecatalog/v1beta1/plan.go @@ -0,0 +1,31 @@ +package v1beta1 + +// GetName returns the plan's name. +func (p *ClusterServicePlan) GetName() string { + return p.Name +} + +// GetName returns the plan's name. +func (p *ServicePlan) GetName() string { + return p.Name +} + +// GetExternalName returns the plan's external name. +func (p *ClusterServicePlan) GetExternalName() string { + return p.Spec.ExternalName +} + +// GetExternalName returns the plan's external name. +func (p *ServicePlan) GetExternalName() string { + return p.Spec.ExternalName +} + +// GetDescription returns the plan description. +func (p *ClusterServicePlan) GetDescription() string { + return p.Spec.Description +} + +// GetDescription returns the plan description. +func (p *ServicePlan) GetDescription() string { + return p.Spec.Description +} diff --git a/pkg/svcat/service-catalog/plan.go b/pkg/svcat/service-catalog/plan.go index a409dfb77bd..a30bf0c6e14 100644 --- a/pkg/svcat/service-catalog/plan.go +++ b/pkg/svcat/service-catalog/plan.go @@ -32,6 +32,19 @@ const ( FieldServiceClassRef = "spec.clusterServiceClassRef.name" ) +// Plan provides a unifying layer of cluster and namespace scoped plan resources. +type Plan interface { + + // GetName returns the plan's name. + GetName() string + + // GetExternalName returns the plan's external name. + GetExternalName() string + + // GetDescription returns the plan description. + GetDescription() string +} + // RetrievePlans lists all plans defined in the cluster. func (sdk *SDK) RetrievePlans(opts *FilterOptions) ([]v1beta1.ClusterServicePlan, error) { plans, err := sdk.ServiceCatalog().ClusterServicePlans().List(v1.ListOptions{})