# autogenerated module
from typing import List, Optional, TYPE_CHECKING

from ._schema import dataclass, field, DictMixin

if TYPE_CHECKING:   # Fix for pycharm autocompletion https://youtrack.jetbrains.com/issue/PY-54560
    from dataclasses import dataclass, field

from . import meta_v1


@dataclass
class DeviceTaint(DictMixin):
    r"""The device this taint is attached to has the "effect" on any claim which does
      not tolerate the taint and, through the claim, to pods using the claim.

      **parameters**

      * **effect** ``str`` - The effect of the taint on claims that do not tolerate the taint and through
        such claims on the pods using them.
        Valid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used for
        nodes is not valid here. More effects may get added in the future. Consumers
        must treat unknown effects like None.
      * **key** ``str`` - The taint key to be applied to a device. Must be a label name.
      * **timeAdded** ``Optional[meta_v1.Time]`` - TimeAdded represents the time at which the taint was added. Added
        automatically during create or update if not set.
      * **value** ``Optional[str]`` - The taint value corresponding to the taint key. Must be a label value.
    """
    effect: 'str'
    key: 'str'
    timeAdded: 'Optional[meta_v1.Time]' = None
    value: 'Optional[str]' = None


@dataclass
class DeviceTaintRule(DictMixin):
    r"""DeviceTaintRule adds one taint to all devices which match the selector. This
      has the same effect as if the taint was specified directly in the
      ResourceSlice by the DRA driver.

      **parameters**

      * **spec** ``DeviceTaintRuleSpec`` - Spec specifies the selector and one taint.
        Changing the spec automatically increments the metadata.generation number.
      * **apiVersion** ``Optional[str]`` - APIVersion defines the versioned schema of this representation of an object.
        Servers should convert recognized schemas to the latest internal value, and
        may reject unrecognized values. More info:
        https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
      * **kind** ``Optional[str]`` - Kind is a string value representing the REST resource this object represents.
        Servers may infer this from the endpoint the client submits requests to.
        Cannot be updated. In CamelCase. More info:
        https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
      * **metadata** ``Optional[meta_v1.ObjectMeta]`` - Standard object metadata
      * **status** ``Optional[DeviceTaintRuleStatus]`` - Status provides information about what was requested in the spec.
    """
    spec: 'DeviceTaintRuleSpec'
    apiVersion: 'Optional[str]' = None
    kind: 'Optional[str]' = None
    metadata: 'Optional[meta_v1.ObjectMeta]' = None
    status: 'Optional[DeviceTaintRuleStatus]' = None

    def __post_init__(self):
        self.apiVersion = 'resource.k8s.io/v1alpha3'
        self.kind = 'DeviceTaintRule'


@dataclass
class DeviceTaintRuleList(DictMixin):
    r"""DeviceTaintRuleList is a collection of DeviceTaintRules.

      **parameters**

      * **items** ``List[DeviceTaintRule]`` - Items is the list of DeviceTaintRules.
      * **apiVersion** ``Optional[str]`` - APIVersion defines the versioned schema of this representation of an object.
        Servers should convert recognized schemas to the latest internal value, and
        may reject unrecognized values. More info:
        https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
      * **kind** ``Optional[str]`` - Kind is a string value representing the REST resource this object represents.
        Servers may infer this from the endpoint the client submits requests to.
        Cannot be updated. In CamelCase. More info:
        https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
      * **metadata** ``Optional[meta_v1.ListMeta]`` - Standard list metadata
    """
    items: 'List[DeviceTaintRule]'
    apiVersion: 'Optional[str]' = None
    kind: 'Optional[str]' = None
    metadata: 'Optional[meta_v1.ListMeta]' = None

    def __post_init__(self):
        self.apiVersion = 'resource.k8s.io/v1alpha3'
        self.kind = 'DeviceTaintRuleList'


@dataclass
class DeviceTaintRuleSpec(DictMixin):
    r"""DeviceTaintRuleSpec specifies the selector and one taint.

      **parameters**

      * **taint** ``DeviceTaint`` - The taint that gets applied to matching devices.
      * **deviceSelector** ``Optional[DeviceTaintSelector]`` - DeviceSelector defines which device(s) the taint is applied to. All selector
        criteria must be satisfied for a device to match. The empty selector matches
        all devices. Without a selector, no devices are matches.
    """
    taint: 'DeviceTaint'
    deviceSelector: 'Optional[DeviceTaintSelector]' = None


@dataclass
class DeviceTaintRuleStatus(DictMixin):
    r"""DeviceTaintRuleStatus provides information about an on-going pod eviction.

      **parameters**

      * **conditions** ``Optional[List[meta_v1.Condition]]`` - Conditions provide information about the state of the DeviceTaintRule and the
        cluster at some point in time, in a machine-readable and human-readable
        format.
        The following condition is currently defined as part of this API, more may get
        added: - Type: EvictionInProgress - Status: True if there are currently pods
        which need to be evicted, False otherwise
          (includes the effects which don't cause eviction).
        - Reason: not specified, may change - Message: includes information about
        number of pending pods and already evicted pods
          in a human-readable format, updated periodically, may change
        For `effect: None`, the condition above gets set once for each change to the
        spec, with the message containing information about what would happen if the
        effect was `NoExecute`. This feedback can be used to decide whether changing
        the effect to `NoExecute` will work as intended. It only gets set once to
        avoid having to constantly update the status.
        Must have 8 or fewer entries.
    """
    conditions: 'Optional[List[meta_v1.Condition]]' = None


@dataclass
class DeviceTaintSelector(DictMixin):
    r"""DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The
      empty selector matches all devices. Without a selector, no devices are
      matched.

      **parameters**

      * **device** ``Optional[str]`` - If device is set, only devices with that name are selected. This field
        corresponds to slice.spec.devices[].name.
        Setting also driver and pool may be required to avoid ambiguity, but is not
        required.
      * **driver** ``Optional[str]`` - If driver is set, only devices from that driver are selected. This fields
        corresponds to slice.spec.driver.
      * **pool** ``Optional[str]`` - If pool is set, only devices in that pool are selected.
        Also setting the driver name may be useful to avoid ambiguity when different
        drivers use the same pool name, but this is not required because selecting
        pools from different drivers may also be useful, for example when drivers with
        node-local devices use the node name as their pool name.
    """
    device: 'Optional[str]' = None
    driver: 'Optional[str]' = None
    pool: 'Optional[str]' = None


