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

feat: implement GET /registration_requests and /registration_requests/{id} #140

Merged
merged 3 commits into from
May 11, 2024

Conversation

ramirezj
Copy link
Member

Description

Implement GET /registration_requests and /registration_requests/{id} endpoints, together with revising tests to handle JSON output produced in Steampiper v0.23

Related Tickets & Documents

Closes #38, #39

Steps to Verify

Untested, insufficient data

Copy link
Contributor

coderabbitai bot commented May 11, 2024

Walkthrough

The updates involve refining JSON parsing logic and introducing new test scripts for registration requests in the Kolide API. These changes enhance data extraction methods and extend test coverage to validate additional functionality related to registration requests, ensuring the API's reliability and adherence to specified requirements.

Changes

File Path Change Summary
.../kolide_person_registered_device.bats Updated JSON parsing logic to access nested fields.
.../kolide_unprocessable_entity.bats Updated JSON parsing to access top-level array directly.
.../kolide_registration_request.bats Added new test cases for registration request attributes.
.../kolide_registration_request_by_id.bats Introduced test cases for querying registration requests by ID with validation of result uniqueness.

Assessment against linked issues

Objective Addressed Explanation
GET /registration_requests/ (#38)

Poem

In the code's woven nest, changes flutter anew,
Tests chirp in lines, as features grow true.
🐇 Hopping through scripts, with a coder's delight,
Ensuring each query, performs just right.
Cheers to the devs, from the burrows we chime,
For bugs that are squashed, in just the nick of time!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Out of diff range and nitpick comments (18)
docs/tables/kolide_registration_request.md (1)

21-21: Consider adding a preposition for clarity: "List all unresolved requests for".

docs/coverage.md (17)

Line range hint 3-3: Consider using the Oxford spelling "utilising" to maintain consistency with international English standards.


Line range hint 9-9: For British English, consider changing "Ok" to "OK".


Line range hint 10-10: For British English, consider changing "Ok" to "OK".


Line range hint 19-19: For British English, consider changing "Ok" to "OK".


Line range hint 20-20: For British English, consider changing "Ok" to "OK".


Line range hint 22-22: For British English, consider changing "Ok" to "OK".


Line range hint 23-23: For British English, consider changing "Ok" to "OK".


Line range hint 27-27: For British English, consider changing "Ok" to "OK".


Line range hint 40-40: For British English, consider changing "Ok" to "OK".


Line range hint 41-41: For British English, consider changing "Ok" to "OK".


Line range hint 42-42: For British English, consider changing "Ok" to "OK".


43-43: For British English, consider changing "Ok" to "OK".


46-46: For British English, consider changing "Ok" to "OK".


47-47: For British English, consider changing "Ok" to "OK".


Line range hint 55-55: For British English, consider changing "Ok" to "OK".


Line range hint 56-56: For British English, consider changing "Ok" to "OK".


Line range hint 59-59: For British English, consider changing "ok" to "OK".

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between cb966de and b5e4df0.
Files selected for processing (29)
  • docs/coverage.md (1 hunks)
  • docs/tables/kolide_registration_request.md (1 hunks)
  • kolide/client/registration_requests.go (1 hunks)
  • kolide/plugin.go (1 hunks)
  • kolide/table_kolide_registration_request.go (1 hunks)
  • test/end-to-end/_query/kolide_registration_request.sql (1 hunks)
  • test/end-to-end/_query/kolide_registration_request_by_id.sql (1 hunks)
  • test/end-to-end/_results/kolide_registration_request.bash (1 hunks)
  • test/end-to-end/kolide_admin_user.bats (1 hunks)
  • test/end-to-end/kolide_admin_user_by_id.bats (1 hunks)
  • test/end-to-end/kolide_audit_log.bats (1 hunks)
  • test/end-to-end/kolide_audit_log_by_id.bats (1 hunks)
  • test/end-to-end/kolide_check.bats (1 hunks)
  • test/end-to-end/kolide_check_by_id.bats (1 hunks)
  • test/end-to-end/kolide_deprovisioned_person.bats (1 hunks)
  • test/end-to-end/kolide_device.bats (1 hunks)
  • test/end-to-end/kolide_device_by_id.bats (1 hunks)
  • test/end-to-end/kolide_device_open_issue.bats (1 hunks)
  • test/end-to-end/kolide_issue.bats (1 hunks)
  • test/end-to-end/kolide_issue_by_id.bats (1 hunks)
  • test/end-to-end/kolide_package.bats (1 hunks)
  • test/end-to-end/kolide_package_by_id.bats (1 hunks)
  • test/end-to-end/kolide_person.bats (1 hunks)
  • test/end-to-end/kolide_person_by_id.bats (1 hunks)
  • test/end-to-end/kolide_person_open_issue.bats (1 hunks)
  • test/end-to-end/kolide_person_registered_device.bats (1 hunks)
  • test/end-to-end/kolide_registration_request.bats (1 hunks)
  • test/end-to-end/kolide_registration_request_by_id.bats (1 hunks)
  • test/end-to-end/kolide_unprocessable_entity.bats (1 hunks)
Files skipped from review due to trivial changes (4)
  • test/end-to-end/_query/kolide_registration_request.sql
  • test/end-to-end/_query/kolide_registration_request_by_id.sql
  • test/end-to-end/_results/kolide_registration_request.bash
  • test/end-to-end/kolide_admin_user_by_id.bats
Additional Context Used
LanguageTool (18)
docs/coverage.md (17)

Near line 3: Would you like to use the Oxford spelling “utilizing”? The spelling ‘utilising’ is also correct.
Context: ...he observed behaviour of the Kolide API utilising credentials representing different bill...


Near line 9: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /audit_logs/{id} ...


Near line 10: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /devices/{deviceId}/open_i...


Near line 19: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /issues/{id} ...


Near line 20: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /deprovisioned_people ...


Near line 22: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /packages/{id} ...


Near line 23: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /people/{personId}/registe...


Near line 27: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ❓ | ? | ? | Ok | | GET | /person_groups ...


Near line 40: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /checks/{id} ...


Near line 41: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /exemption_requests ...


Near line 42: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | #36 | ? | ? | Ok | | GET | /exemption_requests/{id} ...


Near line 43: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | #37 | ? | ? | Ok | | PATCH | /exemption_requests/{id} ...


Near line 46: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ❓ | ? | ? | Ok | | GET | /registration_requests/{id...


Near line 47: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ❓ | ? | ? | Ok | | PATCH | /registration_requests/{id...


Near line 55: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | | GET | /admin_users/{id} ...


Near line 56: Lower-case ‘Ok’ is American English. For British English use “OK”.
Context: ... | ✅ | ? | ? | Ok | [^1]: Returns a 403, not included in...


Near line 59: Lower-case ‘ok’ is American English. For British English use “OK”.
Context: ... included in billing plan [^2]: Returns ok, but registration information is missin...

docs/tables/kolide_registration_request.md (1)

Near line 21: Possible missing preposition found.
Context: ...ide_registration_request; ### List all unresolved requests sql select id...

Additional comments not posted (73)
test/end-to-end/kolide_check_by_id.bats (1)

20-20: The change to use '.rows | length' for JSON parsing aligns with the updated output format in Steampipe v0.23. This ensures that the test accurately counts the number of results.

test/end-to-end/kolide_issue_by_id.bats (1)

20-20: The update to JSON parsing using '.rows | length' is consistent with the changes in Steampipe v0.23, ensuring accurate result counting.

test/end-to-end/kolide_device_by_id.bats (1)

20-20: Consistent update to JSON parsing using '.rows | length' across test files aligns with the changes in Steampipe v0.23, ensuring accurate result counting.

test/end-to-end/kolide_person_by_id.bats (1)

20-20: This update to JSON parsing using '.rows | length' is consistent with the changes in Steampipe v0.23, ensuring accurate result counting.

test/end-to-end/kolide_package_by_id.bats (1)

20-20: Consistent update to JSON parsing using '.rows | length' across test files aligns with the changes in Steampipe v0.23, ensuring accurate result counting.

test/end-to-end/kolide_audit_log_by_id.bats (1)

20-20: This update to JSON parsing using '.rows | length' is consistent with the changes in Steampipe v0.23, ensuring accurate result counting.

test/end-to-end/kolide_registration_request_by_id.bats (1)

20-20: Consistent update to JSON parsing using '.rows | length' across test files aligns with the changes in Steampipe v0.23, ensuring accurate result counting.

test/end-to-end/kolide_deprovisioned_person.bats (2)

32-32: The JSON parsing for the name field is correctly implemented.


38-38: The JSON parsing and conditional output for the email field are correctly handled.

test/end-to-end/kolide_unprocessable_entity.bats (2)

27-27: The JSON parsing for counting the results is correctly implemented.


34-34: The JSON parsing for the title field is correctly implemented.

test/end-to-end/kolide_device.bats (4)

26-26: The JSON parsing for counting the results is correctly implemented.


32-32: The JSON parsing for the name field is correctly implemented.


38-38: The JSON parsing and conditional output for the hardware model field are correctly handled.


43-43: The JSON parsing for the serial field is correctly implemented.

test/end-to-end/kolide_person_registered_device.bats (4)

26-26: The JSON parsing for counting the results is correctly implemented.


32-32: The JSON parsing for the name field is correctly implemented.


38-38: The JSON parsing and conditional output for the hardware model field are correctly handled.


43-43: The JSON parsing for the serial field is correctly implemented.

test/end-to-end/kolide_person.bats (4)

26-26: The JSON parsing for counting the results is correctly implemented.


32-32: The JSON parsing for the name field is correctly implemented.


38-38: The JSON parsing and conditional output for the email field are correctly handled.


44-44: The JSON parsing for the has_registered_device field is correctly implemented.

test/end-to-end/kolide_audit_log.bats (4)

26-26: The JSON parsing for counting the results is correctly implemented.


33-33: The JSON parsing for the timestamp field is correctly implemented.


39-39: The JSON parsing for the description field is correctly implemented.


45-45: The JSON parsing for the actor_name field is correctly implemented.

kolide/client/registration_requests.go (3)

5-8: The structure for RegistrationRequestListResponse is correctly defined to match the expected JSON response format.


9-18: The structure for RegistrationRequest is correctly defined, including appropriate use of omitempty for optional fields.


20-23: The handling of potential type discrepancy in RequesterInformation is appropriately addressed with a comment and flexible type choice.

kolide/plugin.go (1)

42-42: Addition of the "kolide_registration_request" table to the plugin's table map looks correct.

test/end-to-end/kolide_admin_user.bats (6)

26-26: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


32-32: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


37-37: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


43-43: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


49-49: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


55-55: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.

test/end-to-end/kolide_device_open_issue.bats (6)

26-26: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


33-33: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


39-39: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


45-45: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


51-51: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


57-57: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.

test/end-to-end/kolide_person_open_issue.bats (6)

26-26: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


33-33: Adjustment to JSON parsing to use .rows for accessing data aligns with the new JSON output format in Steampipe v0.23.


39-39: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


45-45: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


51-51: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


57-57: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.

test/end-to-end/kolide_issue.bats (6)

26-26: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


33-33: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


39-39: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


45-45: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


51-51: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


57-57: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.

test/end-to-end/kolide_registration_request.bats (7)

26-26: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


32-32: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


37-37: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


43-43: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


49-49: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


55-55: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


61-61: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.

test/end-to-end/kolide_check.bats (8)

26-26: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


32-32: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


37-37: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


43-43: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


49-49: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


55-55: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


61-61: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.


67-67: Adjustment to JSON parsing to use `.rows” for accessing data aligns with the new JSON output format in Steampipe v0.23.

kolide/table_kolide_registration_request.go (3)

14-45: The table structure for `kolide_registration_request” is well-defined, with appropriate column types and descriptions. List and get configurations are correctly set up.


50-56: The function `listRegistrationRequests” is correctly implemented to interact with the Kolide API for listing registration requests.


60-65: The function `getRegistrationRequest” is correctly implemented to interact with the Kolide API for getting a specific registration request.

test/end-to-end/kolide_deprovisioned_person.bats Outdated Show resolved Hide resolved
test/end-to-end/kolide_unprocessable_entity.bats Outdated Show resolved Hide resolved
kolide/client/registration_requests.go Show resolved Hide resolved
kolide/client/registration_requests.go Show resolved Hide resolved
@ramirezj ramirezj linked an issue May 11, 2024 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between b5e4df0 and 40b0445.
Files selected for processing (2)
  • test/end-to-end/kolide_deprovisioned_person.bats (1 hunks)
  • test/end-to-end/kolide_unprocessable_entity.bats (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • test/end-to-end/kolide_deprovisioned_person.bats
  • test/end-to-end/kolide_unprocessable_entity.bats

@ramirezj ramirezj merged commit d4d4ad6 into main May 11, 2024
6 checks passed
@ramirezj ramirezj deleted the implement-registration-request branch May 11, 2024 10:17
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.

GET /registration_requests/{id} GET /registration_requests/
1 participant