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

Add DELETE support #67

Merged

Conversation

jhernand
Copy link
Collaborator

Add DELETE support

This patch adds support for the DELETE HTTP method. The adapter will now accept the DELETE method and call the Delete method defined in the DeleteHandler interface. For example, a simple implementation that stores the object in a map in memory could look like this:

func (h *MyHandler) Delete(ctx context.Context, request *AddRequest) (respone *AddResponse, err error) {
        h.storeLock.Lock()
        defer h.storeLock.Unlock()
        delete(h.storeMap, request.Variables[0])
        return
}

Copy link

openshift-ci bot commented Feb 21, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jhernand. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jhernand
Copy link
Collaborator Author

Note that this shares a commit with #66. That should be merged before this, and then this should be rebased.

@jhernand jhernand changed the title Add delete support to http handler Add DELETE support Feb 21, 2024
This patch adds support for the `DELETE` HTTP method. The adapter will now
accept the `DELETE` method and call the `Delete` method defined in the
`DeleteHandler` interface. For example, a simple implementation that
stores the object in a map in memory could look like this:

```go
func (h *MyHandler) Delete(ctx context.Context, request *AddRequest) (respone *AddResponse, err error) {
        h.storeLock.Lock()
        defer h.storeLock.Unlock()
        delete(h.storeMap, request.Variables[0])
        return
}
```

Signed-off-by: Juan Hernandez <[email protected]>
@jhernand jhernand force-pushed the add_delete_support_to_http_handler branch from d9002bb to b6f66f1 Compare February 21, 2024 16:08
@danielerez
Copy link
Collaborator

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2024
@jhernand jhernand merged commit 3f7d3eb into openshift-kni:main Feb 21, 2024
7 of 8 checks passed
@jhernand jhernand deleted the add_delete_support_to_http_handler branch February 21, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants