opensearch-project / opensearch-go

Go Client for OpenSearch
https://opensearch.org/docs/latest/clients/go/
Apache License 2.0
188 stars 96 forks source link

Add security plugin #507

Closed Jakob3xD closed 2 months ago

Jakob3xD commented 3 months ago

Description

The changes made to error are more or less braking changes as they get moved to another package. Normal use should still work but for uses who try to parse the error with errors.As it is braking.

Issues Resolved

Closes #94

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[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 93.16038% with 58 lines in your changes are missing coverage. Please review.

Project coverage is 66.14%. Comparing base (06a6dc8) to head (289159b). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #507 +/- ## ========================================== + Coverage 57.29% 66.14% +8.85% ========================================== Files 315 363 +48 Lines 9823 8563 -1260 ========================================== + Hits 5628 5664 +36 + Misses 2902 1588 -1314 - Partials 1293 1311 +18 ``` | [Flag](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `59.44% <92.92%> (+8.60%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `81.48% <100.00%> (+68.63%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [opensearch.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=opensearch.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-b3BlbnNlYXJjaC5nbw==) | `92.85% <100.00%> (+17.23%)` | :arrow_up: | | [plugins/security/api\_account-get.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_account-get.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfYWNjb3VudC1nZXQuZ28=) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_account.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_account.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfYWNjb3VudC5nbw==) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_actiongroups-delete.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_actiongroups-delete.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfYWN0aW9uZ3JvdXBzLWRlbGV0ZS5nbw==) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_actiongroups-get.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_actiongroups-get.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfYWN0aW9uZ3JvdXBzLWdldC5nbw==) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_actiongroups.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_actiongroups.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfYWN0aW9uZ3JvdXBzLmdv) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_audit-get.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_audit-get.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfYXVkaXQtZ2V0Lmdv) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_audit.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_audit.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfYXVkaXQuZ28=) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_flushcache.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_flushcache.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfZmx1c2hjYWNoZS5nbw==) | `100.00% <100.00%> (ø)` | | | [plugins/security/api\_health.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree&filepath=plugins%2Fsecurity%2Fapi_health.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-cGx1Z2lucy9zZWN1cml0eS9hcGlfaGVhbHRoLmdv) | `100.00% <100.00%> (ø)` | | | ... and [39 more](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | | ... and [249 files with indirect coverage changes](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/507/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)
Jakob3xD commented 3 months ago

:partying_face: CI is green. I am going to split all the unrelated stuff into separate PRs.

Jakob3xD commented 2 months ago

Nice. Did you roll this code out by hand?

Yes, as the API spec is IMO not in a great state because of issue like this and my focus is on adding the missing plugins I need. As I have no experience with code generation it would take way more time to add the plugins and iron out all the issues the api spec has.

I am also working on the ISM plugins but the API spec is totally missing and I am trying to get what I need from the Docs but this is also a lot of pain.

dblock commented 2 months ago

@Jakob3xD we have done a lot of work in https://github.com/opensearch-project/opensearch-api-specification, moving it to OpenAPI, adding bodies, and generally are going to push on teams such as ISM to add specs. You can get a lot of mileage "for free" there. Remember that we have 8 clients, so in order to keep up with API changes we have to automate.

dblock commented 2 months ago

@Jakob3xD rebase?