github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/gaussdb/v3/instance/ResetPassword.go (about)

     1  package instance
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type ResetPwdOpts struct {
     9  	// Instance ID, which is compliant with the UUID format.
    10  	InstanceId string
    11  	// Database password.
    12  	// Value range:
    13  	// The password consists of 8 to 32 characters and contains at least three types of the following:
    14  	// uppercase letters, lowercase letters, digits, and special characters (~!@#$%^*-_=+?,()&).
    15  	// Enter a strong password to improve security, preventing security risks such as brute force cracking.
    16  	// If you enter a weak password, the system automatically determines that the password is invalid.
    17  	Password string `json:"password"`
    18  }
    19  
    20  func ResetPassword(client *golangsdk.ServiceClient, opts ResetPwdOpts) (err error) {
    21  	b, err := build.RequestBody(opts, "")
    22  	if err != nil {
    23  		return err
    24  	}
    25  
    26  	// POST https://{Endpoint}/mysql/v3/{project_id}/instances/{instance_id}/password
    27  	_, err = client.Post(client.ServiceURL("instances", opts.InstanceId, "password"), b, nil, &golangsdk.RequestOpts{
    28  		OkCodes: []int{200, 201},
    29  	})
    30  	return err
    31  }