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
To create a Kafka quota the admin REST SDK issues a POST request to the /admin/quotas/ENTITYNAME path (where `ENTITYNAME` is the name of the entity that you want to create. The entity name of the quota can be `default` or an IAM Service ID that starts with an `iam-ServiceId` prefix).
734
+
The body of the request contains a JSON document, for example:
735
+
```json
736
+
{
737
+
"producer_byte_rate": 1024,
738
+
"consumer_byte_rate": 1024
739
+
}
740
+
```
741
+
742
+
Create Quota would create either 1 or 2 quotas depending on what data is passed in.
743
+
744
+
Expected HTTP status codes:
745
+
746
+
- 201: Quota creation request was created.
747
+
- 400: Invalid request JSON.
748
+
- 403: Not authorized to create quota.
749
+
- 422: Semantically invalid request.
750
+
751
+
If the request to create a Kafka quota succeeds then HTTP status code 201 (Created) is returned. If the operation fails then a HTTP status code of 422 (Un-processable Entity) is returned, and a JSON object containing additional information about the failure is returned as the body of the response.
if (response.getStatusCode() ==HttpStatus.CREATED) {
774
+
System.out.println("\tQuota created for the entity: "+ entityName);
775
+
} else {
776
+
System.out.println("\tError creating quota for the entity: "+ entityName);
777
+
}
778
+
}
779
+
```
780
+
781
+
782
+
### Deleting a Kafka quota
783
+
---
784
+
To delete a Kafka quota, the admin REST SDK issues a DELETE request to the `/admin/quotas/ENTITYNAME`
785
+
path (where `ENTITYNAME` is the name of the entity that you want to delete. The entity name of the quota can be `default` or an IAM Service ID that starts with an `iam-ServiceId` prefix).
786
+
787
+
Expected return codes:
788
+
- 202: Quota deletion request was accepted.
789
+
- 403: Not authorized to delete quota.
790
+
- 404: Entity Quota does not exist.
791
+
- 422: Semantically invalid request.
792
+
793
+
A 202 (Accepted) status code is returned if the REST API accepts the delete
794
+
request or status code 422 (Un-processable Entity) if the delete request is
795
+
rejected. If a delete request is rejected then the body of the HTTP response
796
+
will contain a JSON object which provides additional information about why
To get a Kafka quota detail information, issue a GET request to the `/admin/quotas/ENTITYNAME`
887
+
path (where `ENTITYNAME` is the name of the entity that you want to get. The entity name of the quota can be `default` or an IAM Service ID that starts with an `iam-ServiceId` prefix).
888
+
889
+
Expected status codes
890
+
- 200: Retrieve quota details successfully in following format:
System.out.println("\tError getting quota details for the entity: "+ entityName);
920
+
}
921
+
}
922
+
```
923
+
924
+
### Updating Kafka quota's information
925
+
---
926
+
To Update an entity's quota, issue a
927
+
`PATCH` request to `/admin/quotas/ENTITYNAME` with the following body:
928
+
(where `ENTITYNAME` is the name of the entity that you want to update. The entity name of the quota can be `default` or an IAM Service ID that starts with an `iam-ServiceId` prefix).
0 commit comments