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

Updating names qos-profile of endpoints #348

Merged
merged 4 commits into from
Aug 27, 2024

Conversation

RandyLevensalor
Copy link
Collaborator

What type of PR is this?

Add one of the following kinds:

  • correction

What this PR does / why we need it:

Updates the endpoint names to include a verb.

Adds security scope to /retrieve-qos-profiles

Updates security scope on /retrieve-qos-profiles/{name}

Which issue(s) this PR fixes:

Fixes #345

Special notes for reviewers:

Should /retrieve-qos-profiles/{name} be singular /retrieve-qos-profile/{name} since it only returns a single qos-profile.

Changelog input

 release-note

Update qos-profile endpoint names to align with commonalites.  Updates the endpoint names to include a verb.

`/qos-profiles` is now `/retrieve-qos-profiles` and `/qos-profiles/{name}` is now `/retrieve-qos-profiles/{name}`


Additional documentation

This section can be blank.

docs

@RandyLevensalor RandyLevensalor changed the title Updating names of endpoints Updating names qos-profile of endpoints Aug 14, 2024
@hdamker
Copy link
Collaborator

hdamker commented Aug 14, 2024

@RandyLevensalor thanks for the PR!

I don't see a need to rename /qos-profiles/{name} as this is a GET and returns actually a qos-profile (and yes, nouns in the path always in plural, even if there is only a singular result). But maybe I'm wrong here ... @jlurien?

@eric-murray
Copy link
Collaborator

GET /qos-profiles/{name} is correct. qos-profiles is the name of the "resource" where we are looking for one named {name}. This is what developers familiar with "REST" APIs (I use the term loosely) will expect.

POST /retrieve-qos-profiles is a workaround resulting from Tim Berners-Lee's oversight in not making it sufficiently clear that GET requests may have a body, and that any proxy passing on a GET request must look for a body as well in case one is there. So a body could be defined for GET /qos-profiles to contain the filter parameters, but whether that body reaches the API gateway is not at all certain. Hence POST.

I'll be interested to see what developers' reaction to POST /retrieve-qos-profiles will be. If 3-legged tokens become "standard" for calling this API, or nobody want to filter by device, then it may yet be that we re-introduce GET /qos-profiles to keep them happy.

@hdamker
Copy link
Collaborator

hdamker commented Aug 15, 2024

I'll be interested to see what developers' reaction to POST /retrieve-qos-profiles will be. If 3-legged tokens become "standard" for calling this API, or nobody want to filter by device, then it may yet be that we re-introduce GET /qos-profiles to keep them happy.

Interesting enough it was your proposal to start the experiment (#318 (comment)) 😄 ... I agree that it might make sense to reintroduce GET /qos-profiles, making the returned list only dependent on the access token. But first of all we need to see if the API will be implemented at all broadly, or API Provider just offer a short list of "standard" profiles, agreed outside of the API.

@RandyLevensalor
Copy link
Collaborator Author

I'll be interested to see what developers' reaction to POST /retrieve-qos-profiles will be. If 3-legged tokens become "standard" for calling this API, or nobody want to filter by device, then it may yet be that we re-introduce GET /qos-profiles to keep them happy.

Interesting enough it was your proposal to start the experiment (#318 (comment)) 😄 ... I agree that it might make sense to reintroduce GET /qos-profiles, making the returned list only dependent on the access token. But first of all we need to see if the API will be implemented at all broadly, or API Provider just offer a short list of "standard" profiles, agreed outside of the API.

Agreed. Though now that we have the post, I'd like to explore some of the other filtering options including using an application profile from connectivity insight as a filter in the next release.

@eric-murray
Copy link
Collaborator

Agreed. Though now that we have the post, I'd like to explore some of the other filtering options including using an application profile from connectivity insight as a filter in the next release.

Yes, that is a good point. It is much simpler to pass complex objects in a request body than using query parameters. A good enough reason in itself to have the POST option.

@RandyLevensalor
Copy link
Collaborator Author

@camaraproject/quality-on-demand_codeowners I don't see any objections. Do you want to approve and merge?

hdamker
hdamker previously approved these changes Aug 20, 2024
Copy link
Collaborator

@hdamker hdamker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ... just a kind of question about the scope name for the operation, see my comment above.

Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
@RandyLevensalor
Copy link
Collaborator Author

LGTM ... just a kind of question about the scope name for the operation, see my comment above.

Accepted the scope change. This resets the approval. Thanks!

hdamker
hdamker previously approved these changes Aug 20, 2024
@@ -124,20 +128,20 @@ paths:
"503":
$ref: "#/components/responses/Generic503"

/qos-profiles/{name}:
/retrieve-qos-profile/{name}:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were going to keep GET /qos-profiles/{name}. That would be the expected name for such an endpoint.

description: |
Returns a QoS Profile that matches the given name.

The access token may be either a 2-legged or 3-legged access token. If the access token is 3-legged, a QoS Profile is only returned if available to all end users associated with the access token.

security:
- openId:
- qos-profiles:qos-profiles:read
- qos-profiles:retrieve-qos-profiles
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the need to have different scopes for the two endpoints. I'd suggest this endpoint also has scope qos-profiles:read.

get:
tags:
- QoS Profiles
summary: "Get QoS Profile for a given name"
operationId: getQosProfile
operationId: retrieveQosProfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original one was OK in line with the comment above

@hdamker
Copy link
Collaborator

hdamker commented Aug 23, 2024

I'm feeling guilty to have created some confusion here as I have overseen that @RandyLevensalor had renamed both endpoints, the POST /qos-profiles and the GET /qos-profiles/{name}, and then I had accidentally commented on the second one.

I agree here now with @eric-murray and @jlurien: the GET /qos-profiles/{name} should not be changed by this PR, as it is correct. Only the POST operation which is not creating a resource has to be renamed with a verb.

@hdamker
Copy link
Collaborator

hdamker commented Aug 23, 2024

Ready for Codeowner approvals.

@hdamker hdamker merged commit 686c478 into camaraproject:main Aug 27, 2024
1 check passed
hdamker added a commit that referenced this pull request Aug 29, 2024
@gauravn00b gauravn00b mentioned this pull request Sep 30, 2024
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.

Operation to get qos-profiles for a device MUST use a verb and needs a security object
4 participants