2020-04-07 04:43:16 +02:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"path/filepath"
|
|
|
|
|
2021-03-17 14:20:05 +01:00
|
|
|
"github.com/pulumi/pulumi/pkg/v3/resource/deploy/deploytest"
|
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
|
2020-04-07 04:43:16 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func GetSchema(schemaDirectoryPath, providerName string) ([]byte, error) {
|
|
|
|
return ioutil.ReadFile(filepath.Join(schemaDirectoryPath, providerName+".json"))
|
|
|
|
}
|
|
|
|
|
|
|
|
func AWS(schemaDirectoryPath string) (plugin.Provider, error) {
|
|
|
|
schema, err := GetSchema(schemaDirectoryPath, "aws")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &deploytest.Provider{
|
|
|
|
GetSchemaF: func(version int) ([]byte, error) {
|
|
|
|
return schema, nil
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
2020-06-30 03:10:34 +02:00
|
|
|
|
2020-10-06 07:57:52 +02:00
|
|
|
func Azure(schemaDirectoryPath string) (plugin.Provider, error) {
|
|
|
|
schema, err := GetSchema(schemaDirectoryPath, "azure")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &deploytest.Provider{
|
|
|
|
GetSchemaF: func(version int) ([]byte, error) {
|
|
|
|
return schema, nil
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-04-16 14:04:42 +02:00
|
|
|
func AzureNative(schemaDirectoryPath string) (plugin.Provider, error) {
|
|
|
|
schema, err := GetSchema(schemaDirectoryPath, "azure-native")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &deploytest.Provider{
|
|
|
|
GetSchemaF: func(version int) ([]byte, error) {
|
|
|
|
return schema, nil
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2020-06-30 03:10:34 +02:00
|
|
|
func Random(schemaDirectoryPath string) (plugin.Provider, error) {
|
|
|
|
schema, err := GetSchema(schemaDirectoryPath, "random")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &deploytest.Provider{
|
|
|
|
GetSchemaF: func(version int) ([]byte, error) {
|
|
|
|
return schema, nil
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
2020-08-05 18:15:36 +02:00
|
|
|
|
|
|
|
func Kubernetes(schemaDirectoryPath string) (plugin.Provider, error) {
|
|
|
|
schema, err := GetSchema(schemaDirectoryPath, "kubernetes")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &deploytest.Provider{
|
|
|
|
GetSchemaF: func(version int) ([]byte, error) {
|
|
|
|
return schema, nil
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|