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 Registry Module Search and Filter parameters #850

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sharathrnair87
Copy link
Contributor

  • Search RegistryModules by name
  • Filter RegistryModules based on provider, registry_name and organization_name

Description

  • Add support for the query parameter q and filters based on provider, registry_name and organization_name. Described here

Testing plan

  • Code Snippet to search by Registry Module name
  for {
    log.Debugf("Processing page %d.\n", currentPage)
    options := &tfe.RegistryModuleListOptions{
      ListOptions: tfe.ListOptions{
        PageNumber: currentPage,
        PageSize:   50,
      },
      Search: moduleName, // Name of the Registry Module as a search query string
    }
  // ...
  }
  • Code Snippet to filter by Registry Module provider name
  for {
    log.Debugf("Processing page %d.\n", currentPage)
    options := &tfe.RegistryModuleListOptions{
      ListOptions: tfe.ListOptions{
        PageNumber: currentPage,
        PageSize:   50,
      },
      Provider: providerName, // Name of the Registry Module provider as a search query string
    }
  // ... 
  } 

Output from tests

$ go test -run TestRegistryModulesList -v ./...
=== RUN   TestRegistryModulesList
=== RUN   TestRegistryModulesList/with_no_list_options
=== RUN   TestRegistryModulesList/with_list_options
=== RUN   TestRegistryModulesList/with_search_query
=== RUN   TestRegistryModulesList/with_filter[provider]
=== RUN   TestRegistryModulesList/with_filter[registry_name]
--- PASS: TestRegistryModulesList (7.48s)
    --- PASS: TestRegistryModulesList/with_no_list_options (0.74s)
    --- PASS: TestRegistryModulesList/with_list_options (1.31s)
    --- PASS: TestRegistryModulesList/with_search_query (0.64s)
    --- PASS: TestRegistryModulesList/with_filter[provider] (0.49s)
    --- PASS: TestRegistryModulesList/with_filter[registry_name] (0.67s)
=== RUN   TestRegistryModulesListCommit
    registry_module_integration_test.go:714: Skipping test related to a Terraform Cloud beta feature. Set ENABLE_BETA=1 to run.
--- SKIP: TestRegistryModulesListCommit (0.00s)
PASS

* Search RegistryModules by name
* Filter RegistryModules based on provider, registry_name and organization_name
@sharathrnair87 sharathrnair87 requested a review from a team as a code owner February 8, 2024 01:53
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