pivotal-cf / brokerapi

A Go package for implementing the V2 Open Service Broker API
Apache License 2.0
85 stars 71 forks source link

Ability to implement custom ServicePlanCost? #179

Closed weimel closed 3 years ago

weimel commented 3 years ago

For the given route /v2/catalog, our broker will be expected to return the services with these fields

type ServicePlanMetadata struct {
    DisplayName        string            `json:"displayName,omitempty"`
    Bullets            []string          `json:"bullets,omitempty"`
    Costs              []ServicePlanCost `json:"costs,omitempty"`
    AdditionalMetadata map[string]interface{}
}

type ServicePlanCost struct {
    UnitID     string `json:"unitId"`
    Unit       string `json:"unit"`
    PartNumber string `json:"partNumber"`
}

I know there is an AdditionalMetaData field, but our added fields need to be nested with costs. Is there a way we could implement this custom struct without having to implement our own ServiceBroker interface?

weimel commented 3 years ago

Nevermind we were able to use the AdditionalMetaData to create our own Costs field