Skip to content

Commit

Permalink
[CCXDEV-13075] Add 403 responses to OpenAPI (#1383)
Browse files Browse the repository at this point in the history
* add 403 responses to OpenAPI

* fix typo
  • Loading branch information
juandspy authored Dec 4, 2024
1 parent 22ad6d3 commit c6b967f
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 16 deletions.
91 changes: 78 additions & 13 deletions server/api/v1/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@
"SmartProxy": {
"type": "object",
"additionalProperties": {
"type": "string"
"type": "string"
}
},
"Aggregator": {
"type": "object",
"additionalProperties": {
"type": "string"
"type": "string"
}
},
"ContentService": {
"type": "object",
"additionalProperties": {
"type": "string"
"type": "string"
}
}
}
Expand Down Expand Up @@ -154,6 +154,9 @@
},
"description": "A JSON array of groups."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"503": {
"content": {
"text/plain": {}
Expand Down Expand Up @@ -206,6 +209,9 @@
}
},
"description": "A JSON array of clusters that belong to the specified organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
},
"operationId": "getClustersForOrganization",
Expand Down Expand Up @@ -246,6 +252,9 @@
},
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
},
"operationId": "getReportsForClusters",
Expand Down Expand Up @@ -277,6 +286,9 @@
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"description": "Resource not found, usually caused when the rule ID and error key combination doesn't exist in the content service"
}
Expand Down Expand Up @@ -310,6 +322,9 @@
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"description": "Resource not found, usually caused when the rule ID and error key combination doesn't exist in the content service"
}
Expand Down Expand Up @@ -343,6 +358,9 @@
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"description": "Resource not found, usually caused when the rule ID and error key combination doesn't exist in the content service"
}
Expand Down Expand Up @@ -379,6 +397,9 @@
}
},
"description": "A JSON array of all the rule IDs."
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
},
"operationId": "getRuleIDs",
Expand Down Expand Up @@ -416,6 +437,9 @@
},
"description": "A JSON object with the content."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"content": {
"application/json": {
Expand Down Expand Up @@ -468,6 +492,9 @@
}
},
"description": "A JSON object with the content."
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
},
"operationId": "getContent",
Expand Down Expand Up @@ -499,6 +526,9 @@
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"description": "Resource not found, usually caused when the rule ID and error key combination doesn't exist in the content service"
}
Expand Down Expand Up @@ -564,6 +594,9 @@
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"description": "Resource not found, usually caused when the rule ID and error key combination doesn't exist in the content service"
}
Expand All @@ -584,19 +617,22 @@
"$ref": "#/components/parameters/clusterId"
},
{
"$ref": "#/components/parameters/ruleId"
"$ref": "#/components/parameters/ruleId"
},
{
"$ref": "#/components/parameters/errorKey"
}
],
"responses": {
"200": {
"$ref": "#/components/responses/status"
"$ref": "#/components/responses/status"
},
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"description": "Resource not found, usually caused when the rule ID and error key combination doesn't exist in the content service"
}
Expand All @@ -621,6 +657,9 @@
}
}
}
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
},
"operationId": "getOverviewForOrganization",
Expand Down Expand Up @@ -664,6 +703,9 @@
}
},
"description": "Status ok"
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
}
}
Expand Down Expand Up @@ -726,7 +768,7 @@
}
},
"example": {
"count": 9,
"count": 9,
"last_checked_at": "2020-12-08T09:45:23Z"
}
}
Expand All @@ -741,6 +783,9 @@
}
}
},
"403": {
"$ref": "#/components/responses/unauthorized"
},
"404": {
"description": "Resource not found, usually caused when the cluster ID is not registered and request come from Insights Operator."
}
Expand Down Expand Up @@ -800,6 +845,9 @@
}
}
}
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
},
"tags": [
Expand Down Expand Up @@ -829,8 +877,6 @@
"$ref": "#/components/parameters/osdEligible"
}
],


"responses": {
"200": {
"description": "Latest available rule report for the given organization, cluster combination and rule ID. Returns rule and it description that were hit by the cluster.",
Expand All @@ -851,16 +897,16 @@
}
}
}
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
},
"operationId": "getSingleReportForCluster",
"summary": "Returns the latest single rule report for a cluster that contains information and content.",
"description": "The rule is specified by the cluster ID and rule ID from params and information about the org_id and user_id is taken from the token. The latest rule report available for the given combination will be returned."
}
},



"/clusters/reports": {
"post": {
"tags": [
Expand Down Expand Up @@ -902,6 +948,9 @@
},
"400": {
"description": "Invalid request, usually caused when some cluster belongs to different organization."
},
"403": {
"$ref": "#/components/responses/unauthorized"
}
}
}
Expand Down Expand Up @@ -1298,8 +1347,8 @@
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
"type": "string"
}
}
}
}
Expand Down Expand Up @@ -1354,6 +1403,22 @@
"text/plain": {}
}
},
"unauthorized": {
"description": "The requester is unauthorized. If using a service account, you may not belong to the right group with the right role. Please make sure you configured your user access on the console.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "Account does not have the required permissions"
}
}
}
}
}
},
"status": {
"description": "Status ok",
"content": {
Expand Down
Loading

0 comments on commit c6b967f

Please sign in to comment.