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

support the advisory search REST API #132

Open
ktdreyer opened this issue Dec 6, 2018 · 6 comments
Open

support the advisory search REST API #132

ktdreyer opened this issue Dec 6, 2018 · 6 comments
Assignees

Comments

@ktdreyer
Copy link
Member

ktdreyer commented Dec 6, 2018

The /errata endpoint will allow us to search for advisories. Like: /errata?errata_filter[filter_params][some_field]=some_value

We should implement a "filter()" method (on ErrataConnector?) that lets us pass in parameters here. See tree/examples/curl/filter.sh in errata-rails.git as an example.

@yazug yazug self-assigned this May 7, 2019
@yazug
Copy link
Collaborator

yazug commented May 7, 2019

I like this idea

def ErrataConnector::filter(self, filter_category, kwargs**): return json

filter_category => would be 'errata', 'releases', 'products'
then a follow up might be to encode either in connector or another place some convenience searches, for common sets of work to it would be like

def ErrataConnector::filter_advisories(release_name_or_id, state): return json
def ErrataConnector::filter_releases(release_name_or_id): return json

common ones I've seen are release name/id, product name/id, state (new files, qe, rel_prep, in_push, closed drop, shipped live), closed flag, advisory type

then usage could be either

ErrataConnector::filter('releases', is_active=True, enabled=True, name=)

or helper for same
def filter_releases(self, name_or_id, is_active=True, enabled=True): return json
def filter('errata', show_type_RHBA=True, show_type_RHEA=True, show_type_RHSA=True, show_state_DROPPED_NO_SHIP=False,release=[<release_id>, release_id_2>], show_state=[NEW_FILES, QE, REL_PREP, PUSH_READY, IN_PUSH]): return json

or something like that, and either filter or the helper may have to help rotate logic because in kwargs single argument name but api seems to allow duplicate, so might have to have small acceptances of rotations. But keep it thin in logic in the filter() function and write other helpers to expose more of the nuances of common usage patterns

@yazug
Copy link
Collaborator

yazug commented May 7, 2019

example of another filter
'/api/v1/releases?filter[is_active]=true&filter[enabled]=true&filter[name]={}'
endpoint = '/api/v1/releases'
kwargs={is_active:True, enabled:True, name:}

and one mentioned first would be
endpoint='/errata
kwargs= {some_field:}

yazug added a commit to yazug/errata-tool that referenced this issue May 7, 2019
- helper function to implement general filter query pattern
- added workaround for errata endpoint

Works with the following

et.filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
@yazug
Copy link
Collaborator

yazug commented May 7, 2019

one thing I found was errata endpoint filter will need some heavy helpers to make it work cleanly ... there are several anomalies in that search function, but I did find the releases filter option usable and pretty clean. the releases filter option or the product map would be required if you are going from a release name to a release id when trying to search.

yazug added a commit to yazug/errata-tool that referenced this issue May 7, 2019
- add helper to get list of releases by product either id or name
- add helper option 1 to retrieve advisories by release id (using
- add helper option 2 to retrieve advisories by release id (using _filter)

Related: red-hat-storage#132
@ktdreyer
Copy link
Member Author

ktdreyer commented May 8, 2019

I would like to keep the basic filter method lightweight so we only make a single HTTP request if possible.

yazug added a commit to yazug/errata-tool that referenced this issue Oct 24, 2019
- helper function to implement general filter query pattern
- added workaround for errata endpoint

Works with the following

et.filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Oct 24, 2019
- add helper to get list of releases by product either id or name
- add helper option 1 to retrieve advisories by release id (using
- add helper option 2 to retrieve advisories by release id (using _filter)

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 20, 2020
- helper method to implement general filter query pattern
- added workaround for errata endpoint
- support for paginated requests

Works with the following

et.filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 20, 2020
WIP usage of implemented ErrataConnector::filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 20, 2020
- helper method to implement general filter query pattern
- added workaround for errata endpoint
- support for paginated requests

Works with the following

et.filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 20, 2020
WIP usage of implemented ErrataConnector::filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 24, 2020
- helper method to implement general filter query pattern
- added workaround for errata endpoint
- support for paginated requests
- basic unittest for filter helper based on usage

Works with the following

et.filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 24, 2020
WIP usage of implemented ErrataConnector::filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 27, 2020
- helper method to implement general filter query pattern
- added workaround for errata endpoint
- support for paginated requests
- basic unittest for filter helper based on usage

Works with the following

et.filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 27, 2020
WIP usage of implemented ErrataConnector::filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 27, 2020
- helper method to implement general filter query pattern
- add support for release/product difference in nesting filter
  parameters
- support for paginated requests
- basic unittest for filter helper based on usage

Works with the following

et.get_filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.get_filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 27, 2020
- helper method to implement general filter query pattern
- add support for release/product difference in nesting filter
  parameters
- support for paginated requests
- basic unittest for filter helper based on usage

Works with the following

et.get_filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.get_filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Apr 27, 2020
WIP usage of implemented ErrataConnector::filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Oct 20, 2020
- helper method to implement general filter query pattern
- add support for release/product difference in nesting filter
  parameters
- support for paginated requests
- basic unittest for filter helper based on usage

Works with the following

et.get_filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.get_filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Oct 20, 2020
WIP usage of implemented ErrataConnector::get_filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
yazug added a commit to yazug/errata-tool that referenced this issue Oct 20, 2020
WIP usage of implemented ErrataConnector::get_filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
@simonbaird
Copy link

FYI there's a new endpoint you can use for this coming soon, probably in ET 4.4, early December.

Details
Code

@ktdreyer
Copy link
Member Author

ktdreyer commented May 2, 2022

Thanks @simonbaird , we should totally use that instead.

api guide look for /api/v1/erratum/search

@ktdreyer ktdreyer changed the title support the "filter" API for searching support the advisory search REST API May 2, 2022
yazug added a commit to yazug/errata-tool that referenced this issue Jul 7, 2023
- helper method to implement general filter query pattern
- add support for release/product difference in nesting filter
  parameters
- support for paginated requests
- basic unittest for filter helper based on usage

Works with the following

et.get_filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.get_filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants