Add more host-catalog and host-set CLI support (#1567)

Add more host-catalog and host-set CLI support

Co-authored-by: Todd <T.Alan.Knight@gmail.com>
This commit is contained in:
Jeff MitchellandTodd authored and GitHub committed 2021-09-28 09:40:12 -04:00
1 parent a834a14785
commit 7d71618df0
37 files changed
+803 -406

No files matched your search

+15 -6
View File
@@ -95,13 +95,13 @@ type structInfo struct {
// listing
recursiveListing bool
// extraOptions allows specifying extra options that will be created for a
// extraFields allows specifying extra options that will be created for a
// given type, e.g. arguments only valid for one call or purpose and not
// conveyed within the item itself
extraOptions []fieldInfo
extraFields []fieldInfo
// fieldOverrides allows overriding some field behavior without making them
// "new" fields like with extraOptions
// "new" fields like with extraFields
fieldOverrides []fieldInfo
// createResponseTypes controls for which structs response types are created
@@ -156,7 +156,7 @@ var inputStructs = []*structInfo{
listTemplate,
},
pluralResourceName: "scopes",
extraOptions: []fieldInfo{
extraFields: []fieldInfo{
{
Name: "SkipAdminRoleCreation",
ProtoName: "skip_admin_role_creation",
@@ -508,9 +508,18 @@ var inputStructs = []*structInfo{
deleteTemplate,
listTemplate,
},
extraFields: []fieldInfo{
{
Name: "PluginName",
ProtoName: "plugin_name",
FieldType: "string",
SkipDefault: true,
Query: true,
},
},
fieldOverrides: []fieldInfo{
{
Name: "Secrets",
Name: "PluginId",
SkipDefault: true,
},
},
@@ -632,7 +641,7 @@ var inputStructs = []*structInfo{
"CredentialLibraries": {},
"CredentialSources": {},
},
extraOptions: []fieldInfo{
extraFields: []fieldInfo{
{
Name: "HostId",
ProtoName: "host_id",
+5 -5
View File
@@ -44,7 +44,7 @@ type templateInput struct {
ResourcePath string
ParentTypeName string
SliceSubtypes map[string]sliceSubtypeInfo
ExtraOptions []fieldInfo
ExtraFields []fieldInfo
VersionEnabled bool
TypeOnCreate bool
CreateResponseTypes bool
@@ -63,7 +63,7 @@ func fillTemplates() {
Fields: in.generatedStructure.fields,
PluralResourceName: in.pluralResourceName,
ParentTypeName: in.parentTypeName,
ExtraOptions: in.extraOptions,
ExtraFields: in.extraFields,
VersionEnabled: in.versionEnabled,
TypeOnCreate: in.typeOnCreate,
CreateResponseTypes: in.createResponseTypes,
@@ -129,13 +129,13 @@ func fillTemplates() {
}
optionsMap[input.Package] = optionMap
}
// Add in extra defined options
if len(in.extraOptions) > 0 {
// Add in extra defined fields
if len(in.extraFields) > 0 {
optionMap := optionsMap[input.Package]
if optionMap == nil {
optionMap = map[string]fieldInfo{}
}
for _, val := range in.extraOptions {
for _, val := range in.extraFields {
optionMap[val.Name] = val
}
optionsMap[input.Package] = optionMap