1
0
mirror of https://github.com/rancher/types.git synced 2025-07-14 13:44:04 +00:00

Merge pull request #1010 from prachidamle/save_template_action_master

[forwardport] Save template action on a cluster
This commit is contained in:
Dan Ramich 2019-11-06 09:29:50 -08:00 committed by GitHub
commit c684e200ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 2 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"
@ -289,3 +290,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

@ -215,6 +215,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{}{
@ -259,6 +260,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

@ -8479,6 +8479,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"`
}

2
go.sum
View File

@ -678,8 +678,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac h1:MQEvx39qSf8vyrx3XRaOe+j1UDIzKwkYOVObRgGPVqI=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190926165942-a8d5d34286bd h1:L7bTtbmMojUZYEAt0OrTU0Z/KmN+uX195615ty32gkA=
golang.org/x/tools v0.0.0-20190926165942-a8d5d34286bd/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c h1:IGkKhmfzcztjm6gYkykvu/NiS8kaqbCWAEWWAyf8J5U=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=