# 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 typing import Dict
from . import meta_v1


BasicSchedulingPolicy = Dict


@dataclass
class GangSchedulingPolicy(DictMixin):
    r"""GangSchedulingPolicy defines the parameters for gang scheduling.

      **parameters**

      * **minCount** ``int`` - MinCount is the minimum number of pods that must be schedulable or scheduled
        at the same time for the scheduler to admit the entire group. It must be a
        positive integer.
    """
    minCount: 'int'


@dataclass
class PodGroup(DictMixin):
    r"""PodGroup represents a set of pods with a common scheduling policy.

      **parameters**

      * **name** ``str`` - Name is a unique identifier for the PodGroup within the Workload. It must be a
        DNS label. This field is immutable.
      * **policy** ``PodGroupPolicy`` - Policy defines the scheduling policy for this PodGroup.
    """
    name: 'str'
    policy: 'PodGroupPolicy'


@dataclass
class PodGroupPolicy(DictMixin):
    r"""PodGroupPolicy defines the scheduling configuration for a PodGroup.

      **parameters**

      * **basic** ``Optional[BasicSchedulingPolicy]`` - Basic specifies that the pods in this group should be scheduled using standard
        Kubernetes scheduling behavior.
      * **gang** ``Optional[GangSchedulingPolicy]`` - Gang specifies that the pods in this group should be scheduled using
        all-or-nothing semantics.
    """
    basic: 'Optional[BasicSchedulingPolicy]' = None
    gang: 'Optional[GangSchedulingPolicy]' = None


@dataclass
class TypedLocalObjectReference(DictMixin):
    r"""TypedLocalObjectReference allows to reference typed object inside the same
      namespace.

      **parameters**

      * **kind** ``str`` - Kind is the type of resource being referenced. It must be a path segment name.
      * **name** ``str`` - Name is the name of resource being referenced. It must be a path segment name.
      * **apiGroup** ``Optional[str]`` - APIGroup is the group for the resource being referenced. If APIGroup is empty,
        the specified Kind must be in the core API group. For any other third-party
        types, setting APIGroup is required. It must be a DNS subdomain.
    """
    kind: 'str'
    name: 'str'
    apiGroup: 'Optional[str]' = None


@dataclass
class Workload(DictMixin):
    r"""Workload allows for expressing scheduling constraints that should be used when
      managing lifecycle of workloads from scheduling perspective, including
      scheduling, preemption, eviction and other phases.

      **parameters**

      * **spec** ``WorkloadSpec`` - Spec defines the desired behavior of a Workload.
      * **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's metadata. Name must be a DNS subdomain.
    """
    spec: 'WorkloadSpec'
    apiVersion: 'Optional[str]' = None
    kind: 'Optional[str]' = None
    metadata: 'Optional[meta_v1.ObjectMeta]' = None

    def __post_init__(self):
        self.apiVersion = 'scheduling.k8s.io/v1alpha1'
        self.kind = 'Workload'


@dataclass
class WorkloadList(DictMixin):
    r"""WorkloadList contains a list of Workload resources.

      **parameters**

      * **items** ``List[Workload]`` - Items is the list of Workloads.
      * **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[Workload]'
    apiVersion: 'Optional[str]' = None
    kind: 'Optional[str]' = None
    metadata: 'Optional[meta_v1.ListMeta]' = None

    def __post_init__(self):
        self.apiVersion = 'scheduling.k8s.io/v1alpha1'
        self.kind = 'WorkloadList'


@dataclass
class WorkloadSpec(DictMixin):
    r"""WorkloadSpec defines the desired state of a Workload.

      **parameters**

      * **podGroups** ``List[PodGroup]`` - PodGroups is the list of pod groups that make up the Workload. The maximum
        number of pod groups is 8. This field is immutable.
      * **controllerRef** ``Optional[TypedLocalObjectReference]`` - ControllerRef is an optional reference to the controlling object, such as a
        Deployment or Job. This field is intended for use by tools like CLIs to
        provide a link back to the original workload definition. When set, it cannot
        be changed.
    """
    podGroups: 'List[PodGroup]'
    controllerRef: 'Optional[TypedLocalObjectReference]' = None


