github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/identity/v3.0/security/UpdatePasswordPolicy.go (about) 1 package security 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 7 ) 8 9 type UpdatePasswordPolicyOpts struct { 10 // Maximum number of times that a character is allowed to consecutively present in a password. 11 MaximumConsecutiveIdenticalChars *int `json:"maximum_consecutive_identical_chars,omitempty"` 12 // Minimum period (minutes) after which users are allowed to make a password change. 13 MinimumPasswordAge *int `json:"minimum_password_age,omitempty"` 14 // Minimum number of characters that a password must contain. 15 MinimumPasswordLength *int `json:"minimum_password_length,omitempty"` 16 // Number of previously used passwords that are not allowed. 17 NumberOfRecentPasswordsDisallowed *int `json:"number_of_recent_passwords_disallowed,omitempty"` 18 // Indicates whether the password can be the username or the username spelled backwards. 19 PasswordNotUsernameOrInvert *bool `json:"password_not_username_or_invert,omitempty"` 20 // Password validity period (days). 21 PasswordValidityPeriod *int `json:"password_validity_period,omitempty"` 22 } 23 24 func UpdatePasswordPolicy(client *golangsdk.ServiceClient, id string, opts UpdatePasswordPolicyOpts) (*PasswordPolicy, error) { 25 b, err := build.RequestBody(opts, "password_policy") 26 if err != nil { 27 return nil, err 28 } 29 30 // PUT /v3.0/OS-SECURITYPOLICY/domains/{domain_id}/password-policy 31 raw, err := client.Put(client.ServiceURL("OS-SECURITYPOLICY", "domains", id, "password-policy"), b, nil, &golangsdk.RequestOpts{ 32 OkCodes: []int{200}, 33 }) 34 if err != nil { 35 return nil, err 36 } 37 38 var res PasswordPolicy 39 return &res, extract.IntoStructPtr(raw.Body, &res, "password_policy") 40 }