-
Notifications
You must be signed in to change notification settings - Fork 17
HYPERFLEET-978 - docs: Update docs to reflect POST -> PUT changes #137
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,7 +222,7 @@ hyperfleet_adapter_resources_deleted_total{component="adapter-validation",versio | |
| **Example**: | ||
| ```prometheus | ||
| hyperfleet_adapter_api_requests_total{component="adapter-validation",version="v1.0.0",adapter_name="validation",api="hyperfleet",method="GET",endpoint="/clusters/{id}",status_code="200"} 1523 | ||
| hyperfleet_adapter_api_requests_total{component="adapter-validation",version="v1.0.0",adapter_name="validation",api="hyperfleet",method="POST",endpoint="/statuses",status_code="200"} 1487 | ||
| hyperfleet_adapter_api_requests_total{component="adapter-validation",version="v1.0.0",adapter_name="validation",api="hyperfleet",method="PUT",endpoint="/statuses",status_code="200"} 1487 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method label enum is now inconsistent with the example. After switching the example to 🤖 Prompt for AI Agents |
||
| hyperfleet_adapter_api_requests_total{component="adapter-validation",version="v1.0.0",adapter_name="validation",api="kubernetes",method="POST",endpoint="/namespaces/{ns}/jobs",status_code="201"} 1432 | ||
| hyperfleet_adapter_api_requests_total{component="adapter-validation",version="v1.0.0",adapter_name="validation",api="kubernetes",method="GET",endpoint="/namespaces/{ns}/jobs/{name}",status_code="200"} 2145 | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,31 +71,31 @@ This document defines the contract between HyperFleet adapters and the HyperFlee | |
| **Base URL**: `{hyperfleetApiBaseUrl}/api/hyperfleet/{hyperfleetApiVersion}/clusters/{clusterId}/statuses` | ||
|
|
||
| **Method**: | ||
| - `POST` - Upsert ClusterStatus (create or update) | ||
| - `PUT` - Upsert ClusterStatus (create or update) | ||
|
|
||
| ### Upsert Pattern | ||
|
|
||
| Adapters **always use POST** for status reporting: | ||
| Adapters **always use PUT** for status reporting: | ||
|
|
||
| **API Behavior**: | ||
| - The HyperFleet API handles the upsert logic server-side | ||
| - If ClusterStatus doesn't exist: API creates it | ||
| - If ClusterStatus exists: API updates the adapter's status within it | ||
| - Idempotent: Same POST multiple times = same result | ||
| - Idempotent: Same PUT multiple times = same result | ||
|
|
||
| **Adapter Implementation**: | ||
| - No need to GET first to check if status exists | ||
| - Always POST to the same endpoint | ||
| - Always PUT to the same endpoint | ||
| - API handles create-or-update logic automatically | ||
| - Simpler adapter code, fewer HTTP requests | ||
|
|
||
| --- | ||
|
|
||
| ## Status Payload Structure | ||
|
|
||
| ### POST Request (Upsert ClusterStatus) | ||
| ### PUT Request (Upsert ClusterStatus) | ||
|
|
||
| Always POST the adapter status in this structure: | ||
| Always PUT the adapter status in this structure: | ||
|
ma-hill marked this conversation as resolved.
|
||
|
|
||
| ```json | ||
| { | ||
|
|
@@ -136,7 +136,7 @@ Always POST the adapter status in this structure: | |
|
|
||
| **Notes**: | ||
| - The API will upsert this adapter status (create or update based on adapter name) | ||
| - Other adapter statuses for this cluster are preserved (not affected by this POST) | ||
| - Other adapter statuses for this cluster are preserved (not affected by this PUT) | ||
| - API will set `created_time` and `last_report_time` automatically | ||
| - API will add `last_transition_time` to each condition automatically | ||
|
|
||
|
|
@@ -637,7 +637,7 @@ post: | |
| description: "Example resource must exist" | ||
| postActions: | ||
| - type: "api_call" | ||
| method: "POST" | ||
| method: "PUT" | ||
| endpoint: "{{ .hyperfleetApiBaseUrl }}/api/{{ .hyperfleetApiVersion }}/clusters/{{ .clusterId }}/statuses" | ||
| headers: | ||
|
Comment on lines
+640
to
642
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Framework config endpoint path is inconsistent with this document’s own status endpoint contract. Line 641 uses As per coding guidelines "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity. Validate changes against HyperFleet architecture standards from the linked architecture repository." 🤖 Prompt for AI Agents |
||
| - name: "Authorization" | ||
|
|
@@ -654,7 +654,7 @@ post: | |
| 3. **Evaluate Conditions**: Evaluate CEL expressions for applied, available, health | ||
| 4. **Evaluate Data**: Evaluate CEL expressions for custom data fields | ||
| 5. **Build Payload**: Construct status payload with conditions and data | ||
| 6. **Execute PostActions**: POST to HyperFleet API endpoint | ||
| 6. **Execute PostActions**: PUT to HyperFleet API endpoint | ||
|
|
||
| --- | ||
|
|
||
|
|
@@ -675,7 +675,7 @@ Content-Type: application/json | |
| ### Example Request | ||
|
|
||
| ```http | ||
| POST /api/v1/clusters/cls-123/statuses HTTP/1.1 | ||
| PUT /api/v1/clusters/cls-123/statuses HTTP/1.1 | ||
|
ma-hill marked this conversation as resolved.
|
||
| Host: api.hyperfleet.example.com | ||
| Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9... | ||
| Content-Type: application/json | ||
|
|
@@ -769,9 +769,9 @@ Use the `data` field for adapter-specific structured data that other components | |
|
|
||
| Report adapter errors with `Health=False` and appropriate error messages. | ||
|
|
||
| ### 8. Always Use POST | ||
| ### 8. Always Use PUT | ||
|
|
||
| Always POST to the same endpoint - the API handles upsert logic server-side for idempotency. | ||
| Always PUT to the same endpoint - the API handles upsert logic server-side for idempotency. | ||
|
|
||
| ### 9. Conditions: reason and message Are Optional | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve cross-repo contract inconsistency before merge.
The architecture docs now specify PUT for
/clusters/{id}/statuses, but the linkedhyperfleet-apirepository still documents POST for the same endpoint in README.md, docs/api-resources.md, docs/api-operator-guide.md, and docs/hyperfleet-api.http. Meanwhile,hyperfleet-adaptertests and mocks already expect PUT.This three-way mismatch creates an ambiguous contract that will cause integration failures or force adapters to guess the correct verb.
Coordinate updates across repositories:
hyperfleet-apidocumentation and examples to matchhyperfleet-adaptermocksAs per coding guidelines: "Validate changes against HyperFleet architecture standards from the linked architecture repository."
🤖 Prompt for AI Agents