1
0
mirror of https://github.com/rancher/types.git synced 2025-08-18 20:36:53 +00:00

Merge pull request #1012 from deniseschannon/v2.3.x-cherry-picks

New action on cluster saveAsTemplate
This commit is contained in:
Denise 2019-10-28 13:48:59 -07:00 committed by GitHub
commit ec7e36724e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 0 deletions

View File

@ -31,6 +31,7 @@ const (
ClusterActionRestoreFromEtcdBackup = "restoreFromEtcdBackup"
ClusterActionRotateCertificates = "rotateCertificates"
ClusterActionRunCISScan = "runSecurityScan"
ClusterActionSaveAsTemplate = "saveAsTemplate"
// ClusterConditionReady Cluster ready to serve API (healthy when true, unhealthy when false)
ClusterConditionReady condition.Cond = "Ready"
@ -288,3 +289,8 @@ type LocalClusterAuthEndpoint struct {
type CertExpiration struct {
ExpirationDate string `json:"expirationDate,omitempty"`
}
type SaveAsTemplateInput struct {
ClusterTemplateName string `json:"clusterTemplateName,omitempty"`
ClusterTemplateRevisionName string `json:"clusterTemplateRevisionName,omitempty"`
}

View File

@ -214,6 +214,7 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
MustImport(&Version, v3.MonitoringInput{}).
MustImport(&Version, v3.MonitoringOutput{}).
MustImport(&Version, v3.RestoreFromEtcdBackupInput{}).
MustImport(&Version, v3.SaveAsTemplateInput{}).
MustImportAndCustomize(&Version, v3.ETCDService{}, func(schema *types.Schema) {
schema.MustCustomizeField("extraArgs", func(field types.Field) types.Field {
field.Default = map[string]interface{}{
@ -258,6 +259,9 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
Output: "rotateCertificateOutput",
}
schema.ResourceActions[v3.ClusterActionRunCISScan] = types.Action{}
schema.ResourceActions[v3.ClusterActionSaveAsTemplate] = types.Action{
Input: "saveAsTemplateInput",
}
})
}

View File

@ -8413,6 +8413,22 @@ func (in *SamlConfigTestOutput) DeepCopy() *SamlConfigTestOutput {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SaveAsTemplateInput) DeepCopyInto(out *SaveAsTemplateInput) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SaveAsTemplateInput.
func (in *SaveAsTemplateInput) DeepCopy() *SaveAsTemplateInput {
if in == nil {
return nil
}
out := new(SaveAsTemplateInput)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SchedulerService) DeepCopyInto(out *SchedulerService) {
*out = *in

View File

@ -148,6 +148,8 @@ type ClusterOperations interface {
ActionRunSecurityScan(resource *Cluster) error
ActionSaveAsTemplate(resource *Cluster, input *SaveAsTemplateInput) error
ActionViewMonitoring(resource *Cluster) (*MonitoringOutput, error)
}
@ -256,6 +258,11 @@ func (c *ClusterClient) ActionRunSecurityScan(resource *Cluster) error {
return err
}
func (c *ClusterClient) ActionSaveAsTemplate(resource *Cluster, input *SaveAsTemplateInput) error {
err := c.apiClient.Ops.DoAction(ClusterType, "saveAsTemplate", &resource.Resource, input, nil)
return err
}
func (c *ClusterClient) ActionViewMonitoring(resource *Cluster) (*MonitoringOutput, error) {
resp := &MonitoringOutput{}
err := c.apiClient.Ops.DoAction(ClusterType, "viewMonitoring", &resource.Resource, nil, resp)

View File

@ -0,0 +1,12 @@
package client
const (
SaveAsTemplateInputType = "saveAsTemplateInput"
SaveAsTemplateInputFieldClusterTemplateName = "clusterTemplateName"
SaveAsTemplateInputFieldClusterTemplateRevisionName = "clusterTemplateRevisionName"
)
type SaveAsTemplateInput struct {
ClusterTemplateName string `json:"clusterTemplateName,omitempty" yaml:"clusterTemplateName,omitempty"`
ClusterTemplateRevisionName string `json:"clusterTemplateRevisionName,omitempty" yaml:"clusterTemplateRevisionName,omitempty"`
}