1
0
mirror of https://github.com/rancher/types.git synced 2025-08-30 19:32:18 +00:00

change sourcecode cred/repo to user scope

This commit is contained in:
gitlawr 2018-03-06 11:21:43 +08:00
parent b3ac73ae45
commit c80eabee8e
2 changed files with 25 additions and 15 deletions

View File

@ -51,6 +51,8 @@ type PipelineExecutionLog struct {
}
type SourceCodeCredential struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -59,6 +61,8 @@ type SourceCodeCredential struct {
}
type SourceCodeRepository struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -84,14 +88,15 @@ type GithubClusterConfig struct {
}
type PipelineStatus struct {
PipelineState string `json:"pipelineState,omitempty" norman:"required,options=active|inactive,default=active"`
NextRun int `json:"nextRun" yaml:"nextRun,omitempty" norman:"default=1,min=1"`
LastExecutionID string `json:"lastExecutionId,omitempty" yaml:"lastExecutionId,omitempty"`
LastRunState string `json:"lastRunState,omitempty" yaml:"lastRunState,omitempty"`
LastStarted string `json:"lastStarted,omitempty" yaml:"lastStarted,omitempty"`
NextStart string `json:"nextStart,omitempty" yaml:"nextStart,omitempty"`
WebHookID string `json:"webhookId,omitempty" yaml:"webhookId,omitempty"`
Token string `json:"token,omitempty" yaml:"token,omitempty" norman:"writeOnly,noupdate"`
PipelineState string `json:"pipelineState,omitempty" norman:"required,options=active|inactive,default=active"`
NextRun int `json:"nextRun" yaml:"nextRun,omitempty" norman:"default=1,min=1"`
LastExecutionID string `json:"lastExecutionId,omitempty" yaml:"lastExecutionId,omitempty"`
LastRunState string `json:"lastRunState,omitempty" yaml:"lastRunState,omitempty"`
LastStarted string `json:"lastStarted,omitempty" yaml:"lastStarted,omitempty"`
NextStart string `json:"nextStart,omitempty" yaml:"nextStart,omitempty"`
WebHookID string `json:"webhookId,omitempty" yaml:"webhookId,omitempty"`
Token string `json:"token,omitempty" yaml:"token,omitempty" norman:"writeOnly,noupdate"`
SourceCodeCredential *SourceCodeCredential `json:"sourceCodeCredential,omitempty" yaml:"sourceCodeCredential,omitempty"`
}
type PipelineSpec struct {

View File

@ -394,11 +394,6 @@ func pipelineTypes(schema *types.Schemas) *types.Schemas {
MustImport(&Version, v3.AuthAppInput{}).
MustImport(&Version, v3.AuthUserInput{}).
MustImport(&Version, v3.RunPipelineInput{}).
MustImportAndCustomize(&Version, v3.SourceCodeCredential{}, func(schema *types.Schema) {
schema.ResourceActions = map[string]types.Action{
"refreshrepos": {},
}
}).
MustImportAndCustomize(&Version, v3.ClusterPipeline{}, func(schema *types.Schema) {
schema.ResourceActions = map[string]types.Action{
"deploy": {},
@ -429,7 +424,17 @@ func pipelineTypes(schema *types.Schemas) *types.Schemas {
"rerun": {},
}
}).
MustImport(&Version, v3.SourceCodeRepository{}).
MustImport(&Version, v3.PipelineExecutionLog{})
MustImport(&Version, v3.PipelineExecutionLog{}).
MustImportAndCustomize(&Version, v3.SourceCodeCredential{}, func(schema *types.Schema) {
delete(schema.ResourceFields, "namespaceId")
schema.ResourceMethods = []string{http.MethodGet, http.MethodDelete}
schema.ResourceActions = map[string]types.Action{
"refreshrepos": {},
}
}).
MustImportAndCustomize(&Version, v3.SourceCodeRepository{}, func(schema *types.Schema) {
schema.ResourceMethods = []string{http.MethodGet, http.MethodDelete}
delete(schema.ResourceFields, "namespaceId")
})
}