{
  "properties": {
    "spec": {
      "description": "Configuration for access control on workloads. See more details at: https://istio.io/docs/reference/config/security/authorization-policy.html",
      "oneOf": [
        {
          "not": {
            "anyOf": [
              {
                "required": [
                  "provider"
                ]
              }
            ]
          }
        },
        {
          "required": [
            "provider"
          ]
        }
      ],
      "properties": {
        "action": {
          "description": "Optional.\n\nValid Options: ALLOW, DENY, AUDIT, CUSTOM",
          "enum": [
            "ALLOW",
            "DENY",
            "AUDIT",
            "CUSTOM"
          ],
          "type": "string"
        },
        "provider": {
          "description": "Specifies detailed configuration of the CUSTOM action.",
          "properties": {
            "name": {
              "description": "Specifies the name of the extension provider.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "rules": {
          "description": "Optional.",
          "items": {
            "properties": {
              "from": {
                "description": "Optional.",
                "items": {
                  "properties": {
                    "source": {
                      "description": "Source specifies the source of a request.",
                      "properties": {
                        "ipBlocks": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "namespaces": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notIpBlocks": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notNamespaces": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notPrincipals": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notRemoteIpBlocks": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notRequestPrincipals": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notServiceAccounts": {
                          "description": "Optional.",
                          "items": {
                            "maxLength": 320,
                            "type": "string"
                          },
                          "maxItems": 16,
                          "type": "array"
                        },
                        "principals": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "remoteIpBlocks": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "requestPrincipals": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "serviceAccounts": {
                          "description": "Optional.",
                          "items": {
                            "maxLength": 320,
                            "type": "string"
                          },
                          "maxItems": 16,
                          "type": "array"
                        }
                      },
                      "type": "object",
                      "x-kubernetes-validations": [
                        {
                          "message": "Cannot set serviceAccounts with namespaces or principals",
                          "rule": "(has(self.serviceAccounts) || has(self.notServiceAccounts)) ? (!has(self.principals) &&\n!has(self.notPrincipals) && !has(self.namespaces) && !has(self.notNamespaces)) : true"
                        }
                      ],
                      "additionalProperties": false
                    }
                  },
                  "type": "object",
                  "additionalProperties": false
                },
                "maxItems": 512,
                "type": "array"
              },
              "to": {
                "description": "Optional.",
                "items": {
                  "properties": {
                    "operation": {
                      "description": "Operation specifies the operation of a request.",
                      "properties": {
                        "hosts": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "methods": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notHosts": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notMethods": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notPaths": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "notPorts": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "paths": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "ports": {
                          "description": "Optional.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object",
                      "additionalProperties": false
                    }
                  },
                  "type": "object",
                  "additionalProperties": false
                },
                "type": "array"
              },
              "when": {
                "description": "Optional.",
                "items": {
                  "properties": {
                    "key": {
                      "description": "The name of an Istio attribute.",
                      "type": "string"
                    },
                    "notValues": {
                      "description": "Optional.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "values": {
                      "description": "Optional.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "key"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "type": "array"
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "maxItems": 512,
          "type": "array"
        },
        "selector": {
          "description": "Optional.",
          "properties": {
            "matchLabels": {
              "additionalProperties": {
                "maxLength": 63,
                "type": "string",
                "x-kubernetes-validations": [
                  {
                    "message": "wildcard not allowed in label value match",
                    "rule": "!self.contains(\"*\")"
                  }
                ]
              },
              "description": "One or more labels that indicate a specific set of pods/VMs on which a policy should be applied.",
              "maxProperties": 4096,
              "type": "object",
              "x-kubernetes-validations": [
                {
                  "message": "wildcard not allowed in label key match",
                  "rule": "self.all(key, !key.contains(\"*\"))"
                },
                {
                  "message": "key must not be empty",
                  "rule": "self.all(key, key.size() != 0)"
                }
              ]
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "targetRef": {
          "properties": {
            "group": {
              "description": "group is the group of the target resource.",
              "maxLength": 253,
              "pattern": "^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
              "type": "string"
            },
            "kind": {
              "description": "kind is kind of the target resource.",
              "maxLength": 63,
              "minLength": 1,
              "pattern": "^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$",
              "type": "string"
            },
            "name": {
              "description": "name is the name of the target resource.",
              "maxLength": 253,
              "minLength": 1,
              "type": "string"
            },
            "namespace": {
              "description": "namespace is the namespace of the referent.",
              "type": "string",
              "x-kubernetes-validations": [
                {
                  "message": "cross namespace referencing is not currently supported",
                  "rule": "self.size() == 0"
                }
              ]
            }
          },
          "required": [
            "kind",
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "targetRefs": {
          "description": "Optional.",
          "items": {
            "properties": {
              "group": {
                "description": "group is the group of the target resource.",
                "maxLength": 253,
                "pattern": "^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                "type": "string"
              },
              "kind": {
                "description": "kind is kind of the target resource.",
                "maxLength": 63,
                "minLength": 1,
                "pattern": "^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$",
                "type": "string"
              },
              "name": {
                "description": "name is the name of the target resource.",
                "maxLength": 253,
                "minLength": 1,
                "type": "string"
              },
              "namespace": {
                "description": "namespace is the namespace of the referent.",
                "type": "string",
                "x-kubernetes-validations": [
                  {
                    "message": "cross namespace referencing is not currently supported",
                    "rule": "self.size() == 0"
                  }
                ]
              }
            },
            "required": [
              "kind",
              "name"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "maxItems": 16,
          "type": "array"
        }
      },
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "only one of targetRefs or selector can be set",
          "rule": "(has(self.selector) ? 1 : 0) + (has(self.targetRef) ? 1 : 0) + (has(self.targetRefs) ? 1 : 0) <= 1"
        }
      ],
      "additionalProperties": false
    },
    "status": {
      "properties": {
        "conditions": {
          "description": "Current service state of the resource.",
          "items": {
            "properties": {
              "lastProbeTime": {
                "description": "Last time we probed the condition.",
                "format": "date-time",
                "type": "string"
              },
              "lastTransitionTime": {
                "description": "Last time the condition transitioned from one status to another.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "Human-readable message indicating details about last transition.",
                "type": "string"
              },
              "observedGeneration": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ],
                "description": "Resource Generation to which the Condition refers.",
                "x-kubernetes-int-or-string": true
              },
              "reason": {
                "description": "Unique, one-word, CamelCase reason for the condition's last transition.",
                "type": "string"
              },
              "status": {
                "description": "Status is the status of the condition.",
                "type": "string"
              },
              "type": {
                "description": "Type is the type of the condition.",
                "type": "string"
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "observedGeneration": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-kubernetes-int-or-string": true
        },
        "validationMessages": {
          "description": "Includes any errors or warnings detected by Istio's analyzers.",
          "items": {
            "properties": {
              "documentationUrl": {
                "description": "A url pointing to the Istio documentation for this specific error type.",
                "type": "string"
              },
              "level": {
                "description": "Represents how severe a message is.\n\nValid Options: UNKNOWN, ERROR, WARNING, INFO",
                "enum": [
                  "UNKNOWN",
                  "ERROR",
                  "WARNING",
                  "INFO"
                ],
                "type": "string"
              },
              "type": {
                "properties": {
                  "code": {
                    "description": "A 7 character code matching `^IST[0-9]{4}$` intended to uniquely identify the message type.",
                    "type": "string"
                  },
                  "name": {
                    "description": "A human-readable name for the message type.",
                    "type": "string"
                  }
                },
                "type": "object",
                "additionalProperties": false
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        }
      },
      "type": "object",
      "x-kubernetes-preserve-unknown-fields": true,
      "additionalProperties": false
    }
  },
  "type": "object"
}
