Identity Class first function

This commit is contained in:
EoleDev 2016-02-12 15:45:25 +01:00
parent 06d229a37e
commit 6960c81a1f

View file

@ -53,7 +53,10 @@ class identity implements Core{
* Create a secret/access pair for use with ec2 style auth.
* This operation will generates a new set of credentials that map the user/project pair.
*
* @throws [Type] [<description>]
* @param JsonString $blob credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}"
* @param String $projectId project's UUID
* @param String $type Type of credential : ec2, cert...
* @param String $userId Id of the user which own the credential
*
* @return void
*/
@ -73,36 +76,68 @@ class identity implements Core{
$opt = array('blob' => $blob, 'projectId' => $projectId, 'type' => $type, 'userId' => $userId);
$res = $this->libClass->createCredential($opt);
}catch(Exception $e){
}
]
}catch(BadResponseError $e){
$this->app->getErrorInstance->BadResponseHandler($e);
}catch(UserInputError $e){
$this->app->getErrorInstance->UserInputHandler($e);
}catch(BaseError $e){
$this->app->getErrorInstance->BaseErrorHandler($e);
}catch(NotImplementedError $e){
$this->app->getErrorInstance->NotImplementedHandler($e);
}
}
/**
* List the credentials for a given user.
*
* @throws [Type] [<description>]
*
* @return void
*/
$credentials["listCredentials"] = function(){
try{
$this->libClass->listCredentials()
//TODO parse answer
}catch(BadResponseError $e){
$this->app->getErrorInstance->BadResponseHandler($e);
}catch(UserInputError $e){
$this->app->getErrorInstance->UserInputHandler($e);
}catch(BaseError $e){
$this->app->getErrorInstance->BaseErrorHandler($e);
}catch(NotImplementedError $e){
$this->app->getErrorInstance->NotImplementedHandler($e);
}
}
/**
* Retrieve a users access/secret pair by the access key.
*
* @throws [Type] [<description>]
* @param String $credentialId credential id for which it retrieve the details
*
* @return void
*/
$credentials["showCredential"] = function(){
$credential = $identity->getCredential('credentialId');
$credential->retrieve();
$credentId = $this->app->getPostParam("credentialId");
try{
$cred = $this->libClass->getCredential($credentId);
$cred->retrieve();
//TODO parse answer
}catch(BadResponseError $e){
$this->app->getErrorInstance->BadResponseHandler($e);
}catch(UserInputError $e){
$this->app->getErrorInstance->UserInputHandler($e);
}catch(BaseError $e){
$this->app->getErrorInstance->BaseErrorHandler($e);
}catch(NotImplementedError $e){
$this->app->getErrorInstance->NotImplementedHandler($e);
}
}