From 289562da0517102f41e8cff805e3390320aedd95 Mon Sep 17 00:00:00 2001 From: runzexia Date: Wed, 9 Jan 2019 15:15:29 +0800 Subject: [PATCH] add all resources valudate Signed-off-by: runzexia --- pkg/scaffold/resource/addtoscheme.go | 5 +++++ pkg/scaffold/resource/authproxyrole.go | 5 +++++ pkg/scaffold/resource/authproxyrolebinding.go | 5 +++++ pkg/scaffold/resource/authproxyservice.go | 5 +++++ pkg/scaffold/resource/crd.go | 5 +++++ pkg/scaffold/resource/crd_sample.go | 5 +++++ pkg/scaffold/resource/doc.go | 5 +++++ pkg/scaffold/resource/group.go | 5 +++++ pkg/scaffold/resource/register.go | 5 +++++ pkg/scaffold/resource/role.go | 5 +++++ pkg/scaffold/resource/rolebinding.go | 5 +++++ pkg/scaffold/resource/version_suitetest.go | 5 +++++ 12 files changed, 60 insertions(+) diff --git a/pkg/scaffold/resource/addtoscheme.go b/pkg/scaffold/resource/addtoscheme.go index 440d515b5c9..a9127266742 100644 --- a/pkg/scaffold/resource/addtoscheme.go +++ b/pkg/scaffold/resource/addtoscheme.go @@ -43,6 +43,11 @@ func (a *AddToScheme) GetInput() (input.Input, error) { return a.Input, nil } +// Validate validates the values +func (a *AddToScheme) Validate() error { + return a.Resource.Validate() +} + var addResourceTemplate = `{{ .Boilerplate }} package apis diff --git a/pkg/scaffold/resource/authproxyrole.go b/pkg/scaffold/resource/authproxyrole.go index 94c1d69ca84..07c7763e90a 100644 --- a/pkg/scaffold/resource/authproxyrole.go +++ b/pkg/scaffold/resource/authproxyrole.go @@ -41,6 +41,11 @@ func (r *AuthProxyRole) GetInput() (input.Input, error) { return r.Input, nil } +// Validate validates the values +func (r *AuthProxyRole) Validate() error { + return r.Resource.Validate() +} + var proxyRoleTemplate = `apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/pkg/scaffold/resource/authproxyrolebinding.go b/pkg/scaffold/resource/authproxyrolebinding.go index 9ec5ba61197..33417e742d3 100644 --- a/pkg/scaffold/resource/authproxyrolebinding.go +++ b/pkg/scaffold/resource/authproxyrolebinding.go @@ -41,6 +41,11 @@ func (r *AuthProxyRoleBinding) GetInput() (input.Input, error) { return r.Input, nil } +// Validate validates the values +func (r *AuthProxyRoleBinding) Validate() error { + return r.Resource.Validate() +} + var proxyRoleBindinggTemplate = `apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: diff --git a/pkg/scaffold/resource/authproxyservice.go b/pkg/scaffold/resource/authproxyservice.go index 7e08d236613..6c39eb3b663 100644 --- a/pkg/scaffold/resource/authproxyservice.go +++ b/pkg/scaffold/resource/authproxyservice.go @@ -41,6 +41,11 @@ func (r *AuthProxyService) GetInput() (input.Input, error) { return r.Input, nil } +// Validate validates the values +func (r *AuthProxyService) Validate() error { + return r.Resource.Validate() +} + var AuthProxyServiceTemplate = `apiVersion: v1 kind: Service metadata: diff --git a/pkg/scaffold/resource/crd.go b/pkg/scaffold/resource/crd.go index d99b7ae5e14..99862127cd4 100644 --- a/pkg/scaffold/resource/crd.go +++ b/pkg/scaffold/resource/crd.go @@ -61,6 +61,11 @@ func (c *CRD) GetInput() (input.Input, error) { return c.Input, nil } +// Validate validates the values +func (c *CRD) Validate() error { + return c.Resource.Validate() +} + var crdTemplate = `apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: diff --git a/pkg/scaffold/resource/crd_sample.go b/pkg/scaffold/resource/crd_sample.go index ef734aa6516..9f3741a1596 100644 --- a/pkg/scaffold/resource/crd_sample.go +++ b/pkg/scaffold/resource/crd_sample.go @@ -46,6 +46,11 @@ func (c *CRDSample) GetInput() (input.Input, error) { return c.Input, nil } +// Validate validates the values +func (c *CRDSample) Validate() error { + return c.Resource.Validate() +} + var crdSampleTemplate = `apiVersion: {{ .Resource.Group }}.{{ .Domain }}/{{ .Resource.Version }} kind: {{ .Resource.Kind }} metadata: diff --git a/pkg/scaffold/resource/doc.go b/pkg/scaffold/resource/doc.go index 41d02517959..2c4e4c10b86 100644 --- a/pkg/scaffold/resource/doc.go +++ b/pkg/scaffold/resource/doc.go @@ -44,6 +44,11 @@ func (a *Doc) GetInput() (input.Input, error) { return a.Input, nil } +// Validate validates the values +func (a *Doc) Validate() error { + return a.Resource.Validate() +} + var docGoTemplate = `{{ .Boilerplate }} // Package {{.Resource.Version}} contains API Schema definitions for the {{ .Resource.Group }} {{.Resource.Version}} API group diff --git a/pkg/scaffold/resource/group.go b/pkg/scaffold/resource/group.go index f156ff6edd8..856c360bfc5 100644 --- a/pkg/scaffold/resource/group.go +++ b/pkg/scaffold/resource/group.go @@ -41,6 +41,11 @@ func (g *Group) GetInput() (input.Input, error) { return g.Input, nil } +// Validate validates the values +func (g *Group) Validate() error { + return g.Resource.Validate() +} + var groupTemplate = `{{ .Boilerplate }} // Package {{ .Resource.Group }} contains {{ .Resource.Group }} API versions diff --git a/pkg/scaffold/resource/register.go b/pkg/scaffold/resource/register.go index 13c91af61d2..1aaf1ee1247 100644 --- a/pkg/scaffold/resource/register.go +++ b/pkg/scaffold/resource/register.go @@ -41,6 +41,11 @@ func (r *Register) GetInput() (input.Input, error) { return r.Input, nil } +// Validate validates the values +func (r *Register) Validate() error { + return r.Resource.Validate() +} + var registerTemplate = `{{ .Boilerplate }} // NOTE: Boilerplate only. Ignore this file. diff --git a/pkg/scaffold/resource/role.go b/pkg/scaffold/resource/role.go index 466733e79f7..91cb45117c4 100644 --- a/pkg/scaffold/resource/role.go +++ b/pkg/scaffold/resource/role.go @@ -43,6 +43,11 @@ func (r *Role) GetInput() (input.Input, error) { return r.Input, nil } +// Validate validates the values +func (r *Role) Validate() error { + return r.Resource.Validate() +} + var roleTemplate = `apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/pkg/scaffold/resource/rolebinding.go b/pkg/scaffold/resource/rolebinding.go index 43324667953..78f61c0d4ba 100644 --- a/pkg/scaffold/resource/rolebinding.go +++ b/pkg/scaffold/resource/rolebinding.go @@ -43,6 +43,11 @@ func (r *RoleBinding) GetInput() (input.Input, error) { return r.Input, nil } +// Validate validates the values +func (r *RoleBinding) Validate() error { + return r.Resource.Validate() +} + var roleBindingTemplate = `apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: diff --git a/pkg/scaffold/resource/version_suitetest.go b/pkg/scaffold/resource/version_suitetest.go index 232e75f9e8a..cd200a9ecfe 100644 --- a/pkg/scaffold/resource/version_suitetest.go +++ b/pkg/scaffold/resource/version_suitetest.go @@ -43,6 +43,11 @@ func (v *VersionSuiteTest) GetInput() (input.Input, error) { return v.Input, nil } +// Validate validates the values +func (v *VersionSuiteTest) Validate() error { + return v.Resource.Validate() +} + var versionSuiteTestTemplate = `{{ .Boilerplate }} package {{ .Resource.Version }}