mirror of
https://github.com/rancher/types.git
synced 2025-09-24 19:39:13 +00:00
@@ -83,5 +83,10 @@ type GithubCredential struct {
|
||||
}
|
||||
|
||||
type ChangePasswordInput struct {
|
||||
NewPassword string `json:"newPassword"`
|
||||
CurrentPassword string `json:"currentPassword" norman:"type=string,required"`
|
||||
NewPassword string `json:"newPassword" norman:"type=string,required"`
|
||||
}
|
||||
|
||||
type SetPasswordInput struct {
|
||||
NewPassword string `json:"newPassword" norman:"type=string,required"`
|
||||
}
|
||||
|
@@ -197,6 +197,7 @@ func authnTypes(schemas *types.Schemas) *types.Schemas {
|
||||
MustImport(&Version, v3.LocalCredential{}).
|
||||
MustImport(&Version, v3.GithubCredential{}).
|
||||
MustImport(&Version, v3.ChangePasswordInput{}).
|
||||
MustImport(&Version, v3.SetPasswordInput{}).
|
||||
MustImportAndCustomize(&Version, v3.Token{}, func(schema *types.Schema) {
|
||||
schema.CollectionActions = map[string]types.Action{
|
||||
"login": {
|
||||
@@ -208,11 +209,16 @@ func authnTypes(schemas *types.Schemas) *types.Schemas {
|
||||
}).
|
||||
MustImportAndCustomize(&Version, v3.User{}, func(schema *types.Schema) {
|
||||
schema.ResourceActions = map[string]types.Action{
|
||||
"changepassword": {
|
||||
Input: "changePasswordInput",
|
||||
"setpassword": {
|
||||
Input: "setPasswordInput",
|
||||
Output: "user",
|
||||
},
|
||||
}
|
||||
schema.CollectionActions = map[string]types.Action{
|
||||
"changepassword": {
|
||||
Input: "changePasswordInput",
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -375,6 +375,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
in.(*SchedulerService).DeepCopyInto(out.(*SchedulerService))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SchedulerService{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SetPasswordInput).DeepCopyInto(out.(*SetPasswordInput))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SetPasswordInput{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*Stack).DeepCopyInto(out.(*Stack))
|
||||
return nil
|
||||
@@ -2837,6 +2841,22 @@ func (in *SchedulerService) DeepCopy() *SchedulerService {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SetPasswordInput) DeepCopyInto(out *SetPasswordInput) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SetPasswordInput.
|
||||
func (in *SetPasswordInput) DeepCopy() *SetPasswordInput {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SetPasswordInput)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Stack) DeepCopyInto(out *Stack) {
|
||||
*out = *in
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
ChangePasswordInputType = "changePasswordInput"
|
||||
ChangePasswordInputFieldNewPassword = "newPassword"
|
||||
ChangePasswordInputType = "changePasswordInput"
|
||||
ChangePasswordInputFieldCurrentPassword = "currentPassword"
|
||||
ChangePasswordInputFieldNewPassword = "newPassword"
|
||||
)
|
||||
|
||||
type ChangePasswordInput struct {
|
||||
NewPassword string `json:"newPassword,omitempty"`
|
||||
CurrentPassword string `json:"currentPassword,omitempty"`
|
||||
NewPassword string `json:"newPassword,omitempty"`
|
||||
}
|
||||
|
10
client/management/v3/zz_generated_set_password_input.go
Normal file
10
client/management/v3/zz_generated_set_password_input.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
SetPasswordInputType = "setPasswordInput"
|
||||
SetPasswordInputFieldNewPassword = "newPassword"
|
||||
)
|
||||
|
||||
type SetPasswordInput struct {
|
||||
NewPassword string `json:"newPassword,omitempty"`
|
||||
}
|
@@ -56,7 +56,7 @@ type UserOperations interface {
|
||||
ByID(id string) (*User, error)
|
||||
Delete(container *User) error
|
||||
|
||||
ActionChangepassword(*User, *ChangePasswordInput) (*User, error)
|
||||
ActionSetpassword(*User, *SetPasswordInput) (*User, error)
|
||||
}
|
||||
|
||||
func newUserClient(apiClient *Client) *UserClient {
|
||||
@@ -104,11 +104,11 @@ func (c *UserClient) Delete(container *User) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(UserType, &container.Resource)
|
||||
}
|
||||
|
||||
func (c *UserClient) ActionChangepassword(resource *User, input *ChangePasswordInput) (*User, error) {
|
||||
func (c *UserClient) ActionSetpassword(resource *User, input *SetPasswordInput) (*User, error) {
|
||||
|
||||
resp := &User{}
|
||||
|
||||
err := c.apiClient.Ops.DoAction(UserType, "changepassword", &resource.Resource, input, resp)
|
||||
err := c.apiClient.Ops.DoAction(UserType, "setpassword", &resource.Resource, input, resp)
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user