github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/identity/v3.0/security/GetPasswordPolicy.go (about)

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