generated from crossplane/upjet-provider-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
external_name.go
50 lines (45 loc) · 1.88 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
40
41
42
43
44
45
46
47
48
49
50
/*
Copyright 2022 Upbound Inc.
*/
package config
import "github.com/upbound/upjet/pkg/config"
// ExternalNameConfigs contains all external name configurations for this
// provider.
var ExternalNameConfigs = map[string]config.ExternalName{
// Import requires using a randomly generated ID from provider: nl-2e21sda
"googleworkspace_chrome_policy": config.IdentifierFromProvider,
"googleworkspace_domain": config.ParameterAsIdentifier("domain_name"),
"googleworkspace_domain_alias": config.IdentifierFromProvider,
"googleworkspace_gmail_alias": config.IdentifierFromProvider,
"googleworkspace_group": config.IdentifierFromProvider,
"googleworkspace_group_member": config.IdentifierFromProvider,
"googleworkspace_group_members": config.IdentifierFromProvider,
"googleworkspace_group_settings": config.IdentifierFromProvider,
"googleworkspace_org_unit": config.IdentifierFromProvider,
"googleworkspace_role": config.IdentifierFromProvider,
"googleworkspace_role_assignment": config.IdentifierFromProvider,
"googleworkspace_schema": config.IdentifierFromProvider,
"googleworkspace_user": 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
}