From 0a9f28b48e3eb0f580729230d161b4533dc4c840 Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Mon, 1 Jul 2019 11:38:56 -0700 Subject: [PATCH] Question API on ClusterTemplates --- apis/management.cattle.io/v3/cluster_template_types.go | 4 ++++ apis/management.cattle.io/v3/schema/schema.go | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apis/management.cattle.io/v3/cluster_template_types.go b/apis/management.cattle.io/v3/cluster_template_types.go index ce4526e7..6d2ce822 100644 --- a/apis/management.cattle.io/v3/cluster_template_types.go +++ b/apis/management.cattle.io/v3/cluster_template_types.go @@ -45,3 +45,7 @@ type ClusterTemplateRevisionSpec struct { Questions []Question `json:"questions,omitempty"` ClusterConfig *ClusterSpecBase `json:"clusterConfig" norman:"required"` } + +type ClusterTemplateQuestionsOutput struct { + Questions []Question `json:"questions,omitempty"` +} diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 5ea6c83f..89b3381a 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -831,8 +831,15 @@ func clusterTemplateTypes(schemas *types.Schemas) *types.Schemas { TypeName("clusterTemplateRevision", v3.ClusterTemplateRevision{}). AddMapperForType(&Version, v3.ClusterTemplate{}, m.Drop{Field: "namespaceId"}, m.DisplayName{}). AddMapperForType(&Version, v3.ClusterTemplateRevision{}, m.Drop{Field: "namespaceId"}). + MustImport(&Version, v3.ClusterTemplateQuestionsOutput{}). MustImport(&Version, v3.ClusterTemplate{}). - MustImport(&Version, v3.ClusterTemplateRevision{}) + MustImportAndCustomize(&Version, v3.ClusterTemplateRevision{}, func(schema *types.Schema) { + schema.CollectionActions = map[string]types.Action{ + "listquestions": { + Output: "clusterTemplateQuestionsOutput", + }, + } + }) } func clusterScanTypes(schemas *types.Schemas) *types.Schemas {