Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardfeng-db committed Mar 11, 2024
1 parent 5cc7421 commit 966f634
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions clusters/resource_library.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ type LibraryResource struct {
compute.Library
}

func (LibraryResource) Aliases() map[string]map[string]string {
return map[string]map[string]string{}
}

func (LibraryResource) CustomizeSchema(s map[string]*schema.Schema) map[string]*schema.Schema {
common.CustomizeSchemaPath(s).AddNewField("cluster_id", &schema.Schema{
Type: schema.TypeString,
Expand Down
7 changes: 6 additions & 1 deletion common/reflect_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ func RegisterResourceProvider(v any, r ResourceProvider) {
if resourceProviderRegistry == nil {
resourceProviderRegistry = make(map[string]ResourceProvider)
}
resourceProviderRegistry[getNameForType(reflect.ValueOf(v).Type())] = r
typeName := getNameForType(reflect.ValueOf(v).Type())
if _, ok := resourceProviderRegistry[typeName]; ok {
errMsg := fmt.Sprintf("%s has already been registered, please avoid registering the same type repeatedly.", typeName)
panic(errMsg)
}
resourceProviderRegistry[typeName] = r
}

// Generic interface for ResourceProvider. Using CustomizeSchema function to keep track of additional information
Expand Down

0 comments on commit 966f634

Please sign in to comment.