mirror of
https://github.com/rancher/types.git
synced 2025-08-31 21:00:16 +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:
@@ -99,6 +99,8 @@ type ClusterOperations interface {
|
||||
Delete(container *Cluster) error
|
||||
|
||||
ActionGenerateKubeconfig(*Cluster) (*GenerateKubeConfigOutput, error)
|
||||
|
||||
ActionImportYaml(*Cluster, *ImportClusterYamlInput) (*ImportYamlOutput, error)
|
||||
}
|
||||
|
||||
func newClusterClient(apiClient *Client) *ClusterClient {
|
||||
@@ -154,3 +156,12 @@ func (c *ClusterClient) ActionGenerateKubeconfig(resource *Cluster) (*GenerateKu
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *ClusterClient) ActionImportYaml(resource *Cluster, input *ImportClusterYamlInput) (*ImportYamlOutput, error) {
|
||||
|
||||
resp := &ImportYamlOutput{}
|
||||
|
||||
err := c.apiClient.Ops.DoAction(ClusterType, "importYaml", &resource.Resource, input, resp)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
@@ -0,0 +1,10 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
ImportClusterYamlInputType = "importClusterYamlInput"
|
||||
ImportClusterYamlInputFieldYaml = "yaml"
|
||||
)
|
||||
|
||||
type ImportClusterYamlInput struct {
|
||||
Yaml string `json:"yaml,omitempty" yaml:"yaml,omitempty"`
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
ImportProjectYamlInputType = "importProjectYamlInput"
|
||||
ImportProjectYamlInputFieldNamespace = "namespace"
|
||||
ImportProjectYamlInputFieldYaml = "yaml"
|
||||
)
|
||||
|
||||
type ImportProjectYamlInput struct {
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
Yaml string `json:"yaml,omitempty" yaml:"yaml,omitempty"`
|
||||
}
|
10
client/management/v3/zz_generated_import_yaml_output.go
Normal file
10
client/management/v3/zz_generated_import_yaml_output.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
ImportYamlOutputType = "importYamlOutput"
|
||||
ImportYamlOutputFieldOutputMessage = "outputMessage"
|
||||
)
|
||||
|
||||
type ImportYamlOutput struct {
|
||||
OutputMessage string `json:"outputMessage,omitempty" yaml:"outputMessage,omitempty"`
|
||||
}
|
@@ -60,6 +60,8 @@ type ProjectOperations interface {
|
||||
ByID(id string) (*Project, error)
|
||||
Delete(container *Project) error
|
||||
|
||||
ActionImportYaml(*Project, *ImportProjectYamlInput) (*ImportYamlOutput, error)
|
||||
|
||||
ActionSetpodsecuritypolicytemplate(*Project, *SetPodSecurityPolicyTemplateInput) (*Project, error)
|
||||
}
|
||||
|
||||
@@ -108,6 +110,15 @@ func (c *ProjectClient) Delete(container *Project) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(ProjectType, &container.Resource)
|
||||
}
|
||||
|
||||
func (c *ProjectClient) ActionImportYaml(resource *Project, input *ImportProjectYamlInput) (*ImportYamlOutput, error) {
|
||||
|
||||
resp := &ImportYamlOutput{}
|
||||
|
||||
err := c.apiClient.Ops.DoAction(ProjectType, "importYaml", &resource.Resource, input, resp)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *ProjectClient) ActionSetpodsecuritypolicytemplate(resource *Project, input *SetPodSecurityPolicyTemplateInput) (*Project, error) {
|
||||
|
||||
resp := &Project{}
|
||||
|
Reference in New Issue
Block a user