1
0
mirror of https://github.com/rancher/types.git synced 2025-09-03 06:04:24 +00:00

Add Import Yaml Action and types

Import action for project and cluster
New struct:
1. ImportClusterYamlInput
2. ImportProjectYamlInput
3. ImportYamlOutput
This commit is contained in:
Yuxing
2018-04-16 17:05:03 +08:00
committed by Darren Shepherd
parent 18af11c49a
commit 49e0df4b2f
8 changed files with 139 additions and 0 deletions

View File

@@ -238,3 +238,16 @@ type ClusterRegistrationTokenStatus struct {
type GenerateKubeConfigOutput struct {
Config string `json:"config"`
}
type ImportClusterYamlInput struct {
Yaml string `json:"yaml,omitempty"`
}
type ImportProjectYamlInput struct {
Yaml string `json:"yaml,omitempty"`
Namespace string `json:"namespace,omitempty"`
}
type ImportYamlOutput struct {
OutputMessage string `json:"outputMessage,omitempty"`
}

View File

@@ -139,6 +139,8 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
MustImport(&Version, v3.ClusterEvent{}).
MustImport(&Version, v3.ClusterRegistrationToken{}).
MustImport(&Version, v3.GenerateKubeConfigOutput{}).
MustImport(&Version, v3.ImportClusterYamlInput{}).
MustImport(&Version, v3.ImportYamlOutput{}).
MustImportAndCustomize(&Version, v3.Cluster{}, func(schema *types.Schema) {
schema.MustCustomizeField("name", func(field types.Field) types.Field {
field.Type = "dnsLabel"
@@ -149,6 +151,10 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
schema.ResourceActions["generateKubeconfig"] = types.Action{
Output: "generateKubeConfigOutput",
}
schema.ResourceActions["importYaml"] = types.Action{
Input: "importClusterYamlInput",
Output: "importYamlOutput",
}
})
}
@@ -166,12 +172,18 @@ func authzTypes(schemas *types.Schemas) *types.Schemas {
&mapper.NamespaceIDMapper{},
).
MustImport(&Version, v3.SetPodSecurityPolicyTemplateInput{}).
MustImport(&Version, v3.ImportProjectYamlInput{}).
MustImport(&Version, v3.ImportYamlOutput{}).
MustImportAndCustomize(&Version, v3.Project{}, func(schema *types.Schema) {
schema.ResourceActions = map[string]types.Action{
"setpodsecuritypolicytemplate": {
Input: "setPodSecurityPolicyTemplateInput",
Output: "project",
},
"importYaml": {
Input: "importProjectYamlInput",
Output: "importYamlOutput",
},
}
}).
MustImport(&Version, v3.GlobalRole{}).

View File

@@ -368,6 +368,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*HealthCheck).DeepCopyInto(out.(*HealthCheck))
return nil
}, InType: reflect.TypeOf(&HealthCheck{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ImportClusterYamlInput).DeepCopyInto(out.(*ImportClusterYamlInput))
return nil
}, InType: reflect.TypeOf(&ImportClusterYamlInput{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ImportProjectYamlInput).DeepCopyInto(out.(*ImportProjectYamlInput))
return nil
}, InType: reflect.TypeOf(&ImportProjectYamlInput{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ImportYamlOutput).DeepCopyInto(out.(*ImportYamlOutput))
return nil
}, InType: reflect.TypeOf(&ImportYamlOutput{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ImportedConfig).DeepCopyInto(out.(*ImportedConfig))
return nil
@@ -3195,6 +3207,54 @@ func (in *HealthCheck) DeepCopy() *HealthCheck {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImportClusterYamlInput) DeepCopyInto(out *ImportClusterYamlInput) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportClusterYamlInput.
func (in *ImportClusterYamlInput) DeepCopy() *ImportClusterYamlInput {
if in == nil {
return nil
}
out := new(ImportClusterYamlInput)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImportProjectYamlInput) DeepCopyInto(out *ImportProjectYamlInput) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportProjectYamlInput.
func (in *ImportProjectYamlInput) DeepCopy() *ImportProjectYamlInput {
if in == nil {
return nil
}
out := new(ImportProjectYamlInput)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImportYamlOutput) DeepCopyInto(out *ImportYamlOutput) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportYamlOutput.
func (in *ImportYamlOutput) DeepCopy() *ImportYamlOutput {
if in == nil {
return nil
}
out := new(ImportYamlOutput)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImportedConfig) DeepCopyInto(out *ImportedConfig) {
*out = *in