forked from crossplane-contrib/provider-vultr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovider.go
48 lines (38 loc) · 1.15 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
/*
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"
"github.com/crossplane-contrib/provider-vultr/config/kubernetes"
"github.com/crossplane-contrib/provider-vultr/config/nodepools"
"github.com/crossplane-contrib/provider-vultr/config/object"
)
const (
resourcePrefix = "vultr"
modulePath = "github.com/crossplane-contrib/provider-vultr"
)
//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.WithIncludeList(ExternalNameConfigured()),
ujconfig.WithFeaturesPackage("internal/features"),
ujconfig.WithDefaultResourceOptions(
ExternalNameConfigurations(),
))
for _, configure := range []func(provider *ujconfig.Provider){
kubernetes.Configure,
nodepools.Configure,
object.Configure,
} {
configure(pc)
}
pc.ConfigureResources()
return pc
}