SIGN IN SIGN UP

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.

0 0 226 Java
2017-03-02 13:01:17 -08:00
<?php
/**
2018-02-26 21:35:20 -08:00
* Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2017-03-02 13:01:17 -08:00
*
* This file is licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
2018-04-02 00:32:28 -07:00
*
* ABOUT THIS PHP SAMPLE: This sample is part of the SDK for PHP Developer Guide topic at
* https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/iam-examples-managing-users.html
2018-04-02 00:32:28 -07:00
*
2017-03-02 13:01:17 -08:00
*/
require 'vendor/autoload.php';
use Aws\Iam\IamClient;
use Aws\Exception\AwsException;
/**
* Updates the name and/or the path of the specified user.
*
* This code expects that you have AWS credentials set up per:
* https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html
2017-03-02 13:01:17 -08:00
*/
$client = new IamClient([
'profile' => 'default',
'region' => 'us-west-2',
'version' => '2010-05-08'
]);
try {
$result = $client->updateUser(array(
// UserName is required
'UserName' => 'string1',
'NewUserName' => 'string'
));
var_dump($result);
} catch (AwsException $e) {
// output error message if fails
error_log($e->getMessage());
}
2018-10-11 14:25:58 -07:00
//snippet-sourcedescription:[<<FILENAME>> demonstrates how to ...]
//snippet-keyword:[PHP]
//snippet-keyword:[Code Sample]
//snippet-service:[<<ADD SERVICE>>]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[]
//snippet-sourceauthor:[AWS]