Skip to content

Commit 963ca50

Browse files
committed
refactor(providers): centralize built-in provider registry
1 parent 36301d2 commit 963ca50

15 files changed

Lines changed: 124 additions & 218 deletions

File tree

cmd/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"os/signal"
66
"syscall"
77

8-
_ "github.com/404tk/cloudtoolkit/pkg/plugins"
98
"github.com/404tk/cloudtoolkit/runner"
109
"github.com/404tk/cloudtoolkit/runner/console"
1110
"github.com/404tk/cloudtoolkit/utils/cache"

pkg/inventory/inventory.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ package inventory
22

33
import (
44
"errors"
5-
"fmt"
65
"reflect"
76

8-
"github.com/404tk/cloudtoolkit/pkg/plugins"
7+
"github.com/404tk/cloudtoolkit/pkg/providers"
98
"github.com/404tk/cloudtoolkit/pkg/schema"
109
"github.com/404tk/cloudtoolkit/utils"
1110
)
@@ -43,8 +42,5 @@ func IsNil(i schema.Provider) bool {
4342

4443
// nameToProvider returns the provider for a name
4544
func nameToProvider(name string, block schema.Options) (schema.Provider, error) {
46-
if v, ok := plugins.Providers[name]; ok {
47-
return v.Check(block)
48-
}
49-
return nil, fmt.Errorf("invalid provider name found: %s", name)
45+
return providers.New(name, block)
5046
}

pkg/plugins/alibaba.go

Lines changed: 0 additions & 26 deletions
This file was deleted.

pkg/plugins/aws.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

pkg/plugins/azure.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

pkg/plugins/gcp.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

pkg/plugins/huawei.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

pkg/plugins/jdcloud.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

pkg/plugins/plugins.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

pkg/plugins/tencent.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)