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

Updated Security Client APIs #450

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

saimedhi
Copy link
Collaborator

@saimedhi saimedhi commented Jul 25, 2023

Description

Updated Security Client APIs

Issues Resolved

Related to #435,

Relevant PRs

#399, #442

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #450 (c5d05a1) into main (58217d9) will decrease coverage by 0.51%.
Report is 6 commits behind head on main.
The diff coverage is 15.87%.

@@            Coverage Diff             @@
##             main     #450      +/-   ##
==========================================
- Coverage   71.42%   70.91%   -0.51%     
==========================================
  Files          81       81              
  Lines        7668     7730      +62     
==========================================
+ Hits         5477     5482       +5     
- Misses       2191     2248      +57     
Files Changed Coverage Δ
opensearchpy/_async/client/security.py 43.72% <15.87%> (-7.37%) ⬇️
opensearchpy/client/security.py 43.72% <15.87%> (-7.37%) ⬇️

... and 1 file with indirect coverage changes

@saimedhi saimedhi marked this pull request as draft July 25, 2023 01:00
@saimedhi saimedhi force-pushed the update/security_client branch from 39d928c to f65a542 Compare July 25, 2023 17:43
@saimedhi
Copy link
Collaborator Author

Renamed the following APIs:

  1. “put_user” to “create_user”.
  2. “put_role” to“create_role”.
  3. “delete_role_mappings” to “delete_role_mapping”.
  4. “put_role_mappings” to “create_role_mapping”.
  5. “put_tenant” to “create_tenant”.
  6. “put_audit_configuration” to “update_audit_config”.
  7. "put_action_group" to "create_action_group"
  8. "put_configuration" to "update_configuration"
  9. "put_distinguished_names" to "update_distinguished_names"

And also made few other changes to the APIs to maintain uniformity.

@saimedhi saimedhi marked this pull request as ready for review July 25, 2023 17:55
@saimedhi
Copy link
Collaborator Author

Hello @florianvazelle, I request you to take a look at these changes. Please let me know if you notice anything wrong.

@saimedhi
Copy link
Collaborator Author

@VachaShah, please review and merge this PR. It needs to be done before upcoming python release. Thank you :)

dblock
dblock previously approved these changes Jul 25, 2023
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Should I be concerned by the amount of changes and so few in tests?

@saimedhi
Copy link
Collaborator Author

saimedhi commented Jul 25, 2023

Should I be concerned by the amount of changes and so few in tests?

I made changes with utmost care. But, it is true that Test coverage is less

Copy link
Collaborator

@VachaShah VachaShah left a comment

Choose a reason for hiding this comment

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

Lets add a working sample as @dblock mentioned?

@florianvazelle
Copy link
Collaborator

florianvazelle commented Jul 26, 2023

Hello @florianvazelle, I request you to take a look at these changes. Please let me know if you notice anything wrong.

LGTM 🙂

But I find that renaming to create_ is a bit confusing, because it makes a creates or replaces.
So on the first call, endpoints return status: CREATED and the second one, something like :

{
	"status": "OK",
	"message": "'...' updated."
}

@nhtruong
Copy link
Contributor

@florianvazelle The naming follows the documentation: For example, it's create_user instead of put_user because we call it create user on OS website: https://opensearch.org/docs/latest/security/access-control/api/#create-user

The moving of security plugin endpoints to security namespace (i.e. client.security.create_user for example) along with renaming is to keep the PY client consistent with our API spec. For example, this is the spec for the PUT _plugins/_security/api/internalusers/ endpoint.

The API generator for PY that @saimedhi has been working on will also generate code for all security endpoints based off of that spec. So we're making sure that these endpoints will have the same names and same location in the PY client as they will soon be replaced by generated code.

Hope that's answered your question.

@saimedhi saimedhi force-pushed the update/security_client branch 2 times, most recently from cf6d0d7 to b754c9e Compare July 26, 2023 20:47
@saimedhi saimedhi requested review from VachaShah and dblock July 26, 2023 20:57
@saimedhi saimedhi force-pushed the update/security_client branch 2 times, most recently from 9aa7941 to 229d804 Compare July 26, 2023 21:59
@saimedhi saimedhi force-pushed the update/security_client branch from 229d804 to c5d05a1 Compare July 26, 2023 22:09
@saimedhi
Copy link
Collaborator Author

@VachaShah, @dblock Please let me know if any further changes needed. I added working sample and few tests as suggested.

@dblock dblock merged commit caeaa13 into opensearch-project:main Jul 26, 2023
@dblock
Copy link
Member

dblock commented Jul 26, 2023

Merged, thanks.

@saimedhi saimedhi deleted the update/security_client branch October 4, 2023 22:21
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.

5 participants