Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

svenwiltink
Copy link

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.

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.
Copy link
Member

@k0ka k0ka left a 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
Copy link
Member

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.
*/
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants