-
Notifications
You must be signed in to change notification settings - Fork 926
/
service_plans.go
41 lines (34 loc) · 1 KB
/
service_plans.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package resources
import (
"fmt"
"github.com/cloudfoundry/cli/cf/models"
)
type ServicePlanResource struct {
Resource
Entity ServicePlanEntity
}
type ServicePlanEntity struct {
Name string
ServiceOfferingGuid string `json:"service_guid"`
ServiceOffering ServiceOfferingResource `json:"service"`
}
type ServicePlanDescription struct {
ServiceLabel string
ServicePlanName string
ServiceProvider string
}
func (resource ServicePlanResource) ToFields() (fields models.ServicePlanFields) {
fields.Guid = resource.Metadata.Guid
fields.Name = resource.Entity.Name
return
}
func (planDesc ServicePlanDescription) String() string {
if planDesc.ServiceProvider == "" {
return fmt.Sprintf("%s %s", planDesc.ServiceLabel, planDesc.ServicePlanName) // v2 plan
} else {
return fmt.Sprintf("%s %s %s", planDesc.ServiceLabel, planDesc.ServiceProvider, planDesc.ServicePlanName) // v1 plan
}
}
type ServiceMigrateV1ToV2Response struct {
ChangedCount int `json:"changed_count"`
}