refactor: per-type resources + simplified classification model
Resources renamed from artifactapi_remote to per-type: - artifactapi_remote_generic - artifactapi_remote_docker (with ban_tags) - artifactapi_remote_helm - artifactapi_remote_pypi - artifactapi_remote_npm - artifactapi_remote_rpm - artifactapi_remote_alpine - artifactapi_remote_puppet - artifactapi_remote_terraform (with releases_remote) - artifactapi_remote_goproxy Classification simplified: - patterns: paths to proxy (empty = all, acts as allowlist) - blocklist: paths to deny (checked first) - mutable_patterns: override provider auto-classification - immutable_patterns: override provider auto-classification - Provider handles mutability automatically per package type
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package provider
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func listToStrings(ctx context.Context, l types.List) []string {
|
||||
if l.IsNull() || l.IsUnknown() {
|
||||
return nil
|
||||
}
|
||||
var result []string
|
||||
l.ElementsAs(ctx, &result, false)
|
||||
return result
|
||||
}
|
||||
|
||||
func stringsToList(ctx context.Context, ss []string) types.List {
|
||||
if len(ss) == 0 {
|
||||
return types.ListNull(types.StringType)
|
||||
}
|
||||
elems := make([]types.String, len(ss))
|
||||
for i, s := range ss {
|
||||
elems[i] = types.StringValue(s)
|
||||
}
|
||||
list, _ := types.ListValueFrom(ctx, types.StringType, elems)
|
||||
return list
|
||||
}
|
||||
Reference in New Issue
Block a user