forked from kyma-project/control-plane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
broker.go
52 lines (43 loc) · 1.07 KB
/
broker.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
42
43
44
45
46
47
48
49
50
51
52
package broker
import (
"strings"
"github.com/pkg/errors"
)
const (
KymaServiceID = "47c9dcbf-ff30-448e-ab36-d3bad66ba281"
KymaServiceName = "kymaruntime"
)
var planIDsMapping = map[string]string{
AzurePlanName: AzurePlanID,
GCPPlanName: GCPPlanID,
}
type KymaEnvironmentBroker struct {
*ServicesEndpoint
*ProvisionEndpoint
*DeprovisionEndpoint
*UpdateEndpoint
*GetInstanceEndpoint
*LastOperationEndpoint
*BindEndpoint
*UnbindEndpoint
*GetBindingEndpoint
*LastBindingOperationEndpoint
}
// Config represents configuration for broker
type Config struct {
EnablePlans EnablePlans `envconfig:"default=azure"`
}
// EnablePlans defines the plans that should be available for provisioning
type EnablePlans []string
// Unmarshal provides custom parsing of enabled plans.
// Implements envconfig.Unmarshal interface.
func (m *EnablePlans) Unmarshal(in string) error {
plans := strings.Split(in, ",")
for _, name := range plans {
if _, exists := planIDsMapping[name]; !exists {
return errors.Errorf("unrecognized %v plan name ", name)
}
}
*m = plans
return nil
}