public function getCredentialsForProfile($profile)
{
if (!$this->isValidProfile($profile)) {
throw new \Exception("Invalid profile: {$profile}");
}
$config = $this->getConfig();
$profileConfig = $config[$profile];
if (empty($profileConfig['access_key'])) {
throw new \Exception("Invalid access_key in profile {$profile}");
}
if (empty($profileConfig['secret_key'])) {
throw new \Exception("Invalid secret_key in profile {$profile}");
}
return new Credentials($profileConfig['access_key'], $profileConfig['secret_key']);
}