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: add customizable removal check for Request resource #71

Conversation

arielsepton
Copy link
Member

@arielsepton arielsepton commented Nov 27, 2024

Description: Customizable Removal Check for Request Resource

This PR introduces a new optional field, isRemovedCheck, for the Request resource. This enhancement allows users to define custom logic for determining if a resource is removed. The field supports two types:

  1. DEFAULT: The resource is considered removed if the OBSERVE response has a 404 status code.
  2. CUSTOM: Allows users to define JQ-based logic for evaluating the removal status.

Example:

For a CUSTOM check:

isRemovedCheck:
  type: CUSTOM
  logic: |
    if .response.statusCode == 404
      and .response.body.error == "User not found"
      then true 
      else false 
      end

Behavior:

  • If the JQ query evaluates to false, a REMOVE request is triggered to delete the resource.
  • If the query evaluates to true, the resource is considered deleted and no further action is taken.

This feature enhances flexibility by enabling fine-grained control over resource removal logic.

Changes:

  • Updated the schema to include the isRemovedCheck field.
  • Added validation and execution logic for the new field.
  • Enhanced documentation for Request resource with examples of isRemovedCheck usage.

Testing:

  • Unit tests added for both DEFAULT and CUSTOM scenarios.

Related Issues

Resolves: #67

@arielsepton arielsepton merged commit 6ebb631 into crossplane-contrib:main Nov 27, 2024
7 checks passed
@arielsepton arielsepton linked an issue Nov 27, 2024 that may be closed by this pull request
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 request is continuously triggered after the DELETE request is issued
1 participant