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

Commit

Permalink
Implement Plan interface for cluster and ns plans
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynvs-msft committed Jul 19, 2018
1 parent c26a8ae commit c88790b
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/plan.go
Original file line number Diff line number Diff line change
@@ -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
}
13 changes: 13 additions & 0 deletions pkg/svcat/service-catalog/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down

0 comments on commit c88790b

Please sign in to comment.