2018-10-11 15:00:23 -07:00
< ? php
/**
2018-12-28 10:35:52 -08:00
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2018-10-11 15:00:23 -07: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.
*/
require 'vendor/autoload.php' ;
use Aws\Iam\IamClient ;
use Aws\Exception\AwsException ;
/**
* Get login profile
*
* 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
*/
$client = new IamClient ([
'profile' => 'default' ,
'region' => 'us-west-2' ,
'version' => '2010-05-08'
]);
try {
$result = $client -> getLoginProfile ( array (
// UserName is required
'UserName' => 'string' ,
));
var_dump ( $result );
} catch ( AwsException $e ) {
// output error message if fails
error_log ( $e -> getMessage ());
}
2018-10-11 14:25:58 -07:00
2019-01-18 00:02:57 -08:00
// snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
// snippet-sourcedescription:[GetLoginProfile.php demonstrates how to retrieve the login profile for an IAM user.]
// snippet-keyword:[PHP]
// snippet-keyword:[AWS SDK for PHP v3]
// snippet-keyword:[Code Sample]
// snippet-keyword:[AWS Identity and Access Management (IAM)]
// snippet-service:[iam]
// snippet-sourcetype:[full-example]
// snippet-sourcedate:[2018-09-20]
// snippet-sourceauthor:[jschwarzwalder (AWS)]
2018-10-11 14:25:58 -07:00