change_password ( $old_password, $new_password, $opt )

Changes the password of the IAM user calling ChangePassword. The root account password is not affected by this action. For information about modifying passwords, see Managing Passwords.

Access

public

Parameters

Parameter

Type

Required

Description

$old_password

string

Required

[Constraints: The value must be between 1 and 128 characters, and must match the following regular expression pattern: [\u0009\u000A\u000D\u0020-\u00FF]+]

$new_password

string

Required

[Constraints: The value must be between 1 and 128 characters, and must match the following regular expression pattern: [\u0009\u000A\u000D\u0020-\u00FF]+]

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Change the IAM user's password.

// Instantiate the class
$iam = new AmazonIAM(array('key' => $access_key, 'secret' => $secret_key));

$response = $iam->change_password('password', 'new-password');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Source

Method defined in services/iam.class.php | Toggle source view (8 lines) | View on GitHub

public function change_password($old_password, $new_password, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['OldPassword'] = $old_password;
    $opt['NewPassword'] = $new_password;
    
    return $this->authenticate('ChangePassword', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback