generated from crossplane/upjet-provider-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provider.go
72 lines (62 loc) · 2.14 KB
/
provider.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
Copyright 2021 Upbound Inc.
*/
package config
import (
// Note(turkenh): we are importing this to embed provider schema document
_ "embed"
ujconfig "github.com/upbound/upjet/pkg/config"
beta "github.com/ankasoftco/provider-nsxt/config/beta"
deprecated "github.com/ankasoftco/provider-nsxt/config/deprecated"
dhcp "github.com/ankasoftco/provider-nsxt/config/dhcp"
dns "github.com/ankasoftco/provider-nsxt/config/dns"
evpn "github.com/ankasoftco/provider-nsxt/config/evpn"
firewall "github.com/ankasoftco/provider-nsxt/config/firewall"
gatewaysandrouting "github.com/ankasoftco/provider-nsxt/config/gateways_and_routing"
groupingandtagging "github.com/ankasoftco/provider-nsxt/config/grouping_and_tagging"
ipam "github.com/ankasoftco/provider-nsxt/config/ipam"
loadbalancer "github.com/ankasoftco/provider-nsxt/config/load_balancer"
multitenancy "github.com/ankasoftco/provider-nsxt/config/multitenancy"
ospf "github.com/ankasoftco/provider-nsxt/config/ospf"
segments "github.com/ankasoftco/provider-nsxt/config/segments"
vpn "github.com/ankasoftco/provider-nsxt/config/vpn"
)
const (
resourcePrefix = "nsxt"
modulePath = "github.com/ankasoftco/provider-nsxt"
)
//go:embed schema.json
var providerSchema string
//go:embed provider-metadata.yaml
var providerMetadata string
// GetProvider returns provider configuration
func GetProvider() *ujconfig.Provider {
pc := ujconfig.NewProvider([]byte(providerSchema), resourcePrefix, modulePath, []byte(providerMetadata),
ujconfig.WithRootGroup("crossplane.io"),
ujconfig.WithIncludeList(ExternalNameConfigured()),
ujconfig.WithFeaturesPackage("internal/features"),
ujconfig.WithDefaultResourceOptions(
ExternalNameConfigurations(),
))
for _, configure := range []func(provider *ujconfig.Provider){
// add custom config functions
dhcp.Configure,
dns.Configure,
evpn.Configure,
firewall.Configure,
gatewaysandrouting.Configure,
groupingandtagging.Configure,
ipam.Configure,
loadbalancer.Configure,
multitenancy.Configure,
ospf.Configure,
segments.Configure,
vpn.Configure,
beta.Configure,
deprecated.Configure,
} {
configure(pc)
}
pc.ConfigureResources()
return pc
}