-
Notifications
You must be signed in to change notification settings - Fork 0
/
external_name.go
39 lines (34 loc) · 1.24 KB
/
external_name.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
/*
Copyright 2022 Upbound Inc.
*/
package config
import "github.com/crossplane/upjet/pkg/config"
// ExternalNameConfigs contains all external name configurations for this provider.
var ExternalNameConfigs = map[string]config.ExternalName{
"ec_deployment": config.IdentifierFromProvider,
"ec_deployment_extension": config.IdentifierFromProvider,
"ec_deployment_traffic_filter": config.IdentifierFromProvider,
"ec_deployment_traffic_filter_association": config.IdentifierFromProvider,
}
// ExternalNameConfigurations applies all external name configs listed in the
// table ExternalNameConfigs and sets the version of those resources to v1beta1
// assuming they will be tested.
func ExternalNameConfigurations() config.ResourceOption {
return func(r *config.Resource) {
if e, ok := ExternalNameConfigs[r.Name]; ok {
r.ExternalName = e
}
}
}
// ExternalNameConfigured returns the list of all resources whose external name
// is configured manually.
func ExternalNameConfigured() []string {
l := make([]string, len(ExternalNameConfigs))
i := 0
for name := range ExternalNameConfigs {
// $ is added to match the exact string since the format is regex.
l[i] = name + "$"
i++
}
return l
}