You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The remote REST API I need to interact with does not support PUT; however, it allows resource updates via PATCH. I specified method: PATCH for the corresponding action: UPDATE object in spec.forProvider.mappings[], but it was rejected at the Kube API server because the requests.http.crossplane.io CRD only supports POST, GET, PUT, or DELETE values.
How can we reproduce it?
Try to create a Request resource with a mapping that uses any method other than GET, POST, PUT, or DELETE. For example, just update examples/sample/request.yaml to use PATCH rather than PUT for the UPDATE action:
While PR #62 added support for custom actions to fix issue #58, it did not update the corresponding kubebuilder:validation:Enum marker to support use cases that require other HTTP methods like PATCH or HEAD (e.g., observe changes via etag). Updating the marker to include PATCH appears to resolve my immediate issue, but I'm not entirely sure it addresses all possible concerns. Here are the changes I experimented with:
diff --git a/apis/request/v1alpha2/request_types.go b/apis/request/v1alpha2/request_types.go
index 591d248..7fc3ef2 100644
--- a/apis/request/v1alpha2/request_types.go
+++ b/apis/request/v1alpha2/request_types.go
@@ -67,7 +67,7 @@ type RequestParameters struct {
type Mapping struct {
// Either Method or Action must be specified. If both are omitted, the mapping will not be used.
- // +kubebuilder:validation:Enum=POST;GET;PUT;DELETE
+ // +kubebuilder:validation:Enum=POST;GET;HEAD;PUT;PATCH;DELETE
// Method specifies the HTTP method for the request.
Method string `json:"method,omitempty"`
diff --git a/package/crds/http.crossplane.io_requests.yaml b/package/crds/http.crossplane.io_requests.yaml
index b511374..42ca085 100644
--- a/package/crds/http.crossplane.io_requests.yaml
+++ b/package/crds/http.crossplane.io_requests.yaml
@@ -543,7 +543,9 @@ spec:
enum:
- POST
- GET
+ - HEAD
- PUT
+ - PATCH
- DELETE
type: string
url:
@@ -926,7 +928,9 @@ spec:
enum:
- POST
- GET
+ - HEAD
- PUT
+ - PATCH
- DELETE
type: string
url:
The text was updated successfully, but these errors were encountered:
What happened?
The remote REST API I need to interact with does not support
PUT
; however, it allows resource updates viaPATCH
. I specifiedmethod: PATCH
for the correspondingaction: UPDATE
object inspec.forProvider.mappings[]
, but it was rejected at the Kube API server because therequests.http.crossplane.io
CRD only supportsPOST
,GET
,PUT
, orDELETE
values.How can we reproduce it?
Try to create a
Request
resource with a mapping that uses any method other thanGET
,POST
,PUT
, orDELETE
. For example, just update examples/sample/request.yaml to usePATCH
rather thanPUT
for theUPDATE
action:The Kube API server will respond that the
Request
is invalid:What environment did it happen in?
Crossplane version: v1.18.1
Provider-http version: v1.0.6
Possible work around
While PR #62 added support for custom actions to fix issue #58, it did not update the corresponding
kubebuilder:validation:Enum
marker to support use cases that require other HTTP methods likePATCH
orHEAD
(e.g., observe changes via etag). Updating the marker to includePATCH
appears to resolve my immediate issue, but I'm not entirely sure it addresses all possible concerns. Here are the changes I experimented with:The text was updated successfully, but these errors were encountered: