Refactor: multiple rename to fix the spelling of subtype (#1227)
The definition of 'subtype' is 'a secondary or subordinate type'. The 'T' should not be capitalized (unless it is referring to a type of submarine, which its not).
This commit is contained in:
1 parent
a23d68b0dd
commit
21033a6174
16 files changed
+80
-80
No files matched your search
@@ -55,7 +55,7 @@ type structInfo struct {
|
||||
|
||||
// mappings of names of resources and param names for sub slice types, e.g.
|
||||
// role principals and group members
|
||||
sliceSubTypes map[string]string
|
||||
sliceSubtypes map[string]string
|
||||
|
||||
// outputOnly indicates that we shouldn't create options for setting members
|
||||
// for mapping src field struct
|
||||
@@ -169,7 +169,7 @@ var inputStructs = []*structInfo{
|
||||
deleteTemplate,
|
||||
listTemplate,
|
||||
},
|
||||
sliceSubTypes: map[string]string{
|
||||
sliceSubtypes: map[string]string{
|
||||
"Accounts": "accountIds",
|
||||
},
|
||||
pathArgs: []string{"user"},
|
||||
@@ -194,7 +194,7 @@ var inputStructs = []*structInfo{
|
||||
deleteTemplate,
|
||||
listTemplate,
|
||||
},
|
||||
sliceSubTypes: map[string]string{
|
||||
sliceSubtypes: map[string]string{
|
||||
"Members": "memberIds",
|
||||
},
|
||||
pathArgs: []string{"group"},
|
||||
@@ -229,7 +229,7 @@ var inputStructs = []*structInfo{
|
||||
deleteTemplate,
|
||||
listTemplate,
|
||||
},
|
||||
sliceSubTypes: map[string]string{
|
||||
sliceSubtypes: map[string]string{
|
||||
"Principals": "principalIds",
|
||||
"Grants": "grantStrings",
|
||||
},
|
||||
@@ -364,7 +364,7 @@ var inputStructs = []*structInfo{
|
||||
},
|
||||
pathArgs: []string{"host-set"},
|
||||
parentTypeName: "host-catalog",
|
||||
sliceSubTypes: map[string]string{
|
||||
sliceSubtypes: map[string]string{
|
||||
"Hosts": "hostIds",
|
||||
},
|
||||
versionEnabled: true,
|
||||
@@ -401,7 +401,7 @@ var inputStructs = []*structInfo{
|
||||
listTemplate,
|
||||
},
|
||||
pathArgs: []string{"target"},
|
||||
sliceSubTypes: map[string]string{
|
||||
sliceSubtypes: map[string]string{
|
||||
"HostSets": "hostSetIds",
|
||||
},
|
||||
extraOptions: []fieldInfo{
|
||||
|
||||
@@ -43,7 +43,7 @@ type templateInput struct {
|
||||
CollectionPath string
|
||||
ResourcePath string
|
||||
ParentTypeName string
|
||||
SliceSubTypes map[string]string
|
||||
SliceSubtypes map[string]string
|
||||
ExtraOptions []fieldInfo
|
||||
VersionEnabled bool
|
||||
TypeOnCreate bool
|
||||
@@ -79,9 +79,9 @@ func fillTemplates() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if len(in.sliceSubTypes) > 0 {
|
||||
input.SliceSubTypes = in.sliceSubTypes
|
||||
in.templates = append(in.templates, sliceSubTypeTemplate)
|
||||
if len(in.sliceSubtypes) > 0 {
|
||||
input.SliceSubtypes = in.sliceSubtypes
|
||||
in.templates = append(in.templates, sliceSubtypeTemplate)
|
||||
}
|
||||
|
||||
for _, t := range in.templates {
|
||||
@@ -439,7 +439,7 @@ func (c *Client) Update(ctx context.Context, {{ .ResourceFunctionArg }} string,
|
||||
}
|
||||
`))
|
||||
|
||||
var sliceSubTypeTemplate = template.Must(template.New("").Funcs(
|
||||
var sliceSubtypeTemplate = template.Must(template.New("").Funcs(
|
||||
template.FuncMap{
|
||||
"makeSlice": makeSlice,
|
||||
"snakeCase": snakeCase,
|
||||
@@ -449,7 +449,7 @@ var sliceSubTypeTemplate = template.Must(template.New("").Funcs(
|
||||
).Parse(`
|
||||
{{ $input := . }}
|
||||
{{ range $index, $op := makeSlice "Add" "Set" "Remove" }}
|
||||
{{ range $key, $value := $input.SliceSubTypes }}
|
||||
{{ range $key, $value := $input.SliceSubtypes }}
|
||||
{{ $fullName := print $op $key }}
|
||||
{{ $actionName := kebabCase $fullName }}
|
||||
{{ $resPath := getPathWithAction $input.PathArgs $input.ParentTypeName $actionName }}
|
||||
|
||||
Reference in new issue
Block a user