-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly implement the POST credentials method #348
base: master
Are you sure you want to change the base?
Conversation
74352e5
to
c51346d
Compare
https://docs.openstack.org/api-ref/identity/v3/index.html?expanded=authenticating-with-an-application-credential-detail,create-credential-detail#credentials specifies that the credentials endpoint expects a credential object and returns one. This patch ensures the data is properly encoded and decoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we will need integration test to check if this parameter really works in OpenStack API.
@@ -103,4 +103,9 @@ public function listProjects(): \Generator | |||
{ | |||
return $this->model(Project::class)->enumerate($this->api->getUserProjects(), ['id' => $this->id]); | |||
} | |||
|
|||
public function listCredentials(): \Generator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@return \Generator<mixed, \OpenStack\Identity\v3\Models\Credential>
* Returns a generator which will yield a collection of credential objects. The elements which generators yield can | ||
* be accessed using a foreach loop. Often the API will not return the full state of the resource in collections; | ||
* you will need to use retrieve() to pull in the full state of the remote resource from the API. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@return \Generator<mixed, \OpenStack\Identity\v3\Models\Credential>
@@ -195,6 +195,15 @@ public function userIdQuery(): array | |||
]; | |||
} | |||
|
|||
public function userIdQueryUnderscore(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why creating new function?
As far as I see https://docs.openstack.org/api-ref/identity/v3/#credentials
POST /v3/credentials
and GET /v3/credentials
are using the same parameter type user_id
.
@@ -709,6 +710,15 @@ public function getCredentials(): array | |||
]; | |||
} | |||
|
|||
public function getUserCredentials(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not need to create a new definition there. We already have getCredentials()
and can just reuse it by adding the userId
parameter.
https://docs.openstack.org/api-ref/identity/v3/index.html?expanded=authenticating-with-an-application-credential-detail,create-credential-detail#credentials
specifies that the credentials endpoint expects a credential object and returns one. This patch ensures the data is properly encoded and decoded.