generated from crossplane/upjet-provider-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provider.go
44 lines (34 loc) · 965 Bytes
/
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
/*
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/cevans111/provider-rancher/config/project"
)
const (
resourcePrefix = "rancher"
modulePath = "github.com/oclc/provider-rancher"
)
//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.WithDefaultResourceOptions(
ExternalNameConfigurations(),
))
for _, configure := range []func(provider *ujconfig.Provider){
// add custom config functions
rancher.Configure,
} {
configure(pc)
}
pc.ConfigureResources()
return pc
}