# generated by https://github.com/puzl-cloud/kubesdk
#   filename:  apis__resource.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 Loadable
from kube_models.resource import *

from ...apimachinery.pkg.api.resource import Quantity
from ...apimachinery.pkg.apis.meta.v1 import Condition, ListMeta, ObjectMeta, Time
from ...apimachinery.pkg.runtime import RawExtension
from ..core.v1 import NodeSelector


@dataclass(slots=True, kw_only=True, frozen=True)
class CELDeviceSelector(Loadable):
    expression: str


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceAttribute(Loadable):
    bool: bool | None = None
    int: int | None = None
    string: str | None = None
    version: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceConstraint(Loadable):
    distinctAttribute: str | None = None
    matchAttribute: str | None = None
    requests: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceSelector(Loadable):
    cel: CELDeviceSelector | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceToleration(Loadable):
    effect: str | None = None
    key: str | None = None
    operator: str | None = 'Equal'
    tolerationSeconds: int | None = None
    value: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class NetworkDeviceData(Loadable):
    hardwareAddress: str | None = None
    interfaceName: str | None = None
    ips: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceClaimConsumerReference(Loadable):
    name: str
    resource: str
    uid: str
    apiGroup: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourcePool(Loadable):
    generation: int
    name: str
    resourceSliceCount: int


@dataclass(slots=True, kw_only=True, frozen=True)
class CapacityRequestPolicyRange(Loadable):
    min: Quantity
    max: Quantity | None = None
    step: Quantity | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CapacityRequirements(Loadable):
    requests: Dict[str, Quantity] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class Counter(Loadable):
    value: Quantity


@dataclass(slots=True, kw_only=True, frozen=True)
class CounterSet(Loadable):
    counters: Dict[str, Counter]
    name: str


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceCounterConsumption(Loadable):
    counterSet: str
    counters: Dict[str, Counter]


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceRequestAllocationResult(Loadable):
    device: str
    driver: str
    pool: str
    request: str
    adminAccess: bool | None = None
    bindingConditions: List[str] | None = None
    bindingFailureConditions: List[str] | None = None
    consumedCapacity: Dict[str, Quantity] | None = None
    shareID: str | None = None
    tolerations: List[DeviceToleration] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceSubRequest(Loadable):
    deviceClassName: str
    name: str
    allocationMode: str | None = None
    capacity: CapacityRequirements | None = None
    count: int | None = None
    selectors: List[DeviceSelector] | None = None
    tolerations: List[DeviceToleration] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceTaint(Loadable):
    effect: str
    key: str
    timeAdded: Time | None = None
    value: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ExactDeviceRequest(Loadable):
    deviceClassName: str
    adminAccess: bool | None = None
    allocationMode: str | None = None
    capacity: CapacityRequirements | None = None
    count: int | None = None
    selectors: List[DeviceSelector] | None = None
    tolerations: List[DeviceToleration] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class OpaqueDeviceConfiguration(Loadable):
    driver: str
    parameters: RawExtension


