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

from __future__ import annotations

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

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

from ...apimachinery.pkg.apis.meta.v1 import LabelSelector, ListMeta, ObjectMeta


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


@dataclass(slots=True, kw_only=True, frozen=True)
class RoleRef(Loadable):
    apiGroup: str
    kind: str
    name: str


@dataclass(slots=True, kw_only=True, frozen=True)
class Subject(Loadable):
    kind: str
    name: str
    apiGroup: str | None = None
    namespace: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class AggregationRule(Loadable):
    clusterRoleSelectors: List[LabelSelector] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ClusterRole(K8sResource):
    aggregationRule: AggregationRule | None = None
    apiVersion: ClassVar[str] = 'rbac.authorization.k8s.io/v1'
    kind: ClassVar[str] = 'ClusterRole'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    rules: List[PolicyRule] | None = None
    plural_: ClassVar[str] = 'clusterroles'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'rbac.authorization.k8s.io'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        'application/apply-patch+cbor',
        'application/apply-patch+yaml',
        'application/json-patch+json',
        'application/merge-patch+json',
        'application/strategic-merge-patch+json',
    }


@dataclass(slots=True, kw_only=True, frozen=True)
class ClusterRoleBinding(K8sResource):
    roleRef: RoleRef
    apiVersion: ClassVar[str] = 'rbac.authorization.k8s.io/v1'
    kind: ClassVar[str] = 'ClusterRoleBinding'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    subjects: List[Subject] | None = None
    plural_: ClassVar[str] = 'clusterrolebindings'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'rbac.authorization.k8s.io'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        'application/apply-patch+cbor',
        'application/apply-patch+yaml',
        'application/json-patch+json',
        'application/merge-patch+json',
        'application/strategic-merge-patch+json',
    }


@dataclass(slots=True, kw_only=True, frozen=True)
class ClusterRoleBindingList(Loadable):
    items: List[ClusterRoleBinding]
    apiVersion: str = 'rbac.authorization.k8s.io/v1'
    kind: str = 'ClusterRoleBindingList'
    metadata: ListMeta = field(default_factory=ObjectMeta)


@dataclass(slots=True, kw_only=True, frozen=True)
class ClusterRoleList(Loadable):
    items: List[ClusterRole]
    apiVersion: str = 'rbac.authorization.k8s.io/v1'
    kind: str = 'ClusterRoleList'
    metadata: ListMeta = field(default_factory=ObjectMeta)


@dataclass(slots=True, kw_only=True, frozen=True)
class Role(K8sResource):
    apiVersion: ClassVar[str] = 'rbac.authorization.k8s.io/v1'
    kind: ClassVar[str] = 'Role'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    rules: List[PolicyRule] | None = None
    plural_: ClassVar[str] = 'roles'
    is_namespaced_: ClassVar[bool] = True
    group_: ClassVar[Optional[str]] = 'rbac.authorization.k8s.io'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        'application/apply-patch+cbor',
        'application/apply-patch+yaml',
        'application/json-patch+json',
        'application/merge-patch+json',
        'application/strategic-merge-patch+json',
    }


@dataclass(slots=True, kw_only=True, frozen=True)
class RoleBinding(K8sResource):
    roleRef: RoleRef
    apiVersion: ClassVar[str] = 'rbac.authorization.k8s.io/v1'
    kind: ClassVar[str] = 'RoleBinding'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    subjects: List[Subject] | None = None
    plural_: ClassVar[str] = 'rolebindings'
    is_namespaced_: ClassVar[bool] = True
    group_: ClassVar[Optional[str]] = 'rbac.authorization.k8s.io'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        'application/apply-patch+cbor',
        'application/apply-patch+yaml',
        'application/json-patch+json',
        'application/merge-patch+json',
        'application/strategic-merge-patch+json',
    }


@dataclass(slots=True, kw_only=True, frozen=True)
class RoleBindingList(Loadable):
    items: List[RoleBinding]
    apiVersion: str = 'rbac.authorization.k8s.io/v1'
    kind: str = 'RoleBindingList'
    metadata: ListMeta = field(default_factory=ObjectMeta)


@dataclass(slots=True, kw_only=True, frozen=True)
class RoleList(Loadable):
    items: List[Role]
    apiVersion: str = 'rbac.authorization.k8s.io/v1'
    kind: str = 'RoleList'
    metadata: ListMeta = field(default_factory=ObjectMeta)
