# generated by https://github.com/puzl-cloud/kubesdk
#   filename:  apis__flowcontrol.apiserver.k8s.io__v1beta1_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 LazyLoadModel
from kube_models.resource import *

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


@dataclass(slots=True, kw_only=True, frozen=True)
class FlowDistinguisherMethod(LazyLoadModel):
    type: str


@dataclass(slots=True, kw_only=True, frozen=True)
class GroupSubject(LazyLoadModel):
    name: str


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


@dataclass(slots=True, kw_only=True, frozen=True)
class PriorityLevelConfigurationReference(LazyLoadModel):
    name: str


@dataclass(slots=True, kw_only=True, frozen=True)
class QueuingConfiguration(LazyLoadModel):
    handSize: int | None = None
    queueLengthLimit: int | None = None
    queues: int | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourcePolicyRule(LazyLoadModel):
    apiGroups: List[str]
    resources: List[str]
    verbs: List[str]
    clusterScope: bool | None = None
    namespaces: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ServiceAccountSubject(LazyLoadModel):
    name: str
    namespace: str


@dataclass(slots=True, kw_only=True, frozen=True)
class UserSubject(LazyLoadModel):
    name: str


@dataclass(slots=True, kw_only=True, frozen=True)
class FlowSchemaCondition(LazyLoadModel):
    lastTransitionTime: Time | None = None
    message: str | None = None
    reason: str | None = None
    status: str | None = None
    type: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class FlowSchemaStatus(LazyLoadModel):
    conditions: List[FlowSchemaCondition] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class LimitResponse(LazyLoadModel):
    type: str
    queuing: QueuingConfiguration | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class LimitedPriorityLevelConfiguration(LazyLoadModel):
    assuredConcurrencyShares: int | None = None
    limitResponse: LimitResponse | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class PriorityLevelConfigurationCondition(LazyLoadModel):
    lastTransitionTime: Time | None = None
    message: str | None = None
    reason: str | None = None
    status: str | None = None
    type: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class PriorityLevelConfigurationSpec(LazyLoadModel):
    type: str
    limited: LimitedPriorityLevelConfiguration | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class PriorityLevelConfigurationStatus(LazyLoadModel):
    conditions: List[PriorityLevelConfigurationCondition] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class Subject(LazyLoadModel):
    kind: str
    group: GroupSubject | None = None
    serviceAccount: ServiceAccountSubject | None = None
    user: UserSubject | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class PolicyRulesWithSubjects(LazyLoadModel):
    subjects: List[Subject]
    nonResourceRules: List[NonResourcePolicyRule] | None = None
    resourceRules: List[ResourcePolicyRule] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class PriorityLevelConfiguration(K8sResource):
    apiVersion: ClassVar[str] = 'flowcontrol.apiserver.k8s.io/v1beta1'
    kind: ClassVar[str] = 'PriorityLevelConfiguration'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    spec: PriorityLevelConfigurationSpec | None = None
    status: PriorityLevelConfigurationStatus | None = None
    api_path_: ClassVar[str] = (
        'apis/flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations'
    )
    plural_: ClassVar[str] = 'prioritylevelconfigurations'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'flowcontrol.apiserver.k8s.io'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        '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 PriorityLevelConfigurationList(LazyLoadModel):
    items: List[PriorityLevelConfiguration]
    apiVersion: str = 'flowcontrol.apiserver.k8s.io/v1beta1'
    kind: str = 'PriorityLevelConfigurationList'
    metadata: ListMeta = field(default_factory=ObjectMeta)


@dataclass(slots=True, kw_only=True, frozen=True)
class FlowSchemaSpec(LazyLoadModel):
    priorityLevelConfiguration: PriorityLevelConfigurationReference
    distinguisherMethod: FlowDistinguisherMethod | None = None
    matchingPrecedence: int | None = None
    rules: List[PolicyRulesWithSubjects] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class FlowSchema(K8sResource):
    apiVersion: ClassVar[str] = 'flowcontrol.apiserver.k8s.io/v1beta1'
    kind: ClassVar[str] = 'FlowSchema'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    spec: FlowSchemaSpec | None = None
    status: FlowSchemaStatus | None = None
    api_path_: ClassVar[str] = 'apis/flowcontrol.apiserver.k8s.io/v1beta1/flowschemas'
    plural_: ClassVar[str] = 'flowschemas'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'flowcontrol.apiserver.k8s.io'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        '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 FlowSchemaList(LazyLoadModel):
    items: List[FlowSchema]
    apiVersion: str = 'flowcontrol.apiserver.k8s.io/v1beta1'
    kind: str = 'FlowSchemaList'
    metadata: ListMeta = field(default_factory=ObjectMeta)