@dataclass(slots=True, kw_only=True, frozen=True)
class AllocatedDeviceStatus(Loadable):
    device: str
    driver: str
    pool: str
    conditions: List[Condition] | None = None
    data: RawExtension | None = None
    networkData: NetworkDeviceData | None = None
    shareID: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CapacityRequestPolicy(Loadable):
    default: Quantity | None = None
    validRange: CapacityRequestPolicyRange | None = None
    validValues: List[Quantity] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceAllocationConfiguration(Loadable):
    source: str
    opaque: OpaqueDeviceConfiguration | None = None
    requests: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceAllocationResult(Loadable):
    config: List[DeviceAllocationConfiguration] | None = None
    results: List[DeviceRequestAllocationResult] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceCapacity(Loadable):
    value: Quantity
    requestPolicy: CapacityRequestPolicy | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceClaimConfiguration(Loadable):
    opaque: OpaqueDeviceConfiguration | None = None
    requests: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceClassConfiguration(Loadable):
    opaque: OpaqueDeviceConfiguration | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceClassSpec(Loadable):
    config: List[DeviceClassConfiguration] | None = None
    extendedResourceName: str | None = None
    selectors: List[DeviceSelector] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceRequest(Loadable):
    name: str
    exactly: ExactDeviceRequest | None = None
    firstAvailable: List[DeviceSubRequest] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class AllocationResult(Loadable):
    allocationTimestamp: Time | None = None
    devices: DeviceAllocationResult | None = None
    nodeSelector: NodeSelector | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class Device(Loadable):
    name: str
    allNodes: bool | None = None
    allowMultipleAllocations: bool | None = None
    attributes: Dict[str, DeviceAttribute] | None = None
    bindingConditions: List[str] | None = None
    bindingFailureConditions: List[str] | None = None
    bindsToNode: bool | None = None
    capacity: Dict[str, DeviceCapacity] | None = None
    consumesCounters: List[DeviceCounterConsumption] | None = None
    nodeName: str | None = None
    nodeSelector: NodeSelector | None = None
    taints: List[DeviceTaint] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceClaim(Loadable):
    config: List[DeviceClaimConfiguration] | None = None
    constraints: List[DeviceConstraint] | None = None
    requests: List[DeviceRequest] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class DeviceClass(K8sResource):
    spec: DeviceClassSpec
    apiVersion: ClassVar[str] = 'resource.k8s.io/v1'
    kind: ClassVar[str] = 'DeviceClass'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    plural_: ClassVar[str] = 'deviceclasses'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'resource.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 DeviceClassList(Loadable):
    items: List[DeviceClass]
    apiVersion: str = 'resource.k8s.io/v1'
    kind: str = 'DeviceClassList'
    metadata: ListMeta = field(default_factory=ObjectMeta)


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceClaimSpec(Loadable):
    devices: DeviceClaim | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceClaimStatus(Loadable):
    allocation: AllocationResult | None = None
    devices: List[AllocatedDeviceStatus] | None = None
    reservedFor: List[ResourceClaimConsumerReference] = field(
        default_factory=list,
        metadata={
            'x-kubernetes-patch-strategy': 'merge',
            'x-kubernetes-patch-merge-key': 'uid',
        },
    )


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceClaimTemplateSpec(Loadable):
    spec: ResourceClaimSpec
    metadata: ObjectMeta | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceSliceSpec(Loadable):
    driver: str
    pool: ResourcePool
    allNodes: bool | None = None
    devices: List[Device] | None = None
    nodeName: str | None = None
    nodeSelector: NodeSelector | None = None
    perDeviceNodeSelection: bool | None = None
    sharedCounters: List[CounterSet] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceClaim(K8sResource):
    spec: ResourceClaimSpec
    apiVersion: ClassVar[str] = 'resource.k8s.io/v1'
    kind: ClassVar[str] = 'ResourceClaim'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    status: ResourceClaimStatus | None = None
    plural_: ClassVar[str] = 'resourceclaims'
    is_namespaced_: ClassVar[bool] = True
    group_: ClassVar[Optional[str]] = 'resource.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 ResourceClaimList(Loadable):
    items: List[ResourceClaim]
    apiVersion: str = 'resource.k8s.io/v1'
    kind: str = 'ResourceClaimList'
    metadata: ListMeta = field(default_factory=ObjectMeta)


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceClaimTemplate(K8sResource):
    spec: ResourceClaimTemplateSpec
    apiVersion: ClassVar[str] = 'resource.k8s.io/v1'
    kind: ClassVar[str] = 'ResourceClaimTemplate'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    plural_: ClassVar[str] = 'resourceclaimtemplates'
    is_namespaced_: ClassVar[bool] = True
    group_: ClassVar[Optional[str]] = 'resource.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 ResourceClaimTemplateList(Loadable):
    items: List[ResourceClaimTemplate]
    apiVersion: str = 'resource.k8s.io/v1'
    kind: str = 'ResourceClaimTemplateList'
    metadata: ListMeta = field(default_factory=ObjectMeta)


@dataclass(slots=True, kw_only=True, frozen=True)
class ResourceSlice(K8sResource):
    spec: ResourceSliceSpec
    apiVersion: ClassVar[str] = 'resource.k8s.io/v1'
    kind: ClassVar[str] = 'ResourceSlice'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    plural_: ClassVar[str] = 'resourceslices'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'resource.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 ResourceSliceList(Loadable):
    items: List[ResourceSlice]
    apiVersion: str = 'resource.k8s.io/v1'
    kind: str = 'ResourceSliceList'
    metadata: ListMeta = field(default_factory=ObjectMeta)
