# generated by https://github.com/puzl-cloud/kubesdk
#   filename:  apis__authorization.k8s.io__v1_openapi.json

from __future__ import annotations

from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import ClassVar, Dict, List, Set

from kube_models.const import *
from kube_models.loader import *
from kube_models.loader import LazyLoadModel
from kube_models.resource import *

from ...apimachinery.pkg.apis.meta.v1 import (
    FieldSelectorRequirement,
    LabelSelectorRequirement,
    ObjectMeta,
)


@dataclass(slots=True, kw_only=True, frozen=True)
class NonResourceAttributes(LazyLoadModel):
    path: str | None = None
    verb: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class NonResourceRule(LazyLoadModel):
    verbs: List[str]
    nonResourceURLs: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceRule(LazyLoadModel):
    verbs: List[str]
    apiGroups: List[str] | None = None
    resourceNames: List[str] | None = None
    resources: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class SelfSubjectRulesReviewSpec(LazyLoadModel):
    namespace: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class SubjectAccessReviewStatus(LazyLoadModel):
    allowed: bool
    denied: bool | None = None
    evaluationError: str | None = None
    reason: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class SubjectRulesReviewStatus(LazyLoadModel):
    incomplete: bool
    nonResourceRules: List[NonResourceRule]
    resourceRules: List[ResourceRule]
    evaluationError: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class FieldSelectorAttributes(LazyLoadModel):
    rawSelector: str | None = None
    requirements: List[FieldSelectorRequirement] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class LabelSelectorAttributes(LazyLoadModel):
    rawSelector: str | None = None
    requirements: List[LabelSelectorRequirement] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceAttributes(LazyLoadModel):
    fieldSelector: FieldSelectorAttributes | None = None
    group: str | None = None
    labelSelector: LabelSelectorAttributes | None = None
    name: str | None = None
    namespace: str | None = None
    resource: str | None = None
    subresource: str | None = None
    verb: str | None = None
    version: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class SelfSubjectAccessReviewSpec(LazyLoadModel):
    nonResourceAttributes: NonResourceAttributes | None = None
    resourceAttributes: ResourceAttributes | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class SubjectAccessReviewSpec(LazyLoadModel):
    extra: Dict[str, List[str]] | None = None
    groups: List[str] | None = None
    nonResourceAttributes: NonResourceAttributes | None = None
    resourceAttributes: ResourceAttributes | None = None
    uid: str | None = None
    user: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class LocalSubjectAccessReview(K8sResource):
    spec: SubjectAccessReviewSpec
    apiVersion: ClassVar[str] = 'authorization.k8s.io/v1'
    kind: ClassVar[str] = 'LocalSubjectAccessReview'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    status: SubjectAccessReviewStatus | None = None
    api_path_: ClassVar[str] = (
        'apis/authorization.k8s.io/v1/namespaces/{namespace}/localsubjectaccessreviews'
    )
    plural_: ClassVar[str] = 'localsubjectaccessreviews'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'authorization.k8s.io'


@dataclass(slots=True, kw_only=True, frozen=True)
class SelfSubjectAccessReview(K8sResource):
    spec: SelfSubjectAccessReviewSpec
    apiVersion: ClassVar[str] = 'authorization.k8s.io/v1'
    kind: ClassVar[str] = 'SelfSubjectAccessReview'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    status: SubjectAccessReviewStatus | None = None
    api_path_: ClassVar[str] = 'apis/authorization.k8s.io/v1/selfsubjectaccessreviews'
    plural_: ClassVar[str] = 'selfsubjectaccessreviews'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'authorization.k8s.io'


@dataclass(slots=True, kw_only=True, frozen=True)
class SelfSubjectRulesReview(K8sResource):
    spec: SelfSubjectRulesReviewSpec
    apiVersion: ClassVar[str] = 'authorization.k8s.io/v1'
    kind: ClassVar[str] = 'SelfSubjectRulesReview'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    status: SubjectRulesReviewStatus | None = None
    api_path_: ClassVar[str] = 'apis/authorization.k8s.io/v1/selfsubjectrulesreviews'
    plural_: ClassVar[str] = 'selfsubjectrulesreviews'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'authorization.k8s.io'


@dataclass(slots=True, kw_only=True, frozen=True)
class SubjectAccessReview(K8sResource):
    spec: SubjectAccessReviewSpec
    apiVersion: ClassVar[str] = 'authorization.k8s.io/v1'
    kind: ClassVar[str] = 'SubjectAccessReview'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    status: SubjectAccessReviewStatus | None = None
    api_path_: ClassVar[str] = 'apis/authorization.k8s.io/v1/subjectaccessreviews'
    plural_: ClassVar[str] = 'subjectaccessreviews'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'authorization.k8s.io'
