Function kubewarden_policy_sdk::reject_request

source ·
pub fn reject_request(
    message: Option<String>,
    code: Option<u16>,
    audit_annotations: Option<HashMap<String, String>>,
    warnings: Option<Vec<String>>
) -> CallResult
Expand description

Create a rejection response

§Arguments

  • message - message shown to the user
  • code - code shown to the user
  • audit_annotations - an unstructured key value map set by remote admission controller (e.g. error=image-blacklisted). MutatingAdmissionWebhook and ValidatingAdmissionWebhook admission controller will prefix the keys with admission webhook name (e.g. imagepolicy.example.com/error=image-blacklisted). AuditAnnotations will be provided by the admission webhook to add additional context to the audit log for this request.
  • warnings - a list of warning messages to return to the requesting API client. Warning messages describe a problem the client making the API request should correct or be aware of. Limit warnings to 120 characters if possible. Warnings over 256 characters and large numbers of warnings may be truncated.