Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/Identity/v3/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,11 +842,11 @@ public function deletePolicy(): array
public function getApplicationCredential(): array
{
return [
'method' => 'GET',
'path' => 'users/{userId}/application_credentials/{id}',
'method' => 'GET',
'path' => 'users/{userId}/application_credentials/{id}',
'jsonKey' => 'application_credential',
'params' => [
'id' => $this->params->idUrl('application_credential'),
'params' => [
'id' => $this->params->idUrl('application_credential'),
'userId' => $this->params->idUrl('user'),
],
];
Expand All @@ -855,12 +855,12 @@ public function getApplicationCredential(): array
public function postApplicationCredential(): array
{
return [
'method' => 'POST',
'path' => 'users/{userId}/application_credentials',
'method' => 'POST',
'path' => 'users/{userId}/application_credentials',
'jsonKey' => 'application_credential',
'params' => [
'userId' => $this->params->idUrl('user'),
'name' => $this->params->name('application_credential'),
'params' => [
'userId' => $this->params->idUrl('user'),
'name' => $this->params->name('application_credential'),
'description' => $this->params->desc('application_credential'),
],
];
Expand All @@ -870,9 +870,9 @@ public function deleteApplicationCredential(): array
{
return [
'method' => 'DELETE',
'path' => 'users/{userId}/application_credentials/{id}',
'path' => 'users/{userId}/application_credentials/{id}',
'params' => [
'id' => $this->params->idUrl('application_credential'),
'id' => $this->params->idUrl('application_credential'),
'userId' => $this->params->idUrl('user'),
],
];
Expand Down
12 changes: 7 additions & 5 deletions src/Identity/v3/Models/ApplicationCredential.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@ class ApplicationCredential extends OperatorResource implements Creatable, Lista
'user_id' => 'userId',
];

protected $resourceKey = 'application_credential';
protected $resourceKey = 'application_credential';
protected $resourcesKey = 'application_credentials';

/**
* @inheritdoc
* {@inheritdoc}
*
* @param array $userOptions {@see \OpenStack\Identity\v3\Api::postApplicationCredential}
*/
public function create(array $userOptions): Creatable
{
$response = $this->execute($this->api->postApplicationCredential(), $userOptions);

return $this->populateFromResponse($response);
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function retrieve()
{
Expand All @@ -58,10 +60,10 @@ public function retrieve()
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function delete()
{
$this->executeWithState($this->api->deleteApplicationCredential());
}
}
}
17 changes: 4 additions & 13 deletions src/Identity/v3/Models/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,14 @@ public function create(array $data): Creatable
if (isset($data['user'])) {
$data['methods'] = ['password'];
if (!isset($data['user']['id']) && empty($data['user']['domain'])) {
throw new InvalidArgumentException(
'When authenticating with a username, you must also provide either the domain name '
. 'or domain ID to which the user belongs to. Alternatively, if you provide a user ID instead, '
. 'you do not need to provide domain information.');
throw new InvalidArgumentException('When authenticating with a username, you must also provide either the domain name '.'or domain ID to which the user belongs to. Alternatively, if you provide a user ID instead, '.'you do not need to provide domain information.');
}
}
elseif (isset($data['application_credential'])) {
} elseif (isset($data['application_credential'])) {
$data['methods'] = ['application_credential'];
if (!isset($data['application_credential']['id']) || !isset($data['application_credential']['secret'])) {
throw new InvalidArgumentException(
'When authenticating with a application_credential, you must provide application credential ID '
.' and application credential secret.'
);
throw new InvalidArgumentException('When authenticating with a application_credential, you must provide application credential ID '.' and application credential secret.');
}

}
elseif (isset($data['tokenId'])) {
} elseif (isset($data['tokenId'])) {
$data['methods'] = ['token'];
} else {
throw new InvalidArgumentException('Either a user, tokenId or application_credential must be provided.');
Expand Down
3 changes: 2 additions & 1 deletion src/Identity/v3/Params.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public function methods(): array
];
}

public function applicationCredential(): array {
public function applicationCredential(): array
{
return [
'type' => self::OBJECT_TYPE,
'path' => 'auth.identity',
Expand Down
1 change: 1 addition & 0 deletions src/ObjectStore/v1/Models/StorageObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function getMetadata(): array
{
$response = $this->executeWithState($this->api->headObject());
$this->populateFromResponse($response);

return $this->parseMetadata($response);
}
}