# Generated by cloudcoil-model-codegen v0.3.0
# DO NOT EDIT

from __future__ import annotations

from datetime import datetime
from typing import (
    Annotated,
    Any,
    Callable,
    Dict,
    List,
    Literal,
    Optional,
    Type,
    overload,
)

from pydantic import Field

from cloudcoil import apimachinery
from cloudcoil.pydantic import (
    BaseModel,
    BaseModelBuilder,
    BuilderContextBase,
    GenericListBuilder,
    ListBuilderContext,
    Never,
    Self,
)
from cloudcoil.resources import Resource


class IssuerRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["IssuerRef"]:
            return IssuerRef

        def build(self) -> "IssuerRef":
            return IssuerRef(**self._attrs)

        def group(self, value: Optional[str], /) -> Self:
            """
            Group of the resource being referred to.
            """
            return self._set("group", value)

        def kind(self, value: Optional[str], /) -> Self:
            """
            Kind of the resource being referred to.
            """
            return self._set("kind", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["IssuerRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = IssuerRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for IssuerRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["IssuerRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use IssuerRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    group: Optional[str] = None
    """
    Group of the resource being referred to.
    """
    kind: Optional[str] = None
    """
    Kind of the resource being referred to.
    """
    name: str
    """
    Name of the resource being referred to.
    """


class AccountSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["AccountSecretRef"]:
            return AccountSecretRef

        def build(self) -> "AccountSecretRef":
            return AccountSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["AccountSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = AccountSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for AccountSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["AccountSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use AccountSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class AcmeDns(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["AcmeDns"]:
            return AcmeDns

        def build(self) -> "AcmeDns":
            return AcmeDns(**self._attrs)

        @overload
        def account_secret_ref(
            self, value_or_callback: AccountSecretRef, /
        ) -> "AcmeDns.Builder": ...

        @overload
        def account_secret_ref(
            self,
            value_or_callback: Callable[
                [AccountSecretRef.Builder], AccountSecretRef.Builder | AccountSecretRef
            ],
            /,
        ) -> "AcmeDns.Builder": ...

        @overload
        def account_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "AccountSecretRef.BuilderContext": ...

        def account_secret_ref(self, value_or_callback=None, /):
            """
            A reference to a specific 'key' within a Secret resource.
            In some instances, `key` is a required field.
            """
            if self._in_context and value_or_callback is None:
                context = AccountSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "account_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(AccountSecretRef.builder())
                if isinstance(output, AccountSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("account_secret_ref", value)

        def host(self, value: str, /) -> Self:
            return self._set("host", value)

    class BuilderContext(BuilderContextBase["AcmeDns.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = AcmeDns.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for AcmeDns."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["AcmeDns", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use AcmeDns.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    account_secret_ref: Annotated[AccountSecretRef, Field(alias="accountSecretRef")]
    """
    A reference to a specific 'key' within a Secret resource.
    In some instances, `key` is a required field.
    """
    host: str


class AccessTokenSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["AccessTokenSecretRef"]:
            return AccessTokenSecretRef

        def build(self) -> "AccessTokenSecretRef":
            return AccessTokenSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["AccessTokenSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = AccessTokenSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for AccessTokenSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["AccessTokenSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use AccessTokenSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class ClientSecretSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ClientSecretSecretRef"]:
            return ClientSecretSecretRef

        def build(self) -> "ClientSecretSecretRef":
            return ClientSecretSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ClientSecretSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ClientSecretSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ClientSecretSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ClientSecretSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ClientSecretSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class ClientTokenSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ClientTokenSecretRef"]:
            return ClientTokenSecretRef

        def build(self) -> "ClientTokenSecretRef":
            return ClientTokenSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ClientTokenSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ClientTokenSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ClientTokenSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ClientTokenSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ClientTokenSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class Akamai(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Akamai"]:
            return Akamai

        def build(self) -> "Akamai":
            return Akamai(**self._attrs)

        @overload
        def access_token_secret_ref(
            self, value_or_callback: AccessTokenSecretRef, /
        ) -> "Akamai.Builder": ...

        @overload
        def access_token_secret_ref(
            self,
            value_or_callback: Callable[
                [AccessTokenSecretRef.Builder],
                AccessTokenSecretRef.Builder | AccessTokenSecretRef,
            ],
            /,
        ) -> "Akamai.Builder": ...

        @overload
        def access_token_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "AccessTokenSecretRef.BuilderContext": ...

        def access_token_secret_ref(self, value_or_callback=None, /):
            """
            A reference to a specific 'key' within a Secret resource.
            In some instances, `key` is a required field.
            """
            if self._in_context and value_or_callback is None:
                context = AccessTokenSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "access_token_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(AccessTokenSecretRef.builder())
                if isinstance(output, AccessTokenSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("access_token_secret_ref", value)

        @overload
        def client_secret_secret_ref(
            self, value_or_callback: ClientSecretSecretRef, /
        ) -> "Akamai.Builder": ...

        @overload
        def client_secret_secret_ref(
            self,
            value_or_callback: Callable[
                [ClientSecretSecretRef.Builder],
                ClientSecretSecretRef.Builder | ClientSecretSecretRef,
            ],
            /,
        ) -> "Akamai.Builder": ...

        @overload
        def client_secret_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "ClientSecretSecretRef.BuilderContext": ...

        def client_secret_secret_ref(self, value_or_callback=None, /):
            """
            A reference to a specific 'key' within a Secret resource.
            In some instances, `key` is a required field.
            """
            if self._in_context and value_or_callback is None:
                context = ClientSecretSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "client_secret_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ClientSecretSecretRef.builder())
                if isinstance(output, ClientSecretSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("client_secret_secret_ref", value)

        @overload
        def client_token_secret_ref(
            self, value_or_callback: ClientTokenSecretRef, /
        ) -> "Akamai.Builder": ...

        @overload
        def client_token_secret_ref(
            self,
            value_or_callback: Callable[
                [ClientTokenSecretRef.Builder],
                ClientTokenSecretRef.Builder | ClientTokenSecretRef,
            ],
            /,
        ) -> "Akamai.Builder": ...

        @overload
        def client_token_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "ClientTokenSecretRef.BuilderContext": ...

        def client_token_secret_ref(self, value_or_callback=None, /):
            """
            A reference to a specific 'key' within a Secret resource.
            In some instances, `key` is a required field.
            """
            if self._in_context and value_or_callback is None:
                context = ClientTokenSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "client_token_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ClientTokenSecretRef.builder())
                if isinstance(output, ClientTokenSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("client_token_secret_ref", value)

        def service_consumer_domain(self, value: str, /) -> Self:
            return self._set("service_consumer_domain", value)

    class BuilderContext(BuilderContextBase["Akamai.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Akamai.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Akamai."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Akamai", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Akamai.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    access_token_secret_ref: Annotated[AccessTokenSecretRef, Field(alias="accessTokenSecretRef")]
    """
    A reference to a specific 'key' within a Secret resource.
    In some instances, `key` is a required field.
    """
    client_secret_secret_ref: Annotated[ClientSecretSecretRef, Field(alias="clientSecretSecretRef")]
    """
    A reference to a specific 'key' within a Secret resource.
    In some instances, `key` is a required field.
    """
    client_token_secret_ref: Annotated[ClientTokenSecretRef, Field(alias="clientTokenSecretRef")]
    """
    A reference to a specific 'key' within a Secret resource.
    In some instances, `key` is a required field.
    """
    service_consumer_domain: Annotated[str, Field(alias="serviceConsumerDomain")]


class ManagedIdentity(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ManagedIdentity"]:
            return ManagedIdentity

        def build(self) -> "ManagedIdentity":
            return ManagedIdentity(**self._attrs)

        def client_id(self, value: Optional[str], /) -> Self:
            """
            client ID of the managed identity, can not be used at the same time as resourceID
            """
            return self._set("client_id", value)

        def resource_id(self, value: Optional[str], /) -> Self:
            """
            resource ID of the managed identity, can not be used at the same time as clientID
            Cannot be used for Azure Managed Service Identity
            """
            return self._set("resource_id", value)

    class BuilderContext(BuilderContextBase["ManagedIdentity.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ManagedIdentity.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ManagedIdentity."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ManagedIdentity", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ManagedIdentity.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    client_id: Annotated[Optional[str], Field(alias="clientID")] = None
    """
    client ID of the managed identity, can not be used at the same time as resourceID
    """
    resource_id: Annotated[Optional[str], Field(alias="resourceID")] = None
    """
    resource ID of the managed identity, can not be used at the same time as clientID
    Cannot be used for Azure Managed Service Identity
    """


class AzureDns(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["AzureDns"]:
            return AzureDns

        def build(self) -> "AzureDns":
            return AzureDns(**self._attrs)

        def client_id(self, value: Optional[str], /) -> Self:
            """
            Auth: Azure Service Principal:
            The ClientID of the Azure Service Principal used to authenticate with Azure DNS.
            If set, ClientSecret and TenantID must also be set.
            """
            return self._set("client_id", value)

        @overload
        def client_secret_secret_ref(
            self, value_or_callback: Optional[ClientSecretSecretRef], /
        ) -> "AzureDns.Builder": ...

        @overload
        def client_secret_secret_ref(
            self,
            value_or_callback: Callable[
                [ClientSecretSecretRef.Builder],
                ClientSecretSecretRef.Builder | ClientSecretSecretRef,
            ],
            /,
        ) -> "AzureDns.Builder": ...

        @overload
        def client_secret_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "ClientSecretSecretRef.BuilderContext": ...

        def client_secret_secret_ref(self, value_or_callback=None, /):
            """
            Auth: Azure Service Principal:
            A reference to a Secret containing the password associated with the Service Principal.
            If set, ClientID and TenantID must also be set.
            """
            if self._in_context and value_or_callback is None:
                context = ClientSecretSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "client_secret_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ClientSecretSecretRef.builder())
                if isinstance(output, ClientSecretSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("client_secret_secret_ref", value)

        def environment(
            self,
            value: Optional[
                Literal[
                    "AzurePublicCloud",
                    "AzureChinaCloud",
                    "AzureGermanCloud",
                    "AzureUSGovernmentCloud",
                ]
            ],
            /,
        ) -> Self:
            """
            name of the Azure environment (default AzurePublicCloud)
            """
            return self._set("environment", value)

        def hosted_zone_name(self, value: Optional[str], /) -> Self:
            """
            name of the DNS zone that should be used
            """
            return self._set("hosted_zone_name", value)

        @overload
        def managed_identity(
            self, value_or_callback: Optional[ManagedIdentity], /
        ) -> "AzureDns.Builder": ...

        @overload
        def managed_identity(
            self,
            value_or_callback: Callable[
                [ManagedIdentity.Builder], ManagedIdentity.Builder | ManagedIdentity
            ],
            /,
        ) -> "AzureDns.Builder": ...

        @overload
        def managed_identity(
            self, value_or_callback: Never = ...
        ) -> "ManagedIdentity.BuilderContext": ...

        def managed_identity(self, value_or_callback=None, /):
            """
            Auth: Azure Workload Identity or Azure Managed Service Identity:
            Settings to enable Azure Workload Identity or Azure Managed Service Identity
            If set, ClientID, ClientSecret and TenantID must not be set.
            """
            if self._in_context and value_or_callback is None:
                context = ManagedIdentity.BuilderContext()
                context._parent_builder = self
                context._field_name = "managed_identity"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ManagedIdentity.builder())
                if isinstance(output, ManagedIdentity.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("managed_identity", value)

        def resource_group_name(self, value: str, /) -> Self:
            """
            resource group the DNS zone is located in
            """
            return self._set("resource_group_name", value)

        def subscription_id(self, value: str, /) -> Self:
            """
            ID of the Azure subscription
            """
            return self._set("subscription_id", value)

        def tenant_id(self, value: Optional[str], /) -> Self:
            """
            Auth: Azure Service Principal:
            The TenantID of the Azure Service Principal used to authenticate with Azure DNS.
            If set, ClientID and ClientSecret must also be set.
            """
            return self._set("tenant_id", value)

    class BuilderContext(BuilderContextBase["AzureDns.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = AzureDns.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for AzureDns."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["AzureDns", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use AzureDns.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    client_id: Annotated[Optional[str], Field(alias="clientID")] = None
    """
    Auth: Azure Service Principal:
    The ClientID of the Azure Service Principal used to authenticate with Azure DNS.
    If set, ClientSecret and TenantID must also be set.
    """
    client_secret_secret_ref: Annotated[
        Optional[ClientSecretSecretRef], Field(alias="clientSecretSecretRef")
    ] = None
    """
    Auth: Azure Service Principal:
    A reference to a Secret containing the password associated with the Service Principal.
    If set, ClientID and TenantID must also be set.
    """
    environment: Optional[
        Literal[
            "AzurePublicCloud",
            "AzureChinaCloud",
            "AzureGermanCloud",
            "AzureUSGovernmentCloud",
        ]
    ] = None
    """
    name of the Azure environment (default AzurePublicCloud)
    """
    hosted_zone_name: Annotated[Optional[str], Field(alias="hostedZoneName")] = None
    """
    name of the DNS zone that should be used
    """
    managed_identity: Annotated[Optional[ManagedIdentity], Field(alias="managedIdentity")] = None
    """
    Auth: Azure Workload Identity or Azure Managed Service Identity:
    Settings to enable Azure Workload Identity or Azure Managed Service Identity
    If set, ClientID, ClientSecret and TenantID must not be set.
    """
    resource_group_name: Annotated[str, Field(alias="resourceGroupName")]
    """
    resource group the DNS zone is located in
    """
    subscription_id: Annotated[str, Field(alias="subscriptionID")]
    """
    ID of the Azure subscription
    """
    tenant_id: Annotated[Optional[str], Field(alias="tenantID")] = None
    """
    Auth: Azure Service Principal:
    The TenantID of the Azure Service Principal used to authenticate with Azure DNS.
    If set, ClientID and ClientSecret must also be set.
    """


class ServiceAccountSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ServiceAccountSecretRef"]:
            return ServiceAccountSecretRef

        def build(self) -> "ServiceAccountSecretRef":
            return ServiceAccountSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ServiceAccountSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ServiceAccountSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ServiceAccountSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ServiceAccountSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ServiceAccountSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class CloudDns(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["CloudDns"]:
            return CloudDns

        def build(self) -> "CloudDns":
            return CloudDns(**self._attrs)

        def hosted_zone_name(self, value: Optional[str], /) -> Self:
            """
            HostedZoneName is an optional field that tells cert-manager in which
            Cloud DNS zone the challenge record has to be created.
            If left empty cert-manager will automatically choose a zone.
            """
            return self._set("hosted_zone_name", value)

        def project(self, value: str, /) -> Self:
            return self._set("project", value)

        @overload
        def service_account_secret_ref(
            self, value_or_callback: Optional[ServiceAccountSecretRef], /
        ) -> "CloudDns.Builder": ...

        @overload
        def service_account_secret_ref(
            self,
            value_or_callback: Callable[
                [ServiceAccountSecretRef.Builder],
                ServiceAccountSecretRef.Builder | ServiceAccountSecretRef,
            ],
            /,
        ) -> "CloudDns.Builder": ...

        @overload
        def service_account_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "ServiceAccountSecretRef.BuilderContext": ...

        def service_account_secret_ref(self, value_or_callback=None, /):
            """
            A reference to a specific 'key' within a Secret resource.
            In some instances, `key` is a required field.
            """
            if self._in_context and value_or_callback is None:
                context = ServiceAccountSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "service_account_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ServiceAccountSecretRef.builder())
                if isinstance(output, ServiceAccountSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("service_account_secret_ref", value)

    class BuilderContext(BuilderContextBase["CloudDns.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = CloudDns.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for CloudDns."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["CloudDns", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use CloudDns.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    hosted_zone_name: Annotated[Optional[str], Field(alias="hostedZoneName")] = None
    """
    HostedZoneName is an optional field that tells cert-manager in which
    Cloud DNS zone the challenge record has to be created.
    If left empty cert-manager will automatically choose a zone.
    """
    project: str
    service_account_secret_ref: Annotated[
        Optional[ServiceAccountSecretRef], Field(alias="serviceAccountSecretRef")
    ] = None
    """
    A reference to a specific 'key' within a Secret resource.
    In some instances, `key` is a required field.
    """


class ApiKeySecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ApiKeySecretRef"]:
            return ApiKeySecretRef

        def build(self) -> "ApiKeySecretRef":
            return ApiKeySecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ApiKeySecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ApiKeySecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ApiKeySecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ApiKeySecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ApiKeySecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class ApiTokenSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ApiTokenSecretRef"]:
            return ApiTokenSecretRef

        def build(self) -> "ApiTokenSecretRef":
            return ApiTokenSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ApiTokenSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ApiTokenSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ApiTokenSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ApiTokenSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ApiTokenSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class Cloudflare(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Cloudflare"]:
            return Cloudflare

        def build(self) -> "Cloudflare":
            return Cloudflare(**self._attrs)

        @overload
        def api_key_secret_ref(
            self, value_or_callback: Optional[ApiKeySecretRef], /
        ) -> "Cloudflare.Builder": ...

        @overload
        def api_key_secret_ref(
            self,
            value_or_callback: Callable[
                [ApiKeySecretRef.Builder], ApiKeySecretRef.Builder | ApiKeySecretRef
            ],
            /,
        ) -> "Cloudflare.Builder": ...

        @overload
        def api_key_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "ApiKeySecretRef.BuilderContext": ...

        def api_key_secret_ref(self, value_or_callback=None, /):
            """
            API key to use to authenticate with Cloudflare.
            Note: using an API token to authenticate is now the recommended method
            as it allows greater control of permissions.
            """
            if self._in_context and value_or_callback is None:
                context = ApiKeySecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "api_key_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ApiKeySecretRef.builder())
                if isinstance(output, ApiKeySecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("api_key_secret_ref", value)

        @overload
        def api_token_secret_ref(
            self, value_or_callback: Optional[ApiTokenSecretRef], /
        ) -> "Cloudflare.Builder": ...

        @overload
        def api_token_secret_ref(
            self,
            value_or_callback: Callable[
                [ApiTokenSecretRef.Builder],
                ApiTokenSecretRef.Builder | ApiTokenSecretRef,
            ],
            /,
        ) -> "Cloudflare.Builder": ...

        @overload
        def api_token_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "ApiTokenSecretRef.BuilderContext": ...

        def api_token_secret_ref(self, value_or_callback=None, /):
            """
            API token used to authenticate with Cloudflare.
            """
            if self._in_context and value_or_callback is None:
                context = ApiTokenSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "api_token_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ApiTokenSecretRef.builder())
                if isinstance(output, ApiTokenSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("api_token_secret_ref", value)

        def email(self, value: Optional[str], /) -> Self:
            """
            Email of the account, only required when using API key based authentication.
            """
            return self._set("email", value)

    class BuilderContext(BuilderContextBase["Cloudflare.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Cloudflare.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Cloudflare."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Cloudflare", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Cloudflare.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_key_secret_ref: Annotated[Optional[ApiKeySecretRef], Field(alias="apiKeySecretRef")] = None
    """
    API key to use to authenticate with Cloudflare.
    Note: using an API token to authenticate is now the recommended method
    as it allows greater control of permissions.
    """
    api_token_secret_ref: Annotated[
        Optional[ApiTokenSecretRef], Field(alias="apiTokenSecretRef")
    ] = None
    """
    API token used to authenticate with Cloudflare.
    """
    email: Optional[str] = None
    """
    Email of the account, only required when using API key based authentication.
    """


class TokenSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["TokenSecretRef"]:
            return TokenSecretRef

        def build(self) -> "TokenSecretRef":
            return TokenSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["TokenSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = TokenSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for TokenSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["TokenSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use TokenSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class Digitalocean(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Digitalocean"]:
            return Digitalocean

        def build(self) -> "Digitalocean":
            return Digitalocean(**self._attrs)

        @overload
        def token_secret_ref(
            self, value_or_callback: TokenSecretRef, /
        ) -> "Digitalocean.Builder": ...

        @overload
        def token_secret_ref(
            self,
            value_or_callback: Callable[
                [TokenSecretRef.Builder], TokenSecretRef.Builder | TokenSecretRef
            ],
            /,
        ) -> "Digitalocean.Builder": ...

        @overload
        def token_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "TokenSecretRef.BuilderContext": ...

        def token_secret_ref(self, value_or_callback=None, /):
            """
            A reference to a specific 'key' within a Secret resource.
            In some instances, `key` is a required field.
            """
            if self._in_context and value_or_callback is None:
                context = TokenSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "token_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(TokenSecretRef.builder())
                if isinstance(output, TokenSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("token_secret_ref", value)

    class BuilderContext(BuilderContextBase["Digitalocean.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Digitalocean.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Digitalocean."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Digitalocean", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Digitalocean.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    token_secret_ref: Annotated[TokenSecretRef, Field(alias="tokenSecretRef")]
    """
    A reference to a specific 'key' within a Secret resource.
    In some instances, `key` is a required field.
    """


class TsigSecretSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["TsigSecretSecretRef"]:
            return TsigSecretSecretRef

        def build(self) -> "TsigSecretSecretRef":
            return TsigSecretSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["TsigSecretSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = TsigSecretSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for TsigSecretSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["TsigSecretSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use TsigSecretSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class Rfc2136(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Rfc2136"]:
            return Rfc2136

        def build(self) -> "Rfc2136":
            return Rfc2136(**self._attrs)

        def nameserver(self, value: str, /) -> Self:
            """
            The IP address or hostname of an authoritative DNS server supporting
            RFC2136 in the form host:port. If the host is an IPv6 address it must be
            enclosed in square brackets (e.g [2001:db8::1]) ; port is optional.
            This field is required.
            """
            return self._set("nameserver", value)

        def tsig_algorithm(self, value: Optional[str], /) -> Self:
            """
            The TSIG Algorithm configured in the DNS supporting RFC2136. Used only
            when ``tsigSecretSecretRef`` and ``tsigKeyName`` are defined.
            Supported values are (case-insensitive): ``HMACMD5`` (default),
            ``HMACSHA1``, ``HMACSHA256`` or ``HMACSHA512``.
            """
            return self._set("tsig_algorithm", value)

        def tsig_key_name(self, value: Optional[str], /) -> Self:
            """
            The TSIG Key name configured in the DNS.
            If ``tsigSecretSecretRef`` is defined, this field is required.
            """
            return self._set("tsig_key_name", value)

        @overload
        def tsig_secret_secret_ref(
            self, value_or_callback: Optional[TsigSecretSecretRef], /
        ) -> "Rfc2136.Builder": ...

        @overload
        def tsig_secret_secret_ref(
            self,
            value_or_callback: Callable[
                [TsigSecretSecretRef.Builder],
                TsigSecretSecretRef.Builder | TsigSecretSecretRef,
            ],
            /,
        ) -> "Rfc2136.Builder": ...

        @overload
        def tsig_secret_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "TsigSecretSecretRef.BuilderContext": ...

        def tsig_secret_secret_ref(self, value_or_callback=None, /):
            """
            The name of the secret containing the TSIG value.
            If ``tsigKeyName`` is defined, this field is required.
            """
            if self._in_context and value_or_callback is None:
                context = TsigSecretSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "tsig_secret_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(TsigSecretSecretRef.builder())
                if isinstance(output, TsigSecretSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("tsig_secret_secret_ref", value)

    class BuilderContext(BuilderContextBase["Rfc2136.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Rfc2136.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Rfc2136."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Rfc2136", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Rfc2136.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    nameserver: str
    """
    The IP address or hostname of an authoritative DNS server supporting
    RFC2136 in the form host:port. If the host is an IPv6 address it must be
    enclosed in square brackets (e.g [2001:db8::1]) ; port is optional.
    This field is required.
    """
    tsig_algorithm: Annotated[Optional[str], Field(alias="tsigAlgorithm")] = None
    """
    The TSIG Algorithm configured in the DNS supporting RFC2136. Used only
    when ``tsigSecretSecretRef`` and ``tsigKeyName`` are defined.
    Supported values are (case-insensitive): ``HMACMD5`` (default),
    ``HMACSHA1``, ``HMACSHA256`` or ``HMACSHA512``.
    """
    tsig_key_name: Annotated[Optional[str], Field(alias="tsigKeyName")] = None
    """
    The TSIG Key name configured in the DNS.
    If ``tsigSecretSecretRef`` is defined, this field is required.
    """
    tsig_secret_secret_ref: Annotated[
        Optional[TsigSecretSecretRef], Field(alias="tsigSecretSecretRef")
    ] = None
    """
    The name of the secret containing the TSIG value.
    If ``tsigKeyName`` is defined, this field is required.
    """


class AccessKeyIdSecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["AccessKeyIdSecretRef"]:
            return AccessKeyIdSecretRef

        def build(self) -> "AccessKeyIdSecretRef":
            return AccessKeyIdSecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["AccessKeyIdSecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = AccessKeyIdSecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for AccessKeyIdSecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["AccessKeyIdSecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use AccessKeyIdSecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class ServiceAccountRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ServiceAccountRef"]:
            return ServiceAccountRef

        def build(self) -> "ServiceAccountRef":
            return ServiceAccountRef(**self._attrs)

        def audiences(self, value: Optional[List[str]], /) -> Self:
            """
            TokenAudiences is an optional list of audiences to include in the
            token passed to AWS. The default token consisting of the issuer's namespace
            and name is always included.
            If unset the audience defaults to `sts.amazonaws.com`.
            """
            return self._set("audiences", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the ServiceAccount used to request a token.
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ServiceAccountRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ServiceAccountRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ServiceAccountRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ServiceAccountRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ServiceAccountRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    audiences: Optional[List[str]] = None
    """
    TokenAudiences is an optional list of audiences to include in the
    token passed to AWS. The default token consisting of the issuer's namespace
    and name is always included.
    If unset the audience defaults to `sts.amazonaws.com`.
    """
    name: str
    """
    Name of the ServiceAccount used to request a token.
    """


class Kubernetes(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Kubernetes"]:
            return Kubernetes

        def build(self) -> "Kubernetes":
            return Kubernetes(**self._attrs)

        @overload
        def service_account_ref(
            self, value_or_callback: ServiceAccountRef, /
        ) -> "Kubernetes.Builder": ...

        @overload
        def service_account_ref(
            self,
            value_or_callback: Callable[
                [ServiceAccountRef.Builder],
                ServiceAccountRef.Builder | ServiceAccountRef,
            ],
            /,
        ) -> "Kubernetes.Builder": ...

        @overload
        def service_account_ref(
            self, value_or_callback: Never = ...
        ) -> "ServiceAccountRef.BuilderContext": ...

        def service_account_ref(self, value_or_callback=None, /):
            """
            A reference to a service account that will be used to request a bound
            token (also known as "projected token"). To use this field, you must
            configure an RBAC rule to let cert-manager request a token.
            """
            if self._in_context and value_or_callback is None:
                context = ServiceAccountRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "service_account_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ServiceAccountRef.builder())
                if isinstance(output, ServiceAccountRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("service_account_ref", value)

    class BuilderContext(BuilderContextBase["Kubernetes.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Kubernetes.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Kubernetes."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Kubernetes", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Kubernetes.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    service_account_ref: Annotated[ServiceAccountRef, Field(alias="serviceAccountRef")]
    """
    A reference to a service account that will be used to request a bound
    token (also known as "projected token"). To use this field, you must
    configure an RBAC rule to let cert-manager request a token.
    """


class Auth(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Auth"]:
            return Auth

        def build(self) -> "Auth":
            return Auth(**self._attrs)

        @overload
        def kubernetes(self, value_or_callback: Kubernetes, /) -> "Auth.Builder": ...

        @overload
        def kubernetes(
            self,
            value_or_callback: Callable[[Kubernetes.Builder], Kubernetes.Builder | Kubernetes],
            /,
        ) -> "Auth.Builder": ...

        @overload
        def kubernetes(self, value_or_callback: Never = ...) -> "Kubernetes.BuilderContext": ...

        def kubernetes(self, value_or_callback=None, /):
            """
            Kubernetes authenticates with Route53 using AssumeRoleWithWebIdentity
            by passing a bound ServiceAccount token.
            """
            if self._in_context and value_or_callback is None:
                context = Kubernetes.BuilderContext()
                context._parent_builder = self
                context._field_name = "kubernetes"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Kubernetes.builder())
                if isinstance(output, Kubernetes.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("kubernetes", value)

    class BuilderContext(BuilderContextBase["Auth.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Auth.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Auth."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Auth", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Auth.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    kubernetes: Kubernetes
    """
    Kubernetes authenticates with Route53 using AssumeRoleWithWebIdentity
    by passing a bound ServiceAccount token.
    """


class SecretAccessKeySecretRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["SecretAccessKeySecretRef"]:
            return SecretAccessKeySecretRef

        def build(self) -> "SecretAccessKeySecretRef":
            return SecretAccessKeySecretRef(**self._attrs)

        def key(self, value: Optional[str], /) -> Self:
            """
            The key of the entry in the Secret resource's `data` field to be used.
            Some instances of this field may be defaulted, in others it may be
            required.
            """
            return self._set("key", value)

        def name(self, value: str, /) -> Self:
            """
            Name of the resource being referred to.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["SecretAccessKeySecretRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = SecretAccessKeySecretRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for SecretAccessKeySecretRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["SecretAccessKeySecretRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use SecretAccessKeySecretRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: Optional[str] = None
    """
    The key of the entry in the Secret resource's `data` field to be used.
    Some instances of this field may be defaulted, in others it may be
    required.
    """
    name: str
    """
    Name of the resource being referred to.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class Route53(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Route53"]:
            return Route53

        def build(self) -> "Route53":
            return Route53(**self._attrs)

        def access_key_id(self, value: Optional[str], /) -> Self:
            """
            The AccessKeyID is used for authentication.
            Cannot be set when SecretAccessKeyID is set.
            If neither the Access Key nor Key ID are set, we fall-back to using env
            vars, shared credentials file or AWS Instance metadata,
            see: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
            """
            return self._set("access_key_id", value)

        @overload
        def access_key_id_secret_ref(
            self, value_or_callback: Optional[AccessKeyIdSecretRef], /
        ) -> "Route53.Builder": ...

        @overload
        def access_key_id_secret_ref(
            self,
            value_or_callback: Callable[
                [AccessKeyIdSecretRef.Builder],
                AccessKeyIdSecretRef.Builder | AccessKeyIdSecretRef,
            ],
            /,
        ) -> "Route53.Builder": ...

        @overload
        def access_key_id_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "AccessKeyIdSecretRef.BuilderContext": ...

        def access_key_id_secret_ref(self, value_or_callback=None, /):
            """
            The SecretAccessKey is used for authentication. If set, pull the AWS
            access key ID from a key within a Kubernetes Secret.
            Cannot be set when AccessKeyID is set.
            If neither the Access Key nor Key ID are set, we fall-back to using env
            vars, shared credentials file or AWS Instance metadata,
            see: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
            """
            if self._in_context and value_or_callback is None:
                context = AccessKeyIdSecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "access_key_id_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(AccessKeyIdSecretRef.builder())
                if isinstance(output, AccessKeyIdSecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("access_key_id_secret_ref", value)

        @overload
        def auth(self, value_or_callback: Optional[Auth], /) -> "Route53.Builder": ...

        @overload
        def auth(
            self, value_or_callback: Callable[[Auth.Builder], Auth.Builder | Auth], /
        ) -> "Route53.Builder": ...

        @overload
        def auth(self, value_or_callback: Never = ...) -> "Auth.BuilderContext": ...

        def auth(self, value_or_callback=None, /):
            """
            Auth configures how cert-manager authenticates.
            """
            if self._in_context and value_or_callback is None:
                context = Auth.BuilderContext()
                context._parent_builder = self
                context._field_name = "auth"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Auth.builder())
                if isinstance(output, Auth.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("auth", value)

        def hosted_zone_id(self, value: Optional[str], /) -> Self:
            """
            If set, the provider will manage only this zone in Route53 and will not do a lookup using the route53:ListHostedZonesByName api call.
            """
            return self._set("hosted_zone_id", value)

        def region(self, value: Optional[str], /) -> Self:
            """
            Override the AWS region.

            Route53 is a global service and does not have regional endpoints but the
            region specified here (or via environment variables) is used as a hint to
            help compute the correct AWS credential scope and partition when it
            connects to Route53. See:
            - [Amazon Route 53 endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/r53.html)
            - [Global services](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/global-services.html)

            If you omit this region field, cert-manager will use the region from
            AWS_REGION and AWS_DEFAULT_REGION environment variables, if they are set
            in the cert-manager controller Pod.

            The `region` field is not needed if you use [IAM Roles for Service Accounts (IRSA)](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html).
            Instead an AWS_REGION environment variable is added to the cert-manager controller Pod by:
            [Amazon EKS Pod Identity Webhook](https://github.com/aws/amazon-eks-pod-identity-webhook).
            In this case this `region` field value is ignored.

            The `region` field is not needed if you use [EKS Pod Identities](https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html).
            Instead an AWS_REGION environment variable is added to the cert-manager controller Pod by:
            [Amazon EKS Pod Identity Agent](https://github.com/aws/eks-pod-identity-agent),
            In this case this `region` field value is ignored.
            """
            return self._set("region", value)

        def role(self, value: Optional[str], /) -> Self:
            """
            Role is a Role ARN which the Route53 provider will assume using either the explicit credentials AccessKeyID/SecretAccessKey
            or the inferred credentials from environment variables, shared credentials file or AWS Instance metadata
            """
            return self._set("role", value)

        @overload
        def secret_access_key_secret_ref(
            self, value_or_callback: Optional[SecretAccessKeySecretRef], /
        ) -> "Route53.Builder": ...

        @overload
        def secret_access_key_secret_ref(
            self,
            value_or_callback: Callable[
                [SecretAccessKeySecretRef.Builder],
                SecretAccessKeySecretRef.Builder | SecretAccessKeySecretRef,
            ],
            /,
        ) -> "Route53.Builder": ...

        @overload
        def secret_access_key_secret_ref(
            self, value_or_callback: Never = ...
        ) -> "SecretAccessKeySecretRef.BuilderContext": ...

        def secret_access_key_secret_ref(self, value_or_callback=None, /):
            """
            The SecretAccessKey is used for authentication.
            If neither the Access Key nor Key ID are set, we fall-back to using env
            vars, shared credentials file or AWS Instance metadata,
            see: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
            """
            if self._in_context and value_or_callback is None:
                context = SecretAccessKeySecretRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "secret_access_key_secret_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(SecretAccessKeySecretRef.builder())
                if isinstance(output, SecretAccessKeySecretRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("secret_access_key_secret_ref", value)

    class BuilderContext(BuilderContextBase["Route53.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Route53.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Route53."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Route53", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Route53.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    access_key_id: Annotated[Optional[str], Field(alias="accessKeyID")] = None
    """
    The AccessKeyID is used for authentication.
    Cannot be set when SecretAccessKeyID is set.
    If neither the Access Key nor Key ID are set, we fall-back to using env
    vars, shared credentials file or AWS Instance metadata,
    see: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
    """
    access_key_id_secret_ref: Annotated[
        Optional[AccessKeyIdSecretRef], Field(alias="accessKeyIDSecretRef")
    ] = None
    """
    The SecretAccessKey is used for authentication. If set, pull the AWS
    access key ID from a key within a Kubernetes Secret.
    Cannot be set when AccessKeyID is set.
    If neither the Access Key nor Key ID are set, we fall-back to using env
    vars, shared credentials file or AWS Instance metadata,
    see: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
    """
    auth: Optional[Auth] = None
    """
    Auth configures how cert-manager authenticates.
    """
    hosted_zone_id: Annotated[Optional[str], Field(alias="hostedZoneID")] = None
    """
    If set, the provider will manage only this zone in Route53 and will not do a lookup using the route53:ListHostedZonesByName api call.
    """
    region: Optional[str] = None
    """
    Override the AWS region.

    Route53 is a global service and does not have regional endpoints but the
    region specified here (or via environment variables) is used as a hint to
    help compute the correct AWS credential scope and partition when it
    connects to Route53. See:
    - [Amazon Route 53 endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/r53.html)
    - [Global services](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/global-services.html)

    If you omit this region field, cert-manager will use the region from
    AWS_REGION and AWS_DEFAULT_REGION environment variables, if they are set
    in the cert-manager controller Pod.

    The `region` field is not needed if you use [IAM Roles for Service Accounts (IRSA)](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html).
    Instead an AWS_REGION environment variable is added to the cert-manager controller Pod by:
    [Amazon EKS Pod Identity Webhook](https://github.com/aws/amazon-eks-pod-identity-webhook).
    In this case this `region` field value is ignored.

    The `region` field is not needed if you use [EKS Pod Identities](https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html).
    Instead an AWS_REGION environment variable is added to the cert-manager controller Pod by:
    [Amazon EKS Pod Identity Agent](https://github.com/aws/eks-pod-identity-agent),
    In this case this `region` field value is ignored.
    """
    role: Optional[str] = None
    """
    Role is a Role ARN which the Route53 provider will assume using either the explicit credentials AccessKeyID/SecretAccessKey
    or the inferred credentials from environment variables, shared credentials file or AWS Instance metadata
    """
    secret_access_key_secret_ref: Annotated[
        Optional[SecretAccessKeySecretRef], Field(alias="secretAccessKeySecretRef")
    ] = None
    """
    The SecretAccessKey is used for authentication.
    If neither the Access Key nor Key ID are set, we fall-back to using env
    vars, shared credentials file or AWS Instance metadata,
    see: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
    """


class Webhook(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Webhook"]:
            return Webhook

        def build(self) -> "Webhook":
            return Webhook(**self._attrs)

        def config(self, value: Optional[Any], /) -> Self:
            """
            Additional configuration that should be passed to the webhook apiserver
            when challenges are processed.
            This can contain arbitrary JSON data.
            Secret values should not be specified in this stanza.
            If secret values are needed (e.g. credentials for a DNS service), you
            should use a SecretKeySelector to reference a Secret resource.
            For details on the schema of this field, consult the webhook provider
            implementation's documentation.
            """
            return self._set("config", value)

        def group_name(self, value: str, /) -> Self:
            """
            The API group name that should be used when POSTing ChallengePayload
            resources to the webhook apiserver.
            This should be the same as the GroupName specified in the webhook
            provider implementation.
            """
            return self._set("group_name", value)

        def solver_name(self, value: str, /) -> Self:
            """
            The name of the solver to use, as defined in the webhook provider
            implementation.
            This will typically be the name of the provider, e.g. 'cloudflare'.
            """
            return self._set("solver_name", value)

    class BuilderContext(BuilderContextBase["Webhook.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Webhook.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Webhook."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Webhook", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Webhook.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    config: Optional[Any] = None
    """
    Additional configuration that should be passed to the webhook apiserver
    when challenges are processed.
    This can contain arbitrary JSON data.
    Secret values should not be specified in this stanza.
    If secret values are needed (e.g. credentials for a DNS service), you
    should use a SecretKeySelector to reference a Secret resource.
    For details on the schema of this field, consult the webhook provider
    implementation's documentation.
    """
    group_name: Annotated[str, Field(alias="groupName")]
    """
    The API group name that should be used when POSTing ChallengePayload
    resources to the webhook apiserver.
    This should be the same as the GroupName specified in the webhook
    provider implementation.
    """
    solver_name: Annotated[str, Field(alias="solverName")]
    """
    The name of the solver to use, as defined in the webhook provider
    implementation.
    This will typically be the name of the provider, e.g. 'cloudflare'.
    """


class Dns01(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Dns01"]:
            return Dns01

        def build(self) -> "Dns01":
            return Dns01(**self._attrs)

        @overload
        def acme_dns(self, value_or_callback: Optional[AcmeDns], /) -> "Dns01.Builder": ...

        @overload
        def acme_dns(
            self,
            value_or_callback: Callable[[AcmeDns.Builder], AcmeDns.Builder | AcmeDns],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def acme_dns(self, value_or_callback: Never = ...) -> "AcmeDns.BuilderContext": ...

        def acme_dns(self, value_or_callback=None, /):
            """
            Use the 'ACME DNS' (https://github.com/joohoi/acme-dns) API to manage
            DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = AcmeDns.BuilderContext()
                context._parent_builder = self
                context._field_name = "acme_dns"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(AcmeDns.builder())
                if isinstance(output, AcmeDns.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("acme_dns", value)

        @overload
        def akamai(self, value_or_callback: Optional[Akamai], /) -> "Dns01.Builder": ...

        @overload
        def akamai(
            self,
            value_or_callback: Callable[[Akamai.Builder], Akamai.Builder | Akamai],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def akamai(self, value_or_callback: Never = ...) -> "Akamai.BuilderContext": ...

        def akamai(self, value_or_callback=None, /):
            """
            Use the Akamai DNS zone management API to manage DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = Akamai.BuilderContext()
                context._parent_builder = self
                context._field_name = "akamai"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Akamai.builder())
                if isinstance(output, Akamai.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("akamai", value)

        @overload
        def azure_dns(self, value_or_callback: Optional[AzureDns], /) -> "Dns01.Builder": ...

        @overload
        def azure_dns(
            self,
            value_or_callback: Callable[[AzureDns.Builder], AzureDns.Builder | AzureDns],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def azure_dns(self, value_or_callback: Never = ...) -> "AzureDns.BuilderContext": ...

        def azure_dns(self, value_or_callback=None, /):
            """
            Use the Microsoft Azure DNS API to manage DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = AzureDns.BuilderContext()
                context._parent_builder = self
                context._field_name = "azure_dns"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(AzureDns.builder())
                if isinstance(output, AzureDns.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("azure_dns", value)

        @overload
        def cloud_dns(self, value_or_callback: Optional[CloudDns], /) -> "Dns01.Builder": ...

        @overload
        def cloud_dns(
            self,
            value_or_callback: Callable[[CloudDns.Builder], CloudDns.Builder | CloudDns],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def cloud_dns(self, value_or_callback: Never = ...) -> "CloudDns.BuilderContext": ...

        def cloud_dns(self, value_or_callback=None, /):
            """
            Use the Google Cloud DNS API to manage DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = CloudDns.BuilderContext()
                context._parent_builder = self
                context._field_name = "cloud_dns"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(CloudDns.builder())
                if isinstance(output, CloudDns.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("cloud_dns", value)

        @overload
        def cloudflare(self, value_or_callback: Optional[Cloudflare], /) -> "Dns01.Builder": ...

        @overload
        def cloudflare(
            self,
            value_or_callback: Callable[[Cloudflare.Builder], Cloudflare.Builder | Cloudflare],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def cloudflare(self, value_or_callback: Never = ...) -> "Cloudflare.BuilderContext": ...

        def cloudflare(self, value_or_callback=None, /):
            """
            Use the Cloudflare API to manage DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = Cloudflare.BuilderContext()
                context._parent_builder = self
                context._field_name = "cloudflare"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Cloudflare.builder())
                if isinstance(output, Cloudflare.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("cloudflare", value)

        def cname_strategy(self, value: Optional[Literal["None", "Follow"]], /) -> Self:
            """
            CNAMEStrategy configures how the DNS01 provider should handle CNAME
            records when found in DNS zones.
            """
            return self._set("cname_strategy", value)

        @overload
        def digitalocean(self, value_or_callback: Optional[Digitalocean], /) -> "Dns01.Builder": ...

        @overload
        def digitalocean(
            self,
            value_or_callback: Callable[
                [Digitalocean.Builder], Digitalocean.Builder | Digitalocean
            ],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def digitalocean(self, value_or_callback: Never = ...) -> "Digitalocean.BuilderContext": ...

        def digitalocean(self, value_or_callback=None, /):
            """
            Use the DigitalOcean DNS API to manage DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = Digitalocean.BuilderContext()
                context._parent_builder = self
                context._field_name = "digitalocean"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Digitalocean.builder())
                if isinstance(output, Digitalocean.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("digitalocean", value)

        @overload
        def rfc2136(self, value_or_callback: Optional[Rfc2136], /) -> "Dns01.Builder": ...

        @overload
        def rfc2136(
            self,
            value_or_callback: Callable[[Rfc2136.Builder], Rfc2136.Builder | Rfc2136],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def rfc2136(self, value_or_callback: Never = ...) -> "Rfc2136.BuilderContext": ...

        def rfc2136(self, value_or_callback=None, /):
            """
            Use RFC2136 ("Dynamic Updates in the Domain Name System") (https://datatracker.ietf.org/doc/rfc2136/)
            to manage DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = Rfc2136.BuilderContext()
                context._parent_builder = self
                context._field_name = "rfc2136"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Rfc2136.builder())
                if isinstance(output, Rfc2136.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("rfc2136", value)

        @overload
        def route53(self, value_or_callback: Optional[Route53], /) -> "Dns01.Builder": ...

        @overload
        def route53(
            self,
            value_or_callback: Callable[[Route53.Builder], Route53.Builder | Route53],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def route53(self, value_or_callback: Never = ...) -> "Route53.BuilderContext": ...

        def route53(self, value_or_callback=None, /):
            """
            Use the AWS Route53 API to manage DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = Route53.BuilderContext()
                context._parent_builder = self
                context._field_name = "route53"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Route53.builder())
                if isinstance(output, Route53.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("route53", value)

        @overload
        def webhook(self, value_or_callback: Optional[Webhook], /) -> "Dns01.Builder": ...

        @overload
        def webhook(
            self,
            value_or_callback: Callable[[Webhook.Builder], Webhook.Builder | Webhook],
            /,
        ) -> "Dns01.Builder": ...

        @overload
        def webhook(self, value_or_callback: Never = ...) -> "Webhook.BuilderContext": ...

        def webhook(self, value_or_callback=None, /):
            """
            Configure an external webhook based DNS01 challenge solver to manage
            DNS01 challenge records.
            """
            if self._in_context and value_or_callback is None:
                context = Webhook.BuilderContext()
                context._parent_builder = self
                context._field_name = "webhook"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Webhook.builder())
                if isinstance(output, Webhook.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("webhook", value)

    class BuilderContext(BuilderContextBase["Dns01.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Dns01.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Dns01."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Dns01", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Dns01.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    acme_dns: Annotated[Optional[AcmeDns], Field(alias="acmeDNS")] = None
    """
    Use the 'ACME DNS' (https://github.com/joohoi/acme-dns) API to manage
    DNS01 challenge records.
    """
    akamai: Optional[Akamai] = None
    """
    Use the Akamai DNS zone management API to manage DNS01 challenge records.
    """
    azure_dns: Annotated[Optional[AzureDns], Field(alias="azureDNS")] = None
    """
    Use the Microsoft Azure DNS API to manage DNS01 challenge records.
    """
    cloud_dns: Annotated[Optional[CloudDns], Field(alias="cloudDNS")] = None
    """
    Use the Google Cloud DNS API to manage DNS01 challenge records.
    """
    cloudflare: Optional[Cloudflare] = None
    """
    Use the Cloudflare API to manage DNS01 challenge records.
    """
    cname_strategy: Annotated[Optional[Literal["None", "Follow"]], Field(alias="cnameStrategy")] = (
        None
    )
    """
    CNAMEStrategy configures how the DNS01 provider should handle CNAME
    records when found in DNS zones.
    """
    digitalocean: Optional[Digitalocean] = None
    """
    Use the DigitalOcean DNS API to manage DNS01 challenge records.
    """
    rfc2136: Optional[Rfc2136] = None
    """
    Use RFC2136 ("Dynamic Updates in the Domain Name System") (https://datatracker.ietf.org/doc/rfc2136/)
    to manage DNS01 challenge records.
    """
    route53: Optional[Route53] = None
    """
    Use the AWS Route53 API to manage DNS01 challenge records.
    """
    webhook: Optional[Webhook] = None
    """
    Configure an external webhook based DNS01 challenge solver to manage
    DNS01 challenge records.
    """


class ParentRef(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ParentRef"]:
            return ParentRef

        def build(self) -> "ParentRef":
            return ParentRef(**self._attrs)

        def group(self, value: Optional[str], /) -> Self:
            """
            Group is the group of the referent.
            When unspecified, "gateway.networking.k8s.io" is inferred.
            To set the core API group (such as for a "Service" kind referent),
            Group must be explicitly set to "" (empty string).

            Support: Core
            """
            return self._set("group", value)

        def kind(self, value: Optional[str], /) -> Self:
            """
            Kind is kind of the referent.

            There are two kinds of parent resources with "Core" support:

            * Gateway (Gateway conformance profile)
            * Service (Mesh conformance profile, ClusterIP Services only)

            Support for other resources is Implementation-Specific.
            """
            return self._set("kind", value)

        def name(self, value: str, /) -> Self:
            """
            Name is the name of the referent.

            Support: Core
            """
            return self._set("name", value)

        def namespace(self, value: Optional[str], /) -> Self:
            """
            Namespace is the namespace of the referent. When unspecified, this refers
            to the local namespace of the Route.

            Note that there are specific rules for ParentRefs which cross namespace
            boundaries. Cross-namespace references are only valid if they are explicitly
            allowed by something in the namespace they are referring to. For example:
            Gateway has the AllowedRoutes field, and ReferenceGrant provides a
            generic way to enable any other kind of cross-namespace reference.

            <gateway:experimental:description>
            ParentRefs from a Route to a Service in the same namespace are "producer"
            routes, which apply default routing rules to inbound connections from
            any namespace to the Service.

            ParentRefs from a Route to a Service in a different namespace are
            "consumer" routes, and these routing rules are only applied to outbound
            connections originating from the same namespace as the Route, for which
            the intended destination of the connections are a Service targeted as a
            ParentRef of the Route.
            </gateway:experimental:description>

            Support: Core
            """
            return self._set("namespace", value)

        def port(self, value: Optional[int], /) -> Self:
            """
            Port is the network port this Route targets. It can be interpreted
            differently based on the type of parent resource.

            When the parent resource is a Gateway, this targets all listeners
            listening on the specified port that also support this kind of Route(and
            select this Route). It's not recommended to set `Port` unless the
            networking behaviors specified in a Route must apply to a specific port
            as opposed to a listener(s) whose port(s) may be changed. When both Port
            and SectionName are specified, the name and port of the selected listener
            must match both specified values.

            <gateway:experimental:description>
            When the parent resource is a Service, this targets a specific port in the
            Service spec. When both Port (experimental) and SectionName are specified,
            the name and port of the selected port must match both specified values.
            </gateway:experimental:description>

            Implementations MAY choose to support other parent resources.
            Implementations supporting other types of parent resources MUST clearly
            document how/if Port is interpreted.

            For the purpose of status, an attachment is considered successful as
            long as the parent resource accepts it partially. For example, Gateway
            listeners can restrict which Routes can attach to them by Route kind,
            namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
            from the referencing Route, the Route MUST be considered successfully
            attached. If no Gateway listeners accept attachment from this Route,
            the Route MUST be considered detached from the Gateway.

            Support: Extended
            """
            return self._set("port", value)

        def section_name(self, value: Optional[str], /) -> Self:
            """
            SectionName is the name of a section within the target resource. In the
            following resources, SectionName is interpreted as the following:

            * Gateway: Listener name. When both Port (experimental) and SectionName
            are specified, the name and port of the selected listener must match
            both specified values.
            * Service: Port name. When both Port (experimental) and SectionName
            are specified, the name and port of the selected listener must match
            both specified values.

            Implementations MAY choose to support attaching Routes to other resources.
            If that is the case, they MUST clearly document how SectionName is
            interpreted.

            When unspecified (empty string), this will reference the entire resource.
            For the purpose of status, an attachment is considered successful if at
            least one section in the parent resource accepts it. For example, Gateway
            listeners can restrict which Routes can attach to them by Route kind,
            namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
            the referencing Route, the Route MUST be considered successfully
            attached. If no Gateway listeners accept attachment from this Route, the
            Route MUST be considered detached from the Gateway.

            Support: Core
            """
            return self._set("section_name", value)

    class BuilderContext(BuilderContextBase["ParentRef.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ParentRef.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ParentRef."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ParentRef", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ParentRef.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    group: Annotated[
        Optional[str],
        Field(
            max_length=253,
            pattern="^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
        ),
    ] = "gateway.networking.k8s.io"
    """
    Group is the group of the referent.
    When unspecified, "gateway.networking.k8s.io" is inferred.
    To set the core API group (such as for a "Service" kind referent),
    Group must be explicitly set to "" (empty string).

    Support: Core
    """
    kind: Annotated[
        Optional[str],
        Field(max_length=63, min_length=1, pattern="^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$"),
    ] = "Gateway"
    """
    Kind is kind of the referent.

    There are two kinds of parent resources with "Core" support:

    * Gateway (Gateway conformance profile)
    * Service (Mesh conformance profile, ClusterIP Services only)

    Support for other resources is Implementation-Specific.
    """
    name: Annotated[str, Field(max_length=253, min_length=1)]
    """
    Name is the name of the referent.

    Support: Core
    """
    namespace: Annotated[
        Optional[str],
        Field(max_length=63, min_length=1, pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"),
    ] = None
    """
    Namespace is the namespace of the referent. When unspecified, this refers
    to the local namespace of the Route.

    Note that there are specific rules for ParentRefs which cross namespace
    boundaries. Cross-namespace references are only valid if they are explicitly
    allowed by something in the namespace they are referring to. For example:
    Gateway has the AllowedRoutes field, and ReferenceGrant provides a
    generic way to enable any other kind of cross-namespace reference.

    <gateway:experimental:description>
    ParentRefs from a Route to a Service in the same namespace are "producer"
    routes, which apply default routing rules to inbound connections from
    any namespace to the Service.

    ParentRefs from a Route to a Service in a different namespace are
    "consumer" routes, and these routing rules are only applied to outbound
    connections originating from the same namespace as the Route, for which
    the intended destination of the connections are a Service targeted as a
    ParentRef of the Route.
    </gateway:experimental:description>

    Support: Core
    """
    port: Annotated[Optional[int], Field(ge=1, le=65535)] = None
    """
    Port is the network port this Route targets. It can be interpreted
    differently based on the type of parent resource.

    When the parent resource is a Gateway, this targets all listeners
    listening on the specified port that also support this kind of Route(and
    select this Route). It's not recommended to set `Port` unless the
    networking behaviors specified in a Route must apply to a specific port
    as opposed to a listener(s) whose port(s) may be changed. When both Port
    and SectionName are specified, the name and port of the selected listener
    must match both specified values.

    <gateway:experimental:description>
    When the parent resource is a Service, this targets a specific port in the
    Service spec. When both Port (experimental) and SectionName are specified,
    the name and port of the selected port must match both specified values.
    </gateway:experimental:description>

    Implementations MAY choose to support other parent resources.
    Implementations supporting other types of parent resources MUST clearly
    document how/if Port is interpreted.

    For the purpose of status, an attachment is considered successful as
    long as the parent resource accepts it partially. For example, Gateway
    listeners can restrict which Routes can attach to them by Route kind,
    namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
    from the referencing Route, the Route MUST be considered successfully
    attached. If no Gateway listeners accept attachment from this Route,
    the Route MUST be considered detached from the Gateway.

    Support: Extended
    """
    section_name: Annotated[
        Optional[str],
        Field(
            alias="sectionName",
            max_length=253,
            min_length=1,
            pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
        ),
    ] = None
    """
    SectionName is the name of a section within the target resource. In the
    following resources, SectionName is interpreted as the following:

    * Gateway: Listener name. When both Port (experimental) and SectionName
    are specified, the name and port of the selected listener must match
    both specified values.
    * Service: Port name. When both Port (experimental) and SectionName
    are specified, the name and port of the selected listener must match
    both specified values.

    Implementations MAY choose to support attaching Routes to other resources.
    If that is the case, they MUST clearly document how SectionName is
    interpreted.

    When unspecified (empty string), this will reference the entire resource.
    For the purpose of status, an attachment is considered successful if at
    least one section in the parent resource accepts it. For example, Gateway
    listeners can restrict which Routes can attach to them by Route kind,
    namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
    the referencing Route, the Route MUST be considered successfully
    attached. If no Gateway listeners accept attachment from this Route, the
    Route MUST be considered detached from the Gateway.

    Support: Core
    """


class Metadata(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Metadata"]:
            return Metadata

        def build(self) -> "Metadata":
            return Metadata(**self._attrs)

        def annotations(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            Annotations that should be added to the created ACME HTTP01 solver pods.
            """
            return self._set("annotations", value)

        def labels(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            Labels that should be added to the created ACME HTTP01 solver pods.
            """
            return self._set("labels", value)

    class BuilderContext(BuilderContextBase["Metadata.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Metadata.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Metadata."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Metadata", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Metadata.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    annotations: Optional[Dict[str, str]] = None
    """
    Annotations that should be added to the created ACME HTTP01 solver pods.
    """
    labels: Optional[Dict[str, str]] = None
    """
    Labels that should be added to the created ACME HTTP01 solver pods.
    """


class MatchExpression(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["MatchExpression"]:
            return MatchExpression

        def build(self) -> "MatchExpression":
            return MatchExpression(**self._attrs)

        def key(self, value: str, /) -> Self:
            """
            The label key that the selector applies to.
            """
            return self._set("key", value)

        def operator(self, value: str, /) -> Self:
            """
            Represents a key's relationship to a set of values.
            Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
            """
            return self._set("operator", value)

        def values(self, value: Optional[List[str]], /) -> Self:
            """
            An array of string values. If the operator is In or NotIn,
            the values array must be non-empty. If the operator is Exists or DoesNotExist,
            the values array must be empty. If the operator is Gt or Lt, the values
            array must have a single element, which will be interpreted as an integer.
            This array is replaced during a strategic merge patch.
            """
            return self._set("values", value)

    class BuilderContext(BuilderContextBase["MatchExpression.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = MatchExpression.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for MatchExpression."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["MatchExpression", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use MatchExpression.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: str
    """
    The label key that the selector applies to.
    """
    operator: str
    """
    Represents a key's relationship to a set of values.
    Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
    """
    values: Optional[List[str]] = None
    """
    An array of string values. If the operator is In or NotIn,
    the values array must be non-empty. If the operator is Exists or DoesNotExist,
    the values array must be empty. If the operator is Gt or Lt, the values
    array must have a single element, which will be interpreted as an integer.
    This array is replaced during a strategic merge patch.
    """


class MatchField(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["MatchField"]:
            return MatchField

        def build(self) -> "MatchField":
            return MatchField(**self._attrs)

        def key(self, value: str, /) -> Self:
            """
            The label key that the selector applies to.
            """
            return self._set("key", value)

        def operator(self, value: str, /) -> Self:
            """
            Represents a key's relationship to a set of values.
            Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
            """
            return self._set("operator", value)

        def values(self, value: Optional[List[str]], /) -> Self:
            """
            An array of string values. If the operator is In or NotIn,
            the values array must be non-empty. If the operator is Exists or DoesNotExist,
            the values array must be empty. If the operator is Gt or Lt, the values
            array must have a single element, which will be interpreted as an integer.
            This array is replaced during a strategic merge patch.
            """
            return self._set("values", value)

    class BuilderContext(BuilderContextBase["MatchField.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = MatchField.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for MatchField."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["MatchField", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use MatchField.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: str
    """
    The label key that the selector applies to.
    """
    operator: str
    """
    Represents a key's relationship to a set of values.
    Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
    """
    values: Optional[List[str]] = None
    """
    An array of string values. If the operator is In or NotIn,
    the values array must be non-empty. If the operator is Exists or DoesNotExist,
    the values array must be empty. If the operator is Gt or Lt, the values
    array must have a single element, which will be interpreted as an integer.
    This array is replaced during a strategic merge patch.
    """


class Preference(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Preference"]:
            return Preference

        def build(self) -> "Preference":
            return Preference(**self._attrs)

        @overload
        def match_expressions(
            self, value_or_callback: List[MatchExpression], /
        ) -> "Preference.Builder": ...

        @overload
        def match_expressions(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[MatchExpression, MatchExpression.Builder]],
                GenericListBuilder[MatchExpression, MatchExpression.Builder]
                | List[MatchExpression],
            ],
            /,
        ) -> "Preference.Builder": ...

        @overload
        def match_expressions(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[MatchExpression.Builder]: ...

        def match_expressions(self, value_or_callback=None, /):
            """
            A list of node selector requirements by node's labels.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[MatchExpression.Builder]()
                context._parent_builder = self
                context._field_name = "match_expressions"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(MatchExpression.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("match_expressions", value)

        @overload
        def match_fields(self, value_or_callback: List[MatchField], /) -> "Preference.Builder": ...

        @overload
        def match_fields(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[MatchField, MatchField.Builder]],
                GenericListBuilder[MatchField, MatchField.Builder] | List[MatchField],
            ],
            /,
        ) -> "Preference.Builder": ...

        @overload
        def match_fields(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[MatchField.Builder]: ...

        def match_fields(self, value_or_callback=None, /):
            """
            A list of node selector requirements by node's fields.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[MatchField.Builder]()
                context._parent_builder = self
                context._field_name = "match_fields"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(MatchField.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("match_fields", value)

    class BuilderContext(BuilderContextBase["Preference.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Preference.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Preference."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Preference", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Preference.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    match_expressions: Annotated[
        Optional[List[MatchExpression]], Field(alias="matchExpressions")
    ] = None
    """
    A list of node selector requirements by node's labels.
    """
    match_fields: Annotated[Optional[List[MatchField]], Field(alias="matchFields")] = None
    """
    A list of node selector requirements by node's fields.
    """


class PreferredDuringSchedulingIgnoredDuringExecution(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PreferredDuringSchedulingIgnoredDuringExecution"]:
            return PreferredDuringSchedulingIgnoredDuringExecution

        def build(self) -> "PreferredDuringSchedulingIgnoredDuringExecution":
            return PreferredDuringSchedulingIgnoredDuringExecution(**self._attrs)

        @overload
        def preference(
            self, value_or_callback: Preference, /
        ) -> "PreferredDuringSchedulingIgnoredDuringExecution.Builder": ...

        @overload
        def preference(
            self,
            value_or_callback: Callable[[Preference.Builder], Preference.Builder | Preference],
            /,
        ) -> "PreferredDuringSchedulingIgnoredDuringExecution.Builder": ...

        @overload
        def preference(self, value_or_callback: Never = ...) -> "Preference.BuilderContext": ...

        def preference(self, value_or_callback=None, /):
            """
            A node selector term, associated with the corresponding weight.
            """
            if self._in_context and value_or_callback is None:
                context = Preference.BuilderContext()
                context._parent_builder = self
                context._field_name = "preference"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Preference.builder())
                if isinstance(output, Preference.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("preference", value)

        def weight(self, value: int, /) -> Self:
            """
            Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
            """
            return self._set("weight", value)

    class BuilderContext(
        BuilderContextBase["PreferredDuringSchedulingIgnoredDuringExecution.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = PreferredDuringSchedulingIgnoredDuringExecution.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PreferredDuringSchedulingIgnoredDuringExecution."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["PreferredDuringSchedulingIgnoredDuringExecution", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PreferredDuringSchedulingIgnoredDuringExecution.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    preference: Preference
    """
    A node selector term, associated with the corresponding weight.
    """
    weight: int
    """
    Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
    """


class NodeSelectorTerm(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["NodeSelectorTerm"]:
            return NodeSelectorTerm

        def build(self) -> "NodeSelectorTerm":
            return NodeSelectorTerm(**self._attrs)

        @overload
        def match_expressions(
            self, value_or_callback: List[MatchExpression], /
        ) -> "NodeSelectorTerm.Builder": ...

        @overload
        def match_expressions(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[MatchExpression, MatchExpression.Builder]],
                GenericListBuilder[MatchExpression, MatchExpression.Builder]
                | List[MatchExpression],
            ],
            /,
        ) -> "NodeSelectorTerm.Builder": ...

        @overload
        def match_expressions(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[MatchExpression.Builder]: ...

        def match_expressions(self, value_or_callback=None, /):
            """
            A list of node selector requirements by node's labels.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[MatchExpression.Builder]()
                context._parent_builder = self
                context._field_name = "match_expressions"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(MatchExpression.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("match_expressions", value)

        @overload
        def match_fields(
            self, value_or_callback: List[MatchField], /
        ) -> "NodeSelectorTerm.Builder": ...

        @overload
        def match_fields(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[MatchField, MatchField.Builder]],
                GenericListBuilder[MatchField, MatchField.Builder] | List[MatchField],
            ],
            /,
        ) -> "NodeSelectorTerm.Builder": ...

        @overload
        def match_fields(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[MatchField.Builder]: ...

        def match_fields(self, value_or_callback=None, /):
            """
            A list of node selector requirements by node's fields.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[MatchField.Builder]()
                context._parent_builder = self
                context._field_name = "match_fields"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(MatchField.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("match_fields", value)

    class BuilderContext(BuilderContextBase["NodeSelectorTerm.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = NodeSelectorTerm.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for NodeSelectorTerm."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["NodeSelectorTerm", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use NodeSelectorTerm.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    match_expressions: Annotated[
        Optional[List[MatchExpression]], Field(alias="matchExpressions")
    ] = None
    """
    A list of node selector requirements by node's labels.
    """
    match_fields: Annotated[Optional[List[MatchField]], Field(alias="matchFields")] = None
    """
    A list of node selector requirements by node's fields.
    """


class RequiredDuringSchedulingIgnoredDuringExecution(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["RequiredDuringSchedulingIgnoredDuringExecution"]:
            return RequiredDuringSchedulingIgnoredDuringExecution

        def build(self) -> "RequiredDuringSchedulingIgnoredDuringExecution":
            return RequiredDuringSchedulingIgnoredDuringExecution(**self._attrs)

        @overload
        def node_selector_terms(
            self, value_or_callback: List[NodeSelectorTerm], /
        ) -> "RequiredDuringSchedulingIgnoredDuringExecution.Builder": ...

        @overload
        def node_selector_terms(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[NodeSelectorTerm, NodeSelectorTerm.Builder]],
                GenericListBuilder[NodeSelectorTerm, NodeSelectorTerm.Builder]
                | List[NodeSelectorTerm],
            ],
            /,
        ) -> "RequiredDuringSchedulingIgnoredDuringExecution.Builder": ...

        @overload
        def node_selector_terms(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[NodeSelectorTerm.Builder]: ...

        def node_selector_terms(self, value_or_callback=None, /):
            """
            Required. A list of node selector terms. The terms are ORed.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[NodeSelectorTerm.Builder]()
                context._parent_builder = self
                context._field_name = "node_selector_terms"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(NodeSelectorTerm.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("node_selector_terms", value)

    class BuilderContext(
        BuilderContextBase["RequiredDuringSchedulingIgnoredDuringExecution.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = RequiredDuringSchedulingIgnoredDuringExecution.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for RequiredDuringSchedulingIgnoredDuringExecution."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["RequiredDuringSchedulingIgnoredDuringExecution", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use RequiredDuringSchedulingIgnoredDuringExecution.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    node_selector_terms: Annotated[List[NodeSelectorTerm], Field(alias="nodeSelectorTerms")]
    """
    Required. A list of node selector terms. The terms are ORed.
    """


class NodeAffinity(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["NodeAffinity"]:
            return NodeAffinity

        def build(self) -> "NodeAffinity":
            return NodeAffinity(**self._attrs)

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: List[PreferredDuringSchedulingIgnoredDuringExecution],
            /,
        ) -> "NodeAffinity.Builder": ...

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: Callable[
                [
                    GenericListBuilder[
                        PreferredDuringSchedulingIgnoredDuringExecution,
                        PreferredDuringSchedulingIgnoredDuringExecution.Builder,
                    ]
                ],
                GenericListBuilder[
                    PreferredDuringSchedulingIgnoredDuringExecution,
                    PreferredDuringSchedulingIgnoredDuringExecution.Builder,
                ]
                | List[PreferredDuringSchedulingIgnoredDuringExecution],
            ],
            /,
        ) -> "NodeAffinity.Builder": ...

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[PreferredDuringSchedulingIgnoredDuringExecution.Builder]: ...

        def preferred_during_scheduling_ignored_during_execution(self, value_or_callback=None, /):
            """
            The scheduler will prefer to schedule pods to nodes that satisfy
            the affinity expressions specified by this field, but it may choose
            a node that violates one or more of the expressions. The node that is
            most preferred is the one with the greatest sum of weights, i.e.
            for each node that meets all of the scheduling requirements (resource
            request, requiredDuringScheduling affinity expressions, etc.),
            compute a sum by iterating through the elements of this field and adding
            "weight" to the sum if the node matches the corresponding matchExpressions; the
            node(s) with the highest sum are the most preferred.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[
                    PreferredDuringSchedulingIgnoredDuringExecution.Builder
                ]()
                context._parent_builder = self
                context._field_name = "preferred_during_scheduling_ignored_during_execution"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(
                    PreferredDuringSchedulingIgnoredDuringExecution.list_builder()
                )
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("preferred_during_scheduling_ignored_during_execution", value)

        @overload
        def required_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: Optional[RequiredDuringSchedulingIgnoredDuringExecution],
            /,
        ) -> "NodeAffinity.Builder": ...

        @overload
        def required_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: Callable[
                [RequiredDuringSchedulingIgnoredDuringExecution.Builder],
                RequiredDuringSchedulingIgnoredDuringExecution.Builder
                | RequiredDuringSchedulingIgnoredDuringExecution,
            ],
            /,
        ) -> "NodeAffinity.Builder": ...

        @overload
        def required_during_scheduling_ignored_during_execution(
            self, value_or_callback: Never = ...
        ) -> "RequiredDuringSchedulingIgnoredDuringExecution.BuilderContext": ...

        def required_during_scheduling_ignored_during_execution(self, value_or_callback=None, /):
            """
            If the affinity requirements specified by this field are not met at
            scheduling time, the pod will not be scheduled onto the node.
            If the affinity requirements specified by this field cease to be met
            at some point during pod execution (e.g. due to an update), the system
            may or may not try to eventually evict the pod from its node.
            """
            if self._in_context and value_or_callback is None:
                context = RequiredDuringSchedulingIgnoredDuringExecution.BuilderContext()
                context._parent_builder = self
                context._field_name = "required_during_scheduling_ignored_during_execution"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(RequiredDuringSchedulingIgnoredDuringExecution.builder())
                if isinstance(output, RequiredDuringSchedulingIgnoredDuringExecution.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("required_during_scheduling_ignored_during_execution", value)

    class BuilderContext(BuilderContextBase["NodeAffinity.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = NodeAffinity.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for NodeAffinity."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["NodeAffinity", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use NodeAffinity.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    preferred_during_scheduling_ignored_during_execution: Annotated[
        Optional[List[PreferredDuringSchedulingIgnoredDuringExecution]],
        Field(alias="preferredDuringSchedulingIgnoredDuringExecution"),
    ] = None
    """
    The scheduler will prefer to schedule pods to nodes that satisfy
    the affinity expressions specified by this field, but it may choose
    a node that violates one or more of the expressions. The node that is
    most preferred is the one with the greatest sum of weights, i.e.
    for each node that meets all of the scheduling requirements (resource
    request, requiredDuringScheduling affinity expressions, etc.),
    compute a sum by iterating through the elements of this field and adding
    "weight" to the sum if the node matches the corresponding matchExpressions; the
    node(s) with the highest sum are the most preferred.
    """
    required_during_scheduling_ignored_during_execution: Annotated[
        Optional[RequiredDuringSchedulingIgnoredDuringExecution],
        Field(alias="requiredDuringSchedulingIgnoredDuringExecution"),
    ] = None
    """
    If the affinity requirements specified by this field are not met at
    scheduling time, the pod will not be scheduled onto the node.
    If the affinity requirements specified by this field cease to be met
    at some point during pod execution (e.g. due to an update), the system
    may or may not try to eventually evict the pod from its node.
    """


class MatchExpressionModel(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["MatchExpressionModel"]:
            return MatchExpressionModel

        def build(self) -> "MatchExpressionModel":
            return MatchExpressionModel(**self._attrs)

        def key(self, value: str, /) -> Self:
            """
            key is the label key that the selector applies to.
            """
            return self._set("key", value)

        def operator(self, value: str, /) -> Self:
            """
            operator represents a key's relationship to a set of values.
            Valid operators are In, NotIn, Exists and DoesNotExist.
            """
            return self._set("operator", value)

        def values(self, value: Optional[List[str]], /) -> Self:
            """
            values is an array of string values. If the operator is In or NotIn,
            the values array must be non-empty. If the operator is Exists or DoesNotExist,
            the values array must be empty. This array is replaced during a strategic
            merge patch.
            """
            return self._set("values", value)

    class BuilderContext(BuilderContextBase["MatchExpressionModel.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = MatchExpressionModel.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for MatchExpressionModel."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["MatchExpressionModel", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use MatchExpressionModel.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: str
    """
    key is the label key that the selector applies to.
    """
    operator: str
    """
    operator represents a key's relationship to a set of values.
    Valid operators are In, NotIn, Exists and DoesNotExist.
    """
    values: Optional[List[str]] = None
    """
    values is an array of string values. If the operator is In or NotIn,
    the values array must be non-empty. If the operator is Exists or DoesNotExist,
    the values array must be empty. This array is replaced during a strategic
    merge patch.
    """


class LabelSelector(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["LabelSelector"]:
            return LabelSelector

        def build(self) -> "LabelSelector":
            return LabelSelector(**self._attrs)

        @overload
        def match_expressions(
            self, value_or_callback: List[MatchExpressionModel], /
        ) -> "LabelSelector.Builder": ...

        @overload
        def match_expressions(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[MatchExpressionModel, MatchExpressionModel.Builder]],
                GenericListBuilder[MatchExpressionModel, MatchExpressionModel.Builder]
                | List[MatchExpressionModel],
            ],
            /,
        ) -> "LabelSelector.Builder": ...

        @overload
        def match_expressions(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[MatchExpressionModel.Builder]: ...

        def match_expressions(self, value_or_callback=None, /):
            """
            matchExpressions is a list of label selector requirements. The requirements are ANDed.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[MatchExpressionModel.Builder]()
                context._parent_builder = self
                context._field_name = "match_expressions"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(MatchExpressionModel.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("match_expressions", value)

        def match_labels(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
            map is equivalent to an element of matchExpressions, whose key field is "key", the
            operator is "In", and the values array contains only "value". The requirements are ANDed.
            """
            return self._set("match_labels", value)

    class BuilderContext(BuilderContextBase["LabelSelector.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = LabelSelector.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for LabelSelector."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["LabelSelector", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use LabelSelector.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    match_expressions: Annotated[
        Optional[List[MatchExpressionModel]], Field(alias="matchExpressions")
    ] = None
    """
    matchExpressions is a list of label selector requirements. The requirements are ANDed.
    """
    match_labels: Annotated[Optional[Dict[str, str]], Field(alias="matchLabels")] = None
    """
    matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    map is equivalent to an element of matchExpressions, whose key field is "key", the
    operator is "In", and the values array contains only "value". The requirements are ANDed.
    """


class NamespaceSelector(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["NamespaceSelector"]:
            return NamespaceSelector

        def build(self) -> "NamespaceSelector":
            return NamespaceSelector(**self._attrs)

        @overload
        def match_expressions(
            self, value_or_callback: List[MatchExpressionModel], /
        ) -> "NamespaceSelector.Builder": ...

        @overload
        def match_expressions(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[MatchExpressionModel, MatchExpressionModel.Builder]],
                GenericListBuilder[MatchExpressionModel, MatchExpressionModel.Builder]
                | List[MatchExpressionModel],
            ],
            /,
        ) -> "NamespaceSelector.Builder": ...

        @overload
        def match_expressions(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[MatchExpressionModel.Builder]: ...

        def match_expressions(self, value_or_callback=None, /):
            """
            matchExpressions is a list of label selector requirements. The requirements are ANDed.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[MatchExpressionModel.Builder]()
                context._parent_builder = self
                context._field_name = "match_expressions"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(MatchExpressionModel.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("match_expressions", value)

        def match_labels(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
            map is equivalent to an element of matchExpressions, whose key field is "key", the
            operator is "In", and the values array contains only "value". The requirements are ANDed.
            """
            return self._set("match_labels", value)

    class BuilderContext(BuilderContextBase["NamespaceSelector.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = NamespaceSelector.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for NamespaceSelector."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["NamespaceSelector", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use NamespaceSelector.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    match_expressions: Annotated[
        Optional[List[MatchExpressionModel]], Field(alias="matchExpressions")
    ] = None
    """
    matchExpressions is a list of label selector requirements. The requirements are ANDed.
    """
    match_labels: Annotated[Optional[Dict[str, str]], Field(alias="matchLabels")] = None
    """
    matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    map is equivalent to an element of matchExpressions, whose key field is "key", the
    operator is "In", and the values array contains only "value". The requirements are ANDed.
    """


class PodAffinityTerm(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PodAffinityTerm"]:
            return PodAffinityTerm

        def build(self) -> "PodAffinityTerm":
            return PodAffinityTerm(**self._attrs)

        @overload
        def label_selector(
            self, value_or_callback: Optional[LabelSelector], /
        ) -> "PodAffinityTerm.Builder": ...

        @overload
        def label_selector(
            self,
            value_or_callback: Callable[
                [LabelSelector.Builder], LabelSelector.Builder | LabelSelector
            ],
            /,
        ) -> "PodAffinityTerm.Builder": ...

        @overload
        def label_selector(
            self, value_or_callback: Never = ...
        ) -> "LabelSelector.BuilderContext": ...

        def label_selector(self, value_or_callback=None, /):
            """
            A label query over a set of resources, in this case pods.
            If it's null, this PodAffinityTerm matches with no Pods.
            """
            if self._in_context and value_or_callback is None:
                context = LabelSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "label_selector"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(LabelSelector.builder())
                if isinstance(output, LabelSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("label_selector", value)

        def match_label_keys(self, value: Optional[List[str]], /) -> Self:
            """
            MatchLabelKeys is a set of pod label keys to select which pods will
            be taken into consideration. The keys are used to lookup values from the
            incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
            to select the group of existing pods which pods will be taken into consideration
            for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
            pod labels will be ignored. The default value is empty.
            The same key is forbidden to exist in both matchLabelKeys and labelSelector.
            Also, matchLabelKeys cannot be set when labelSelector isn't set.
            This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
            """
            return self._set("match_label_keys", value)

        def mismatch_label_keys(self, value: Optional[List[str]], /) -> Self:
            """
            MismatchLabelKeys is a set of pod label keys to select which pods will
            be taken into consideration. The keys are used to lookup values from the
            incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
            to select the group of existing pods which pods will be taken into consideration
            for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
            pod labels will be ignored. The default value is empty.
            The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
            Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
            This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
            """
            return self._set("mismatch_label_keys", value)

        @overload
        def namespace_selector(
            self, value_or_callback: Optional[NamespaceSelector], /
        ) -> "PodAffinityTerm.Builder": ...

        @overload
        def namespace_selector(
            self,
            value_or_callback: Callable[
                [NamespaceSelector.Builder],
                NamespaceSelector.Builder | NamespaceSelector,
            ],
            /,
        ) -> "PodAffinityTerm.Builder": ...

        @overload
        def namespace_selector(
            self, value_or_callback: Never = ...
        ) -> "NamespaceSelector.BuilderContext": ...

        def namespace_selector(self, value_or_callback=None, /):
            """
            A label query over the set of namespaces that the term applies to.
            The term is applied to the union of the namespaces selected by this field
            and the ones listed in the namespaces field.
            null selector and null or empty namespaces list means "this pod's namespace".
            An empty selector ({}) matches all namespaces.
            """
            if self._in_context and value_or_callback is None:
                context = NamespaceSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "namespace_selector"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(NamespaceSelector.builder())
                if isinstance(output, NamespaceSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("namespace_selector", value)

        def namespaces(self, value: Optional[List[str]], /) -> Self:
            """
            namespaces specifies a static list of namespace names that the term applies to.
            The term is applied to the union of the namespaces listed in this field
            and the ones selected by namespaceSelector.
            null or empty namespaces list and null namespaceSelector means "this pod's namespace".
            """
            return self._set("namespaces", value)

        def topology_key(self, value: str, /) -> Self:
            """
            This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
            the labelSelector in the specified namespaces, where co-located is defined as running on a node
            whose value of the label with key topologyKey matches that of any node on which any of the
            selected pods is running.
            Empty topologyKey is not allowed.
            """
            return self._set("topology_key", value)

    class BuilderContext(BuilderContextBase["PodAffinityTerm.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = PodAffinityTerm.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PodAffinityTerm."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["PodAffinityTerm", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PodAffinityTerm.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    label_selector: Annotated[Optional[LabelSelector], Field(alias="labelSelector")] = None
    """
    A label query over a set of resources, in this case pods.
    If it's null, this PodAffinityTerm matches with no Pods.
    """
    match_label_keys: Annotated[Optional[List[str]], Field(alias="matchLabelKeys")] = None
    """
    MatchLabelKeys is a set of pod label keys to select which pods will
    be taken into consideration. The keys are used to lookup values from the
    incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
    to select the group of existing pods which pods will be taken into consideration
    for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
    pod labels will be ignored. The default value is empty.
    The same key is forbidden to exist in both matchLabelKeys and labelSelector.
    Also, matchLabelKeys cannot be set when labelSelector isn't set.
    This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
    """
    mismatch_label_keys: Annotated[Optional[List[str]], Field(alias="mismatchLabelKeys")] = None
    """
    MismatchLabelKeys is a set of pod label keys to select which pods will
    be taken into consideration. The keys are used to lookup values from the
    incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
    to select the group of existing pods which pods will be taken into consideration
    for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
    pod labels will be ignored. The default value is empty.
    The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
    Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
    This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
    """
    namespace_selector: Annotated[Optional[NamespaceSelector], Field(alias="namespaceSelector")] = (
        None
    )
    """
    A label query over the set of namespaces that the term applies to.
    The term is applied to the union of the namespaces selected by this field
    and the ones listed in the namespaces field.
    null selector and null or empty namespaces list means "this pod's namespace".
    An empty selector ({}) matches all namespaces.
    """
    namespaces: Optional[List[str]] = None
    """
    namespaces specifies a static list of namespace names that the term applies to.
    The term is applied to the union of the namespaces listed in this field
    and the ones selected by namespaceSelector.
    null or empty namespaces list and null namespaceSelector means "this pod's namespace".
    """
    topology_key: Annotated[str, Field(alias="topologyKey")]
    """
    This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
    the labelSelector in the specified namespaces, where co-located is defined as running on a node
    whose value of the label with key topologyKey matches that of any node on which any of the
    selected pods is running.
    Empty topologyKey is not allowed.
    """


class PreferredDuringSchedulingIgnoredDuringExecutionModel(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PreferredDuringSchedulingIgnoredDuringExecutionModel"]:
            return PreferredDuringSchedulingIgnoredDuringExecutionModel

        def build(self) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel":
            return PreferredDuringSchedulingIgnoredDuringExecutionModel(**self._attrs)

        @overload
        def pod_affinity_term(
            self, value_or_callback: PodAffinityTerm, /
        ) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder": ...

        @overload
        def pod_affinity_term(
            self,
            value_or_callback: Callable[
                [PodAffinityTerm.Builder], PodAffinityTerm.Builder | PodAffinityTerm
            ],
            /,
        ) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder": ...

        @overload
        def pod_affinity_term(
            self, value_or_callback: Never = ...
        ) -> "PodAffinityTerm.BuilderContext": ...

        def pod_affinity_term(self, value_or_callback=None, /):
            """
            Required. A pod affinity term, associated with the corresponding weight.
            """
            if self._in_context and value_or_callback is None:
                context = PodAffinityTerm.BuilderContext()
                context._parent_builder = self
                context._field_name = "pod_affinity_term"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodAffinityTerm.builder())
                if isinstance(output, PodAffinityTerm.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("pod_affinity_term", value)

        def weight(self, value: int, /) -> Self:
            """
            weight associated with matching the corresponding podAffinityTerm,
            in the range 1-100.
            """
            return self._set("weight", value)

    class BuilderContext(
        BuilderContextBase["PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PreferredDuringSchedulingIgnoredDuringExecutionModel."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["PreferredDuringSchedulingIgnoredDuringExecutionModel", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PreferredDuringSchedulingIgnoredDuringExecutionModel.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    pod_affinity_term: Annotated[PodAffinityTerm, Field(alias="podAffinityTerm")]
    """
    Required. A pod affinity term, associated with the corresponding weight.
    """
    weight: int
    """
    weight associated with matching the corresponding podAffinityTerm,
    in the range 1-100.
    """


class RequiredDuringSchedulingIgnoredDuringExecutionModel(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["RequiredDuringSchedulingIgnoredDuringExecutionModel"]:
            return RequiredDuringSchedulingIgnoredDuringExecutionModel

        def build(self) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel":
            return RequiredDuringSchedulingIgnoredDuringExecutionModel(**self._attrs)

        @overload
        def label_selector(
            self, value_or_callback: Optional[LabelSelector], /
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder": ...

        @overload
        def label_selector(
            self,
            value_or_callback: Callable[
                [LabelSelector.Builder], LabelSelector.Builder | LabelSelector
            ],
            /,
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder": ...

        @overload
        def label_selector(
            self, value_or_callback: Never = ...
        ) -> "LabelSelector.BuilderContext": ...

        def label_selector(self, value_or_callback=None, /):
            """
            A label query over a set of resources, in this case pods.
            If it's null, this PodAffinityTerm matches with no Pods.
            """
            if self._in_context and value_or_callback is None:
                context = LabelSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "label_selector"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(LabelSelector.builder())
                if isinstance(output, LabelSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("label_selector", value)

        def match_label_keys(self, value: Optional[List[str]], /) -> Self:
            """
            MatchLabelKeys is a set of pod label keys to select which pods will
            be taken into consideration. The keys are used to lookup values from the
            incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
            to select the group of existing pods which pods will be taken into consideration
            for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
            pod labels will be ignored. The default value is empty.
            The same key is forbidden to exist in both matchLabelKeys and labelSelector.
            Also, matchLabelKeys cannot be set when labelSelector isn't set.
            This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
            """
            return self._set("match_label_keys", value)

        def mismatch_label_keys(self, value: Optional[List[str]], /) -> Self:
            """
            MismatchLabelKeys is a set of pod label keys to select which pods will
            be taken into consideration. The keys are used to lookup values from the
            incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
            to select the group of existing pods which pods will be taken into consideration
            for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
            pod labels will be ignored. The default value is empty.
            The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
            Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
            This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
            """
            return self._set("mismatch_label_keys", value)

        @overload
        def namespace_selector(
            self, value_or_callback: Optional[NamespaceSelector], /
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder": ...

        @overload
        def namespace_selector(
            self,
            value_or_callback: Callable[
                [NamespaceSelector.Builder],
                NamespaceSelector.Builder | NamespaceSelector,
            ],
            /,
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder": ...

        @overload
        def namespace_selector(
            self, value_or_callback: Never = ...
        ) -> "NamespaceSelector.BuilderContext": ...

        def namespace_selector(self, value_or_callback=None, /):
            """
            A label query over the set of namespaces that the term applies to.
            The term is applied to the union of the namespaces selected by this field
            and the ones listed in the namespaces field.
            null selector and null or empty namespaces list means "this pod's namespace".
            An empty selector ({}) matches all namespaces.
            """
            if self._in_context and value_or_callback is None:
                context = NamespaceSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "namespace_selector"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(NamespaceSelector.builder())
                if isinstance(output, NamespaceSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("namespace_selector", value)

        def namespaces(self, value: Optional[List[str]], /) -> Self:
            """
            namespaces specifies a static list of namespace names that the term applies to.
            The term is applied to the union of the namespaces listed in this field
            and the ones selected by namespaceSelector.
            null or empty namespaces list and null namespaceSelector means "this pod's namespace".
            """
            return self._set("namespaces", value)

        def topology_key(self, value: str, /) -> Self:
            """
            This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
            the labelSelector in the specified namespaces, where co-located is defined as running on a node
            whose value of the label with key topologyKey matches that of any node on which any of the
            selected pods is running.
            Empty topologyKey is not allowed.
            """
            return self._set("topology_key", value)

    class BuilderContext(
        BuilderContextBase["RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for RequiredDuringSchedulingIgnoredDuringExecutionModel."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["RequiredDuringSchedulingIgnoredDuringExecutionModel", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use RequiredDuringSchedulingIgnoredDuringExecutionModel.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    label_selector: Annotated[Optional[LabelSelector], Field(alias="labelSelector")] = None
    """
    A label query over a set of resources, in this case pods.
    If it's null, this PodAffinityTerm matches with no Pods.
    """
    match_label_keys: Annotated[Optional[List[str]], Field(alias="matchLabelKeys")] = None
    """
    MatchLabelKeys is a set of pod label keys to select which pods will
    be taken into consideration. The keys are used to lookup values from the
    incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
    to select the group of existing pods which pods will be taken into consideration
    for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
    pod labels will be ignored. The default value is empty.
    The same key is forbidden to exist in both matchLabelKeys and labelSelector.
    Also, matchLabelKeys cannot be set when labelSelector isn't set.
    This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
    """
    mismatch_label_keys: Annotated[Optional[List[str]], Field(alias="mismatchLabelKeys")] = None
    """
    MismatchLabelKeys is a set of pod label keys to select which pods will
    be taken into consideration. The keys are used to lookup values from the
    incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
    to select the group of existing pods which pods will be taken into consideration
    for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
    pod labels will be ignored. The default value is empty.
    The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
    Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
    This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
    """
    namespace_selector: Annotated[Optional[NamespaceSelector], Field(alias="namespaceSelector")] = (
        None
    )
    """
    A label query over the set of namespaces that the term applies to.
    The term is applied to the union of the namespaces selected by this field
    and the ones listed in the namespaces field.
    null selector and null or empty namespaces list means "this pod's namespace".
    An empty selector ({}) matches all namespaces.
    """
    namespaces: Optional[List[str]] = None
    """
    namespaces specifies a static list of namespace names that the term applies to.
    The term is applied to the union of the namespaces listed in this field
    and the ones selected by namespaceSelector.
    null or empty namespaces list and null namespaceSelector means "this pod's namespace".
    """
    topology_key: Annotated[str, Field(alias="topologyKey")]
    """
    This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
    the labelSelector in the specified namespaces, where co-located is defined as running on a node
    whose value of the label with key topologyKey matches that of any node on which any of the
    selected pods is running.
    Empty topologyKey is not allowed.
    """


class PodAffinity(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PodAffinity"]:
            return PodAffinity

        def build(self) -> "PodAffinity":
            return PodAffinity(**self._attrs)

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: List[PreferredDuringSchedulingIgnoredDuringExecutionModel],
            /,
        ) -> "PodAffinity.Builder": ...

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: Callable[
                [
                    GenericListBuilder[
                        PreferredDuringSchedulingIgnoredDuringExecutionModel,
                        PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                    ]
                ],
                GenericListBuilder[
                    PreferredDuringSchedulingIgnoredDuringExecutionModel,
                    PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                ]
                | List[PreferredDuringSchedulingIgnoredDuringExecutionModel],
            ],
            /,
        ) -> "PodAffinity.Builder": ...

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder]: ...

        def preferred_during_scheduling_ignored_during_execution(self, value_or_callback=None, /):
            """
            The scheduler will prefer to schedule pods to nodes that satisfy
            the affinity expressions specified by this field, but it may choose
            a node that violates one or more of the expressions. The node that is
            most preferred is the one with the greatest sum of weights, i.e.
            for each node that meets all of the scheduling requirements (resource
            request, requiredDuringScheduling affinity expressions, etc.),
            compute a sum by iterating through the elements of this field and adding
            "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the
            node(s) with the highest sum are the most preferred.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[
                    PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder
                ]()
                context._parent_builder = self
                context._field_name = "preferred_during_scheduling_ignored_during_execution"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(
                    PreferredDuringSchedulingIgnoredDuringExecutionModel.list_builder()
                )
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("preferred_during_scheduling_ignored_during_execution", value)

        @overload
        def required_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: List[RequiredDuringSchedulingIgnoredDuringExecutionModel],
            /,
        ) -> "PodAffinity.Builder": ...

        @overload
        def required_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: Callable[
                [
                    GenericListBuilder[
                        RequiredDuringSchedulingIgnoredDuringExecutionModel,
                        RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                    ]
                ],
                GenericListBuilder[
                    RequiredDuringSchedulingIgnoredDuringExecutionModel,
                    RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                ]
                | List[RequiredDuringSchedulingIgnoredDuringExecutionModel],
            ],
            /,
        ) -> "PodAffinity.Builder": ...

        @overload
        def required_during_scheduling_ignored_during_execution(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder]: ...

        def required_during_scheduling_ignored_during_execution(self, value_or_callback=None, /):
            """
            If the affinity requirements specified by this field are not met at
            scheduling time, the pod will not be scheduled onto the node.
            If the affinity requirements specified by this field cease to be met
            at some point during pod execution (e.g. due to a pod label update), the
            system may or may not try to eventually evict the pod from its node.
            When there are multiple elements, the lists of nodes corresponding to each
            podAffinityTerm are intersected, i.e. all terms must be satisfied.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[
                    RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder
                ]()
                context._parent_builder = self
                context._field_name = "required_during_scheduling_ignored_during_execution"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(
                    RequiredDuringSchedulingIgnoredDuringExecutionModel.list_builder()
                )
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("required_during_scheduling_ignored_during_execution", value)

    class BuilderContext(BuilderContextBase["PodAffinity.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = PodAffinity.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PodAffinity."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["PodAffinity", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PodAffinity.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    preferred_during_scheduling_ignored_during_execution: Annotated[
        Optional[List[PreferredDuringSchedulingIgnoredDuringExecutionModel]],
        Field(alias="preferredDuringSchedulingIgnoredDuringExecution"),
    ] = None
    """
    The scheduler will prefer to schedule pods to nodes that satisfy
    the affinity expressions specified by this field, but it may choose
    a node that violates one or more of the expressions. The node that is
    most preferred is the one with the greatest sum of weights, i.e.
    for each node that meets all of the scheduling requirements (resource
    request, requiredDuringScheduling affinity expressions, etc.),
    compute a sum by iterating through the elements of this field and adding
    "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the
    node(s) with the highest sum are the most preferred.
    """
    required_during_scheduling_ignored_during_execution: Annotated[
        Optional[List[RequiredDuringSchedulingIgnoredDuringExecutionModel]],
        Field(alias="requiredDuringSchedulingIgnoredDuringExecution"),
    ] = None
    """
    If the affinity requirements specified by this field are not met at
    scheduling time, the pod will not be scheduled onto the node.
    If the affinity requirements specified by this field cease to be met
    at some point during pod execution (e.g. due to a pod label update), the
    system may or may not try to eventually evict the pod from its node.
    When there are multiple elements, the lists of nodes corresponding to each
    podAffinityTerm are intersected, i.e. all terms must be satisfied.
    """


class PodAntiAffinity(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PodAntiAffinity"]:
            return PodAntiAffinity

        def build(self) -> "PodAntiAffinity":
            return PodAntiAffinity(**self._attrs)

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: List[PreferredDuringSchedulingIgnoredDuringExecutionModel],
            /,
        ) -> "PodAntiAffinity.Builder": ...

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: Callable[
                [
                    GenericListBuilder[
                        PreferredDuringSchedulingIgnoredDuringExecutionModel,
                        PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                    ]
                ],
                GenericListBuilder[
                    PreferredDuringSchedulingIgnoredDuringExecutionModel,
                    PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                ]
                | List[PreferredDuringSchedulingIgnoredDuringExecutionModel],
            ],
            /,
        ) -> "PodAntiAffinity.Builder": ...

        @overload
        def preferred_during_scheduling_ignored_during_execution(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder]: ...

        def preferred_during_scheduling_ignored_during_execution(self, value_or_callback=None, /):
            """
            The scheduler will prefer to schedule pods to nodes that satisfy
            the anti-affinity expressions specified by this field, but it may choose
            a node that violates one or more of the expressions. The node that is
            most preferred is the one with the greatest sum of weights, i.e.
            for each node that meets all of the scheduling requirements (resource
            request, requiredDuringScheduling anti-affinity expressions, etc.),
            compute a sum by iterating through the elements of this field and adding
            "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the
            node(s) with the highest sum are the most preferred.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[
                    PreferredDuringSchedulingIgnoredDuringExecutionModel.Builder
                ]()
                context._parent_builder = self
                context._field_name = "preferred_during_scheduling_ignored_during_execution"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(
                    PreferredDuringSchedulingIgnoredDuringExecutionModel.list_builder()
                )
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("preferred_during_scheduling_ignored_during_execution", value)

        @overload
        def required_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: List[RequiredDuringSchedulingIgnoredDuringExecutionModel],
            /,
        ) -> "PodAntiAffinity.Builder": ...

        @overload
        def required_during_scheduling_ignored_during_execution(
            self,
            value_or_callback: Callable[
                [
                    GenericListBuilder[
                        RequiredDuringSchedulingIgnoredDuringExecutionModel,
                        RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                    ]
                ],
                GenericListBuilder[
                    RequiredDuringSchedulingIgnoredDuringExecutionModel,
                    RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder,
                ]
                | List[RequiredDuringSchedulingIgnoredDuringExecutionModel],
            ],
            /,
        ) -> "PodAntiAffinity.Builder": ...

        @overload
        def required_during_scheduling_ignored_during_execution(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder]: ...

        def required_during_scheduling_ignored_during_execution(self, value_or_callback=None, /):
            """
            If the anti-affinity requirements specified by this field are not met at
            scheduling time, the pod will not be scheduled onto the node.
            If the anti-affinity requirements specified by this field cease to be met
            at some point during pod execution (e.g. due to a pod label update), the
            system may or may not try to eventually evict the pod from its node.
            When there are multiple elements, the lists of nodes corresponding to each
            podAffinityTerm are intersected, i.e. all terms must be satisfied.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[
                    RequiredDuringSchedulingIgnoredDuringExecutionModel.Builder
                ]()
                context._parent_builder = self
                context._field_name = "required_during_scheduling_ignored_during_execution"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(
                    RequiredDuringSchedulingIgnoredDuringExecutionModel.list_builder()
                )
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("required_during_scheduling_ignored_during_execution", value)

    class BuilderContext(BuilderContextBase["PodAntiAffinity.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = PodAntiAffinity.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PodAntiAffinity."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["PodAntiAffinity", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PodAntiAffinity.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    preferred_during_scheduling_ignored_during_execution: Annotated[
        Optional[List[PreferredDuringSchedulingIgnoredDuringExecutionModel]],
        Field(alias="preferredDuringSchedulingIgnoredDuringExecution"),
    ] = None
    """
    The scheduler will prefer to schedule pods to nodes that satisfy
    the anti-affinity expressions specified by this field, but it may choose
    a node that violates one or more of the expressions. The node that is
    most preferred is the one with the greatest sum of weights, i.e.
    for each node that meets all of the scheduling requirements (resource
    request, requiredDuringScheduling anti-affinity expressions, etc.),
    compute a sum by iterating through the elements of this field and adding
    "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the
    node(s) with the highest sum are the most preferred.
    """
    required_during_scheduling_ignored_during_execution: Annotated[
        Optional[List[RequiredDuringSchedulingIgnoredDuringExecutionModel]],
        Field(alias="requiredDuringSchedulingIgnoredDuringExecution"),
    ] = None
    """
    If the anti-affinity requirements specified by this field are not met at
    scheduling time, the pod will not be scheduled onto the node.
    If the anti-affinity requirements specified by this field cease to be met
    at some point during pod execution (e.g. due to a pod label update), the
    system may or may not try to eventually evict the pod from its node.
    When there are multiple elements, the lists of nodes corresponding to each
    podAffinityTerm are intersected, i.e. all terms must be satisfied.
    """


class Affinity(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Affinity"]:
            return Affinity

        def build(self) -> "Affinity":
            return Affinity(**self._attrs)

        @overload
        def node_affinity(
            self, value_or_callback: Optional[NodeAffinity], /
        ) -> "Affinity.Builder": ...

        @overload
        def node_affinity(
            self,
            value_or_callback: Callable[
                [NodeAffinity.Builder], NodeAffinity.Builder | NodeAffinity
            ],
            /,
        ) -> "Affinity.Builder": ...

        @overload
        def node_affinity(
            self, value_or_callback: Never = ...
        ) -> "NodeAffinity.BuilderContext": ...

        def node_affinity(self, value_or_callback=None, /):
            """
            Describes node affinity scheduling rules for the pod.
            """
            if self._in_context and value_or_callback is None:
                context = NodeAffinity.BuilderContext()
                context._parent_builder = self
                context._field_name = "node_affinity"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(NodeAffinity.builder())
                if isinstance(output, NodeAffinity.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("node_affinity", value)

        @overload
        def pod_affinity(
            self, value_or_callback: Optional[PodAffinity], /
        ) -> "Affinity.Builder": ...

        @overload
        def pod_affinity(
            self,
            value_or_callback: Callable[[PodAffinity.Builder], PodAffinity.Builder | PodAffinity],
            /,
        ) -> "Affinity.Builder": ...

        @overload
        def pod_affinity(self, value_or_callback: Never = ...) -> "PodAffinity.BuilderContext": ...

        def pod_affinity(self, value_or_callback=None, /):
            """
            Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).
            """
            if self._in_context and value_or_callback is None:
                context = PodAffinity.BuilderContext()
                context._parent_builder = self
                context._field_name = "pod_affinity"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodAffinity.builder())
                if isinstance(output, PodAffinity.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("pod_affinity", value)

        @overload
        def pod_anti_affinity(
            self, value_or_callback: Optional[PodAntiAffinity], /
        ) -> "Affinity.Builder": ...

        @overload
        def pod_anti_affinity(
            self,
            value_or_callback: Callable[
                [PodAntiAffinity.Builder], PodAntiAffinity.Builder | PodAntiAffinity
            ],
            /,
        ) -> "Affinity.Builder": ...

        @overload
        def pod_anti_affinity(
            self, value_or_callback: Never = ...
        ) -> "PodAntiAffinity.BuilderContext": ...

        def pod_anti_affinity(self, value_or_callback=None, /):
            """
            Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).
            """
            if self._in_context and value_or_callback is None:
                context = PodAntiAffinity.BuilderContext()
                context._parent_builder = self
                context._field_name = "pod_anti_affinity"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodAntiAffinity.builder())
                if isinstance(output, PodAntiAffinity.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("pod_anti_affinity", value)

    class BuilderContext(BuilderContextBase["Affinity.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Affinity.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Affinity."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Affinity", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Affinity.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    node_affinity: Annotated[Optional[NodeAffinity], Field(alias="nodeAffinity")] = None
    """
    Describes node affinity scheduling rules for the pod.
    """
    pod_affinity: Annotated[Optional[PodAffinity], Field(alias="podAffinity")] = None
    """
    Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).
    """
    pod_anti_affinity: Annotated[Optional[PodAntiAffinity], Field(alias="podAntiAffinity")] = None
    """
    Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).
    """


class ImagePullSecret(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ImagePullSecret"]:
            return ImagePullSecret

        def build(self) -> "ImagePullSecret":
            return ImagePullSecret(**self._attrs)

        def name(self, value: Optional[str], /) -> Self:
            """
            Name of the referent.
            This field is effectively required, but due to backwards compatibility is
            allowed to be empty. Instances of this type with an empty value here are
            almost certainly wrong.
            More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ImagePullSecret.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ImagePullSecret.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ImagePullSecret."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ImagePullSecret", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ImagePullSecret.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    name: Optional[str] = ""
    """
    Name of the referent.
    This field is effectively required, but due to backwards compatibility is
    allowed to be empty. Instances of this type with an empty value here are
    almost certainly wrong.
    More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    """


class SeLinuxOptions(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["SeLinuxOptions"]:
            return SeLinuxOptions

        def build(self) -> "SeLinuxOptions":
            return SeLinuxOptions(**self._attrs)

        def level(self, value: Optional[str], /) -> Self:
            """
            Level is SELinux level label that applies to the container.
            """
            return self._set("level", value)

        def role(self, value: Optional[str], /) -> Self:
            """
            Role is a SELinux role label that applies to the container.
            """
            return self._set("role", value)

        def type(self, value: Optional[str], /) -> Self:
            """
            Type is a SELinux type label that applies to the container.
            """
            return self._set("type", value)

        def user(self, value: Optional[str], /) -> Self:
            """
            User is a SELinux user label that applies to the container.
            """
            return self._set("user", value)

    class BuilderContext(BuilderContextBase["SeLinuxOptions.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = SeLinuxOptions.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for SeLinuxOptions."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["SeLinuxOptions", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use SeLinuxOptions.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    level: Optional[str] = None
    """
    Level is SELinux level label that applies to the container.
    """
    role: Optional[str] = None
    """
    Role is a SELinux role label that applies to the container.
    """
    type: Optional[str] = None
    """
    Type is a SELinux type label that applies to the container.
    """
    user: Optional[str] = None
    """
    User is a SELinux user label that applies to the container.
    """


class SeccompProfile(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["SeccompProfile"]:
            return SeccompProfile

        def build(self) -> "SeccompProfile":
            return SeccompProfile(**self._attrs)

        def localhost_profile(self, value: Optional[str], /) -> Self:
            """
            localhostProfile indicates a profile defined in a file on the node should be used.
            The profile must be preconfigured on the node to work.
            Must be a descending path, relative to the kubelet's configured seccomp profile location.
            Must be set if type is "Localhost". Must NOT be set for any other type.
            """
            return self._set("localhost_profile", value)

        def type(self, value: str, /) -> Self:
            """
            type indicates which kind of seccomp profile will be applied.
            Valid options are:

            Localhost - a profile defined in a file on the node should be used.
            RuntimeDefault - the container runtime default profile should be used.
            Unconfined - no profile should be applied.
            """
            return self._set("type", value)

    class BuilderContext(BuilderContextBase["SeccompProfile.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = SeccompProfile.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for SeccompProfile."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["SeccompProfile", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use SeccompProfile.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    localhost_profile: Annotated[Optional[str], Field(alias="localhostProfile")] = None
    """
    localhostProfile indicates a profile defined in a file on the node should be used.
    The profile must be preconfigured on the node to work.
    Must be a descending path, relative to the kubelet's configured seccomp profile location.
    Must be set if type is "Localhost". Must NOT be set for any other type.
    """
    type: str
    """
    type indicates which kind of seccomp profile will be applied.
    Valid options are:

    Localhost - a profile defined in a file on the node should be used.
    RuntimeDefault - the container runtime default profile should be used.
    Unconfined - no profile should be applied.
    """


class Sysctl(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Sysctl"]:
            return Sysctl

        def build(self) -> "Sysctl":
            return Sysctl(**self._attrs)

        def name(self, value: str, /) -> Self:
            """
            Name of a property to set
            """
            return self._set("name", value)

        def value(self, value: str, /) -> Self:
            """
            Value of a property to set
            """
            return self._set("value", value)

    class BuilderContext(BuilderContextBase["Sysctl.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Sysctl.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Sysctl."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Sysctl", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Sysctl.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    name: str
    """
    Name of a property to set
    """
    value: str
    """
    Value of a property to set
    """


class SecurityContext(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["SecurityContext"]:
            return SecurityContext

        def build(self) -> "SecurityContext":
            return SecurityContext(**self._attrs)

        def fs_group(self, value: Optional[int], /) -> Self:
            """
            A special supplemental group that applies to all containers in a pod.
            Some volume types allow the Kubelet to change the ownership of that volume
            to be owned by the pod:

            1. The owning GID will be the FSGroup
            2. The setgid bit is set (new files created in the volume will be owned by FSGroup)
            3. The permission bits are OR'd with rw-rw----

            If unset, the Kubelet will not modify the ownership and permissions of any volume.
            Note that this field cannot be set when spec.os.name is windows.
            """
            return self._set("fs_group", value)

        def fs_group_change_policy(self, value: Optional[str], /) -> Self:
            """
            fsGroupChangePolicy defines behavior of changing ownership and permission of the volume
            before being exposed inside Pod. This field will only apply to
            volume types which support fsGroup based ownership(and permissions).
            It will have no effect on ephemeral volume types such as: secret, configmaps
            and emptydir.
            Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used.
            Note that this field cannot be set when spec.os.name is windows.
            """
            return self._set("fs_group_change_policy", value)

        def run_as_group(self, value: Optional[int], /) -> Self:
            """
            The GID to run the entrypoint of the container process.
            Uses runtime default if unset.
            May also be set in SecurityContext.  If set in both SecurityContext and
            PodSecurityContext, the value specified in SecurityContext takes precedence
            for that container.
            Note that this field cannot be set when spec.os.name is windows.
            """
            return self._set("run_as_group", value)

        def run_as_non_root(self, value: Optional[bool], /) -> Self:
            """
            Indicates that the container must run as a non-root user.
            If true, the Kubelet will validate the image at runtime to ensure that it
            does not run as UID 0 (root) and fail to start the container if it does.
            If unset or false, no such validation will be performed.
            May also be set in SecurityContext.  If set in both SecurityContext and
            PodSecurityContext, the value specified in SecurityContext takes precedence.
            """
            return self._set("run_as_non_root", value)

        def run_as_user(self, value: Optional[int], /) -> Self:
            """
            The UID to run the entrypoint of the container process.
            Defaults to user specified in image metadata if unspecified.
            May also be set in SecurityContext.  If set in both SecurityContext and
            PodSecurityContext, the value specified in SecurityContext takes precedence
            for that container.
            Note that this field cannot be set when spec.os.name is windows.
            """
            return self._set("run_as_user", value)

        @overload
        def se_linux_options(
            self, value_or_callback: Optional[SeLinuxOptions], /
        ) -> "SecurityContext.Builder": ...

        @overload
        def se_linux_options(
            self,
            value_or_callback: Callable[
                [SeLinuxOptions.Builder], SeLinuxOptions.Builder | SeLinuxOptions
            ],
            /,
        ) -> "SecurityContext.Builder": ...

        @overload
        def se_linux_options(
            self, value_or_callback: Never = ...
        ) -> "SeLinuxOptions.BuilderContext": ...

        def se_linux_options(self, value_or_callback=None, /):
            """
            The SELinux context to be applied to all containers.
            If unspecified, the container runtime will allocate a random SELinux context for each
            container.  May also be set in SecurityContext.  If set in
            both SecurityContext and PodSecurityContext, the value specified in SecurityContext
            takes precedence for that container.
            Note that this field cannot be set when spec.os.name is windows.
            """
            if self._in_context and value_or_callback is None:
                context = SeLinuxOptions.BuilderContext()
                context._parent_builder = self
                context._field_name = "se_linux_options"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(SeLinuxOptions.builder())
                if isinstance(output, SeLinuxOptions.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("se_linux_options", value)

        @overload
        def seccomp_profile(
            self, value_or_callback: Optional[SeccompProfile], /
        ) -> "SecurityContext.Builder": ...

        @overload
        def seccomp_profile(
            self,
            value_or_callback: Callable[
                [SeccompProfile.Builder], SeccompProfile.Builder | SeccompProfile
            ],
            /,
        ) -> "SecurityContext.Builder": ...

        @overload
        def seccomp_profile(
            self, value_or_callback: Never = ...
        ) -> "SeccompProfile.BuilderContext": ...

        def seccomp_profile(self, value_or_callback=None, /):
            """
            The seccomp options to use by the containers in this pod.
            Note that this field cannot be set when spec.os.name is windows.
            """
            if self._in_context and value_or_callback is None:
                context = SeccompProfile.BuilderContext()
                context._parent_builder = self
                context._field_name = "seccomp_profile"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(SeccompProfile.builder())
                if isinstance(output, SeccompProfile.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("seccomp_profile", value)

        def supplemental_groups(self, value: Optional[List[int]], /) -> Self:
            """
            A list of groups applied to the first process run in each container, in addition
            to the container's primary GID, the fsGroup (if specified), and group memberships
            defined in the container image for the uid of the container process. If unspecified,
            no additional groups are added to any container. Note that group memberships
            defined in the container image for the uid of the container process are still effective,
            even if they are not included in this list.
            Note that this field cannot be set when spec.os.name is windows.
            """
            return self._set("supplemental_groups", value)

        @overload
        def sysctls(self, value_or_callback: List[Sysctl], /) -> "SecurityContext.Builder": ...

        @overload
        def sysctls(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[Sysctl, Sysctl.Builder]],
                GenericListBuilder[Sysctl, Sysctl.Builder] | List[Sysctl],
            ],
            /,
        ) -> "SecurityContext.Builder": ...

        @overload
        def sysctls(self, value_or_callback: Never = ...) -> ListBuilderContext[Sysctl.Builder]: ...

        def sysctls(self, value_or_callback=None, /):
            """
            Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported
            sysctls (by the container runtime) might fail to launch.
            Note that this field cannot be set when spec.os.name is windows.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[Sysctl.Builder]()
                context._parent_builder = self
                context._field_name = "sysctls"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Sysctl.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("sysctls", value)

    class BuilderContext(BuilderContextBase["SecurityContext.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = SecurityContext.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for SecurityContext."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["SecurityContext", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use SecurityContext.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    fs_group: Annotated[Optional[int], Field(alias="fsGroup")] = None
    """
    A special supplemental group that applies to all containers in a pod.
    Some volume types allow the Kubelet to change the ownership of that volume
    to be owned by the pod:

    1. The owning GID will be the FSGroup
    2. The setgid bit is set (new files created in the volume will be owned by FSGroup)
    3. The permission bits are OR'd with rw-rw----

    If unset, the Kubelet will not modify the ownership and permissions of any volume.
    Note that this field cannot be set when spec.os.name is windows.
    """
    fs_group_change_policy: Annotated[Optional[str], Field(alias="fsGroupChangePolicy")] = None
    """
    fsGroupChangePolicy defines behavior of changing ownership and permission of the volume
    before being exposed inside Pod. This field will only apply to
    volume types which support fsGroup based ownership(and permissions).
    It will have no effect on ephemeral volume types such as: secret, configmaps
    and emptydir.
    Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used.
    Note that this field cannot be set when spec.os.name is windows.
    """
    run_as_group: Annotated[Optional[int], Field(alias="runAsGroup")] = None
    """
    The GID to run the entrypoint of the container process.
    Uses runtime default if unset.
    May also be set in SecurityContext.  If set in both SecurityContext and
    PodSecurityContext, the value specified in SecurityContext takes precedence
    for that container.
    Note that this field cannot be set when spec.os.name is windows.
    """
    run_as_non_root: Annotated[Optional[bool], Field(alias="runAsNonRoot")] = None
    """
    Indicates that the container must run as a non-root user.
    If true, the Kubelet will validate the image at runtime to ensure that it
    does not run as UID 0 (root) and fail to start the container if it does.
    If unset or false, no such validation will be performed.
    May also be set in SecurityContext.  If set in both SecurityContext and
    PodSecurityContext, the value specified in SecurityContext takes precedence.
    """
    run_as_user: Annotated[Optional[int], Field(alias="runAsUser")] = None
    """
    The UID to run the entrypoint of the container process.
    Defaults to user specified in image metadata if unspecified.
    May also be set in SecurityContext.  If set in both SecurityContext and
    PodSecurityContext, the value specified in SecurityContext takes precedence
    for that container.
    Note that this field cannot be set when spec.os.name is windows.
    """
    se_linux_options: Annotated[Optional[SeLinuxOptions], Field(alias="seLinuxOptions")] = None
    """
    The SELinux context to be applied to all containers.
    If unspecified, the container runtime will allocate a random SELinux context for each
    container.  May also be set in SecurityContext.  If set in
    both SecurityContext and PodSecurityContext, the value specified in SecurityContext
    takes precedence for that container.
    Note that this field cannot be set when spec.os.name is windows.
    """
    seccomp_profile: Annotated[Optional[SeccompProfile], Field(alias="seccompProfile")] = None
    """
    The seccomp options to use by the containers in this pod.
    Note that this field cannot be set when spec.os.name is windows.
    """
    supplemental_groups: Annotated[Optional[List[int]], Field(alias="supplementalGroups")] = None
    """
    A list of groups applied to the first process run in each container, in addition
    to the container's primary GID, the fsGroup (if specified), and group memberships
    defined in the container image for the uid of the container process. If unspecified,
    no additional groups are added to any container. Note that group memberships
    defined in the container image for the uid of the container process are still effective,
    even if they are not included in this list.
    Note that this field cannot be set when spec.os.name is windows.
    """
    sysctls: Optional[List[Sysctl]] = None
    """
    Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported
    sysctls (by the container runtime) might fail to launch.
    Note that this field cannot be set when spec.os.name is windows.
    """


class Toleration(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Toleration"]:
            return Toleration

        def build(self) -> "Toleration":
            return Toleration(**self._attrs)

        def effect(self, value: Optional[str], /) -> Self:
            """
            Effect indicates the taint effect to match. Empty means match all taint effects.
            When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
            """
            return self._set("effect", value)

        def key(self, value: Optional[str], /) -> Self:
            """
            Key is the taint key that the toleration applies to. Empty means match all taint keys.
            If the key is empty, operator must be Exists; this combination means to match all values and all keys.
            """
            return self._set("key", value)

        def operator(self, value: Optional[str], /) -> Self:
            """
            Operator represents a key's relationship to the value.
            Valid operators are Exists and Equal. Defaults to Equal.
            Exists is equivalent to wildcard for value, so that a pod can
            tolerate all taints of a particular category.
            """
            return self._set("operator", value)

        def toleration_seconds(self, value: Optional[int], /) -> Self:
            """
            TolerationSeconds represents the period of time the toleration (which must be
            of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
            it is not set, which means tolerate the taint forever (do not evict). Zero and
            negative values will be treated as 0 (evict immediately) by the system.
            """
            return self._set("toleration_seconds", value)

        def value(self, value: Optional[str], /) -> Self:
            """
            Value is the taint value the toleration matches to.
            If the operator is Exists, the value should be empty, otherwise just a regular string.
            """
            return self._set("value", value)

    class BuilderContext(BuilderContextBase["Toleration.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Toleration.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Toleration."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Toleration", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Toleration.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    effect: Optional[str] = None
    """
    Effect indicates the taint effect to match. Empty means match all taint effects.
    When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
    """
    key: Optional[str] = None
    """
    Key is the taint key that the toleration applies to. Empty means match all taint keys.
    If the key is empty, operator must be Exists; this combination means to match all values and all keys.
    """
    operator: Optional[str] = None
    """
    Operator represents a key's relationship to the value.
    Valid operators are Exists and Equal. Defaults to Equal.
    Exists is equivalent to wildcard for value, so that a pod can
    tolerate all taints of a particular category.
    """
    toleration_seconds: Annotated[Optional[int], Field(alias="tolerationSeconds")] = None
    """
    TolerationSeconds represents the period of time the toleration (which must be
    of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
    it is not set, which means tolerate the taint forever (do not evict). Zero and
    negative values will be treated as 0 (evict immediately) by the system.
    """
    value: Optional[str] = None
    """
    Value is the taint value the toleration matches to.
    If the operator is Exists, the value should be empty, otherwise just a regular string.
    """


class Spec(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Spec"]:
            return Spec

        def build(self) -> "Spec":
            return Spec(**self._attrs)

        @overload
        def affinity(self, value_or_callback: Optional[Affinity], /) -> "Spec.Builder": ...

        @overload
        def affinity(
            self,
            value_or_callback: Callable[[Affinity.Builder], Affinity.Builder | Affinity],
            /,
        ) -> "Spec.Builder": ...

        @overload
        def affinity(self, value_or_callback: Never = ...) -> "Affinity.BuilderContext": ...

        def affinity(self, value_or_callback=None, /):
            """
            If specified, the pod's scheduling constraints
            """
            if self._in_context and value_or_callback is None:
                context = Affinity.BuilderContext()
                context._parent_builder = self
                context._field_name = "affinity"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Affinity.builder())
                if isinstance(output, Affinity.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("affinity", value)

        @overload
        def image_pull_secrets(
            self, value_or_callback: List[ImagePullSecret], /
        ) -> "Spec.Builder": ...

        @overload
        def image_pull_secrets(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[ImagePullSecret, ImagePullSecret.Builder]],
                GenericListBuilder[ImagePullSecret, ImagePullSecret.Builder]
                | List[ImagePullSecret],
            ],
            /,
        ) -> "Spec.Builder": ...

        @overload
        def image_pull_secrets(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[ImagePullSecret.Builder]: ...

        def image_pull_secrets(self, value_or_callback=None, /):
            """
            If specified, the pod's imagePullSecrets
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[ImagePullSecret.Builder]()
                context._parent_builder = self
                context._field_name = "image_pull_secrets"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ImagePullSecret.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("image_pull_secrets", value)

        def node_selector(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            NodeSelector is a selector which must be true for the pod to fit on a node.
            Selector which must match a node's labels for the pod to be scheduled on that node.
            More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
            """
            return self._set("node_selector", value)

        def priority_class_name(self, value: Optional[str], /) -> Self:
            """
            If specified, the pod's priorityClassName.
            """
            return self._set("priority_class_name", value)

        @overload
        def security_context(
            self, value_or_callback: Optional[SecurityContext], /
        ) -> "Spec.Builder": ...

        @overload
        def security_context(
            self,
            value_or_callback: Callable[
                [SecurityContext.Builder], SecurityContext.Builder | SecurityContext
            ],
            /,
        ) -> "Spec.Builder": ...

        @overload
        def security_context(
            self, value_or_callback: Never = ...
        ) -> "SecurityContext.BuilderContext": ...

        def security_context(self, value_or_callback=None, /):
            """
            If specified, the pod's security context
            """
            if self._in_context and value_or_callback is None:
                context = SecurityContext.BuilderContext()
                context._parent_builder = self
                context._field_name = "security_context"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(SecurityContext.builder())
                if isinstance(output, SecurityContext.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("security_context", value)

        def service_account_name(self, value: Optional[str], /) -> Self:
            """
            If specified, the pod's service account
            """
            return self._set("service_account_name", value)

        @overload
        def tolerations(self, value_or_callback: List[Toleration], /) -> "Spec.Builder": ...

        @overload
        def tolerations(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[Toleration, Toleration.Builder]],
                GenericListBuilder[Toleration, Toleration.Builder] | List[Toleration],
            ],
            /,
        ) -> "Spec.Builder": ...

        @overload
        def tolerations(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[Toleration.Builder]: ...

        def tolerations(self, value_or_callback=None, /):
            """
            If specified, the pod's tolerations.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[Toleration.Builder]()
                context._parent_builder = self
                context._field_name = "tolerations"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Toleration.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("tolerations", value)

    class BuilderContext(BuilderContextBase["Spec.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Spec.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Spec."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Spec", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Spec.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    affinity: Optional[Affinity] = None
    """
    If specified, the pod's scheduling constraints
    """
    image_pull_secrets: Annotated[
        Optional[List[ImagePullSecret]], Field(alias="imagePullSecrets")
    ] = None
    """
    If specified, the pod's imagePullSecrets
    """
    node_selector: Annotated[Optional[Dict[str, str]], Field(alias="nodeSelector")] = None
    """
    NodeSelector is a selector which must be true for the pod to fit on a node.
    Selector which must match a node's labels for the pod to be scheduled on that node.
    More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
    """
    priority_class_name: Annotated[Optional[str], Field(alias="priorityClassName")] = None
    """
    If specified, the pod's priorityClassName.
    """
    security_context: Annotated[Optional[SecurityContext], Field(alias="securityContext")] = None
    """
    If specified, the pod's security context
    """
    service_account_name: Annotated[Optional[str], Field(alias="serviceAccountName")] = None
    """
    If specified, the pod's service account
    """
    tolerations: Optional[List[Toleration]] = None
    """
    If specified, the pod's tolerations.
    """


class PodTemplate(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PodTemplate"]:
            return PodTemplate

        def build(self) -> "PodTemplate":
            return PodTemplate(**self._attrs)

        @overload
        def metadata(self, value_or_callback: Optional[Metadata], /) -> "PodTemplate.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[[Metadata.Builder], Metadata.Builder | Metadata],
            /,
        ) -> "PodTemplate.Builder": ...

        @overload
        def metadata(self, value_or_callback: Never = ...) -> "Metadata.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            """
            ObjectMeta overrides for the pod used to solve HTTP01 challenges.
            Only the 'labels' and 'annotations' fields may be set.
            If labels or annotations overlap with in-built values, the values here
            will override the in-built values.
            """
            if self._in_context and value_or_callback is None:
                context = Metadata.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Metadata.builder())
                if isinstance(output, Metadata.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def spec(self, value_or_callback: Optional[Spec], /) -> "PodTemplate.Builder": ...

        @overload
        def spec(
            self, value_or_callback: Callable[[Spec.Builder], Spec.Builder | Spec], /
        ) -> "PodTemplate.Builder": ...

        @overload
        def spec(self, value_or_callback: Never = ...) -> "Spec.BuilderContext": ...

        def spec(self, value_or_callback=None, /):
            """
            PodSpec defines overrides for the HTTP01 challenge solver pod.
            Check ACMEChallengeSolverHTTP01IngressPodSpec to find out currently supported fields.
            All other fields will be ignored.
            """
            if self._in_context and value_or_callback is None:
                context = Spec.BuilderContext()
                context._parent_builder = self
                context._field_name = "spec"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Spec.builder())
                if isinstance(output, Spec.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("spec", value)

    class BuilderContext(BuilderContextBase["PodTemplate.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = PodTemplate.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PodTemplate."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["PodTemplate", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PodTemplate.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    metadata: Optional[Metadata] = None
    """
    ObjectMeta overrides for the pod used to solve HTTP01 challenges.
    Only the 'labels' and 'annotations' fields may be set.
    If labels or annotations overlap with in-built values, the values here
    will override the in-built values.
    """
    spec: Optional[Spec] = None
    """
    PodSpec defines overrides for the HTTP01 challenge solver pod.
    Check ACMEChallengeSolverHTTP01IngressPodSpec to find out currently supported fields.
    All other fields will be ignored.
    """


class GatewayHttpRoute(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["GatewayHttpRoute"]:
            return GatewayHttpRoute

        def build(self) -> "GatewayHttpRoute":
            return GatewayHttpRoute(**self._attrs)

        def labels(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            Custom labels that will be applied to HTTPRoutes created by cert-manager
            while solving HTTP-01 challenges.
            """
            return self._set("labels", value)

        @overload
        def parent_refs(
            self, value_or_callback: List[ParentRef], /
        ) -> "GatewayHttpRoute.Builder": ...

        @overload
        def parent_refs(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[ParentRef, ParentRef.Builder]],
                GenericListBuilder[ParentRef, ParentRef.Builder] | List[ParentRef],
            ],
            /,
        ) -> "GatewayHttpRoute.Builder": ...

        @overload
        def parent_refs(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[ParentRef.Builder]: ...

        def parent_refs(self, value_or_callback=None, /):
            """
            When solving an HTTP-01 challenge, cert-manager creates an HTTPRoute.
            cert-manager needs to know which parentRefs should be used when creating
            the HTTPRoute. Usually, the parentRef references a Gateway. See:
            https://gateway-api.sigs.k8s.io/api-types/httproute/#attaching-to-gateways
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[ParentRef.Builder]()
                context._parent_builder = self
                context._field_name = "parent_refs"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ParentRef.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("parent_refs", value)

        @overload
        def pod_template(
            self, value_or_callback: Optional[PodTemplate], /
        ) -> "GatewayHttpRoute.Builder": ...

        @overload
        def pod_template(
            self,
            value_or_callback: Callable[[PodTemplate.Builder], PodTemplate.Builder | PodTemplate],
            /,
        ) -> "GatewayHttpRoute.Builder": ...

        @overload
        def pod_template(self, value_or_callback: Never = ...) -> "PodTemplate.BuilderContext": ...

        def pod_template(self, value_or_callback=None, /):
            """
            Optional pod template used to configure the ACME challenge solver pods
            used for HTTP01 challenges.
            """
            if self._in_context and value_or_callback is None:
                context = PodTemplate.BuilderContext()
                context._parent_builder = self
                context._field_name = "pod_template"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodTemplate.builder())
                if isinstance(output, PodTemplate.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("pod_template", value)

        def service_type(self, value: Optional[str], /) -> Self:
            """
            Optional service type for Kubernetes solver service. Supported values
            are NodePort or ClusterIP. If unset, defaults to NodePort.
            """
            return self._set("service_type", value)

    class BuilderContext(BuilderContextBase["GatewayHttpRoute.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = GatewayHttpRoute.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for GatewayHttpRoute."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["GatewayHttpRoute", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use GatewayHttpRoute.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    labels: Optional[Dict[str, str]] = None
    """
    Custom labels that will be applied to HTTPRoutes created by cert-manager
    while solving HTTP-01 challenges.
    """
    parent_refs: Annotated[Optional[List[ParentRef]], Field(alias="parentRefs")] = None
    """
    When solving an HTTP-01 challenge, cert-manager creates an HTTPRoute.
    cert-manager needs to know which parentRefs should be used when creating
    the HTTPRoute. Usually, the parentRef references a Gateway. See:
    https://gateway-api.sigs.k8s.io/api-types/httproute/#attaching-to-gateways
    """
    pod_template: Annotated[Optional[PodTemplate], Field(alias="podTemplate")] = None
    """
    Optional pod template used to configure the ACME challenge solver pods
    used for HTTP01 challenges.
    """
    service_type: Annotated[Optional[str], Field(alias="serviceType")] = None
    """
    Optional service type for Kubernetes solver service. Supported values
    are NodePort or ClusterIP. If unset, defaults to NodePort.
    """


class MetadataModel(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["MetadataModel"]:
            return MetadataModel

        def build(self) -> "MetadataModel":
            return MetadataModel(**self._attrs)

        def annotations(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            Annotations that should be added to the created ACME HTTP01 solver ingress.
            """
            return self._set("annotations", value)

        def labels(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            Labels that should be added to the created ACME HTTP01 solver ingress.
            """
            return self._set("labels", value)

    class BuilderContext(BuilderContextBase["MetadataModel.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = MetadataModel.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for MetadataModel."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["MetadataModel", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use MetadataModel.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    annotations: Optional[Dict[str, str]] = None
    """
    Annotations that should be added to the created ACME HTTP01 solver ingress.
    """
    labels: Optional[Dict[str, str]] = None
    """
    Labels that should be added to the created ACME HTTP01 solver ingress.
    """


class IngressTemplate(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["IngressTemplate"]:
            return IngressTemplate

        def build(self) -> "IngressTemplate":
            return IngressTemplate(**self._attrs)

        @overload
        def metadata(
            self, value_or_callback: Optional[MetadataModel], /
        ) -> "IngressTemplate.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [MetadataModel.Builder], MetadataModel.Builder | MetadataModel
            ],
            /,
        ) -> "IngressTemplate.Builder": ...

        @overload
        def metadata(self, value_or_callback: Never = ...) -> "MetadataModel.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            """
            ObjectMeta overrides for the ingress used to solve HTTP01 challenges.
            Only the 'labels' and 'annotations' fields may be set.
            If labels or annotations overlap with in-built values, the values here
            will override the in-built values.
            """
            if self._in_context and value_or_callback is None:
                context = MetadataModel.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(MetadataModel.builder())
                if isinstance(output, MetadataModel.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

    class BuilderContext(BuilderContextBase["IngressTemplate.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = IngressTemplate.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for IngressTemplate."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["IngressTemplate", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use IngressTemplate.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    metadata: Optional[MetadataModel] = None
    """
    ObjectMeta overrides for the ingress used to solve HTTP01 challenges.
    Only the 'labels' and 'annotations' fields may be set.
    If labels or annotations overlap with in-built values, the values here
    will override the in-built values.
    """


class MetadataModel1(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["MetadataModel1"]:
            return MetadataModel1

        def build(self) -> "MetadataModel1":
            return MetadataModel1(**self._attrs)

        def annotations(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            Annotations that should be added to the created ACME HTTP01 solver pods.
            """
            return self._set("annotations", value)

        def labels(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            Labels that should be added to the created ACME HTTP01 solver pods.
            """
            return self._set("labels", value)

    class BuilderContext(BuilderContextBase["MetadataModel1.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = MetadataModel1.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for MetadataModel1."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["MetadataModel1", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use MetadataModel1.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    annotations: Optional[Dict[str, str]] = None
    """
    Annotations that should be added to the created ACME HTTP01 solver pods.
    """
    labels: Optional[Dict[str, str]] = None
    """
    Labels that should be added to the created ACME HTTP01 solver pods.
    """


class MatchExpressionModel1(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["MatchExpressionModel1"]:
            return MatchExpressionModel1

        def build(self) -> "MatchExpressionModel1":
            return MatchExpressionModel1(**self._attrs)

        def key(self, value: str, /) -> Self:
            """
            The label key that the selector applies to.
            """
            return self._set("key", value)

        def operator(self, value: str, /) -> Self:
            """
            Represents a key's relationship to a set of values.
            Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
            """
            return self._set("operator", value)

        def values(self, value: Optional[List[str]], /) -> Self:
            """
            An array of string values. If the operator is In or NotIn,
            the values array must be non-empty. If the operator is Exists or DoesNotExist,
            the values array must be empty. If the operator is Gt or Lt, the values
            array must have a single element, which will be interpreted as an integer.
            This array is replaced during a strategic merge patch.
            """
            return self._set("values", value)

    class BuilderContext(BuilderContextBase["MatchExpressionModel1.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = MatchExpressionModel1.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for MatchExpressionModel1."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["MatchExpressionModel1", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use MatchExpressionModel1.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: str
    """
    The label key that the selector applies to.
    """
    operator: str
    """
    Represents a key's relationship to a set of values.
    Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
    """
    values: Optional[List[str]] = None
    """
    An array of string values. If the operator is In or NotIn,
    the values array must be non-empty. If the operator is Exists or DoesNotExist,
    the values array must be empty. If the operator is Gt or Lt, the values
    array must have a single element, which will be interpreted as an integer.
    This array is replaced during a strategic merge patch.
    """


class PreferredDuringSchedulingIgnoredDuringExecutionModel1(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PreferredDuringSchedulingIgnoredDuringExecutionModel1"]:
            return PreferredDuringSchedulingIgnoredDuringExecutionModel1

        def build(self) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel1":
            return PreferredDuringSchedulingIgnoredDuringExecutionModel1(**self._attrs)

        @overload
        def preference(
            self, value_or_callback: Preference, /
        ) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel1.Builder": ...

        @overload
        def preference(
            self,
            value_or_callback: Callable[[Preference.Builder], Preference.Builder | Preference],
            /,
        ) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel1.Builder": ...

        @overload
        def preference(self, value_or_callback: Never = ...) -> "Preference.BuilderContext": ...

        def preference(self, value_or_callback=None, /):
            """
            A node selector term, associated with the corresponding weight.
            """
            if self._in_context and value_or_callback is None:
                context = Preference.BuilderContext()
                context._parent_builder = self
                context._field_name = "preference"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Preference.builder())
                if isinstance(output, Preference.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("preference", value)

        def weight(self, value: int, /) -> Self:
            """
            Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
            """
            return self._set("weight", value)

    class BuilderContext(
        BuilderContextBase["PreferredDuringSchedulingIgnoredDuringExecutionModel1.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = PreferredDuringSchedulingIgnoredDuringExecutionModel1.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PreferredDuringSchedulingIgnoredDuringExecutionModel1."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["PreferredDuringSchedulingIgnoredDuringExecutionModel1", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PreferredDuringSchedulingIgnoredDuringExecutionModel1.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    preference: Preference
    """
    A node selector term, associated with the corresponding weight.
    """
    weight: int
    """
    Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
    """


class RequiredDuringSchedulingIgnoredDuringExecutionModel1(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["RequiredDuringSchedulingIgnoredDuringExecutionModel1"]:
            return RequiredDuringSchedulingIgnoredDuringExecutionModel1

        def build(self) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel1":
            return RequiredDuringSchedulingIgnoredDuringExecutionModel1(**self._attrs)

        @overload
        def node_selector_terms(
            self, value_or_callback: List[NodeSelectorTerm], /
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel1.Builder": ...

        @overload
        def node_selector_terms(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[NodeSelectorTerm, NodeSelectorTerm.Builder]],
                GenericListBuilder[NodeSelectorTerm, NodeSelectorTerm.Builder]
                | List[NodeSelectorTerm],
            ],
            /,
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel1.Builder": ...

        @overload
        def node_selector_terms(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[NodeSelectorTerm.Builder]: ...

        def node_selector_terms(self, value_or_callback=None, /):
            """
            Required. A list of node selector terms. The terms are ORed.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[NodeSelectorTerm.Builder]()
                context._parent_builder = self
                context._field_name = "node_selector_terms"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(NodeSelectorTerm.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("node_selector_terms", value)

    class BuilderContext(
        BuilderContextBase["RequiredDuringSchedulingIgnoredDuringExecutionModel1.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = RequiredDuringSchedulingIgnoredDuringExecutionModel1.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for RequiredDuringSchedulingIgnoredDuringExecutionModel1."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["RequiredDuringSchedulingIgnoredDuringExecutionModel1", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use RequiredDuringSchedulingIgnoredDuringExecutionModel1.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    node_selector_terms: Annotated[List[NodeSelectorTerm], Field(alias="nodeSelectorTerms")]
    """
    Required. A list of node selector terms. The terms are ORed.
    """


class MatchExpressionModel2(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["MatchExpressionModel2"]:
            return MatchExpressionModel2

        def build(self) -> "MatchExpressionModel2":
            return MatchExpressionModel2(**self._attrs)

        def key(self, value: str, /) -> Self:
            """
            key is the label key that the selector applies to.
            """
            return self._set("key", value)

        def operator(self, value: str, /) -> Self:
            """
            operator represents a key's relationship to a set of values.
            Valid operators are In, NotIn, Exists and DoesNotExist.
            """
            return self._set("operator", value)

        def values(self, value: Optional[List[str]], /) -> Self:
            """
            values is an array of string values. If the operator is In or NotIn,
            the values array must be non-empty. If the operator is Exists or DoesNotExist,
            the values array must be empty. This array is replaced during a strategic
            merge patch.
            """
            return self._set("values", value)

    class BuilderContext(BuilderContextBase["MatchExpressionModel2.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = MatchExpressionModel2.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for MatchExpressionModel2."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["MatchExpressionModel2", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use MatchExpressionModel2.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    key: str
    """
    key is the label key that the selector applies to.
    """
    operator: str
    """
    operator represents a key's relationship to a set of values.
    Valid operators are In, NotIn, Exists and DoesNotExist.
    """
    values: Optional[List[str]] = None
    """
    values is an array of string values. If the operator is In or NotIn,
    the values array must be non-empty. If the operator is Exists or DoesNotExist,
    the values array must be empty. This array is replaced during a strategic
    merge patch.
    """


class PreferredDuringSchedulingIgnoredDuringExecutionModel2(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["PreferredDuringSchedulingIgnoredDuringExecutionModel2"]:
            return PreferredDuringSchedulingIgnoredDuringExecutionModel2

        def build(self) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel2":
            return PreferredDuringSchedulingIgnoredDuringExecutionModel2(**self._attrs)

        @overload
        def pod_affinity_term(
            self, value_or_callback: PodAffinityTerm, /
        ) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel2.Builder": ...

        @overload
        def pod_affinity_term(
            self,
            value_or_callback: Callable[
                [PodAffinityTerm.Builder], PodAffinityTerm.Builder | PodAffinityTerm
            ],
            /,
        ) -> "PreferredDuringSchedulingIgnoredDuringExecutionModel2.Builder": ...

        @overload
        def pod_affinity_term(
            self, value_or_callback: Never = ...
        ) -> "PodAffinityTerm.BuilderContext": ...

        def pod_affinity_term(self, value_or_callback=None, /):
            """
            Required. A pod affinity term, associated with the corresponding weight.
            """
            if self._in_context and value_or_callback is None:
                context = PodAffinityTerm.BuilderContext()
                context._parent_builder = self
                context._field_name = "pod_affinity_term"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodAffinityTerm.builder())
                if isinstance(output, PodAffinityTerm.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("pod_affinity_term", value)

        def weight(self, value: int, /) -> Self:
            """
            weight associated with matching the corresponding podAffinityTerm,
            in the range 1-100.
            """
            return self._set("weight", value)

    class BuilderContext(
        BuilderContextBase["PreferredDuringSchedulingIgnoredDuringExecutionModel2.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = PreferredDuringSchedulingIgnoredDuringExecutionModel2.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PreferredDuringSchedulingIgnoredDuringExecutionModel2."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["PreferredDuringSchedulingIgnoredDuringExecutionModel2", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PreferredDuringSchedulingIgnoredDuringExecutionModel2.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    pod_affinity_term: Annotated[PodAffinityTerm, Field(alias="podAffinityTerm")]
    """
    Required. A pod affinity term, associated with the corresponding weight.
    """
    weight: int
    """
    weight associated with matching the corresponding podAffinityTerm,
    in the range 1-100.
    """


class RequiredDuringSchedulingIgnoredDuringExecutionModel2(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["RequiredDuringSchedulingIgnoredDuringExecutionModel2"]:
            return RequiredDuringSchedulingIgnoredDuringExecutionModel2

        def build(self) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel2":
            return RequiredDuringSchedulingIgnoredDuringExecutionModel2(**self._attrs)

        @overload
        def label_selector(
            self, value_or_callback: Optional[LabelSelector], /
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel2.Builder": ...

        @overload
        def label_selector(
            self,
            value_or_callback: Callable[
                [LabelSelector.Builder], LabelSelector.Builder | LabelSelector
            ],
            /,
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel2.Builder": ...

        @overload
        def label_selector(
            self, value_or_callback: Never = ...
        ) -> "LabelSelector.BuilderContext": ...

        def label_selector(self, value_or_callback=None, /):
            """
            A label query over a set of resources, in this case pods.
            If it's null, this PodAffinityTerm matches with no Pods.
            """
            if self._in_context and value_or_callback is None:
                context = LabelSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "label_selector"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(LabelSelector.builder())
                if isinstance(output, LabelSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("label_selector", value)

        def match_label_keys(self, value: Optional[List[str]], /) -> Self:
            """
            MatchLabelKeys is a set of pod label keys to select which pods will
            be taken into consideration. The keys are used to lookup values from the
            incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
            to select the group of existing pods which pods will be taken into consideration
            for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
            pod labels will be ignored. The default value is empty.
            The same key is forbidden to exist in both matchLabelKeys and labelSelector.
            Also, matchLabelKeys cannot be set when labelSelector isn't set.
            This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
            """
            return self._set("match_label_keys", value)

        def mismatch_label_keys(self, value: Optional[List[str]], /) -> Self:
            """
            MismatchLabelKeys is a set of pod label keys to select which pods will
            be taken into consideration. The keys are used to lookup values from the
            incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
            to select the group of existing pods which pods will be taken into consideration
            for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
            pod labels will be ignored. The default value is empty.
            The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
            Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
            This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
            """
            return self._set("mismatch_label_keys", value)

        @overload
        def namespace_selector(
            self, value_or_callback: Optional[NamespaceSelector], /
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel2.Builder": ...

        @overload
        def namespace_selector(
            self,
            value_or_callback: Callable[
                [NamespaceSelector.Builder],
                NamespaceSelector.Builder | NamespaceSelector,
            ],
            /,
        ) -> "RequiredDuringSchedulingIgnoredDuringExecutionModel2.Builder": ...

        @overload
        def namespace_selector(
            self, value_or_callback: Never = ...
        ) -> "NamespaceSelector.BuilderContext": ...

        def namespace_selector(self, value_or_callback=None, /):
            """
            A label query over the set of namespaces that the term applies to.
            The term is applied to the union of the namespaces selected by this field
            and the ones listed in the namespaces field.
            null selector and null or empty namespaces list means "this pod's namespace".
            An empty selector ({}) matches all namespaces.
            """
            if self._in_context and value_or_callback is None:
                context = NamespaceSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "namespace_selector"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(NamespaceSelector.builder())
                if isinstance(output, NamespaceSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("namespace_selector", value)

        def namespaces(self, value: Optional[List[str]], /) -> Self:
            """
            namespaces specifies a static list of namespace names that the term applies to.
            The term is applied to the union of the namespaces listed in this field
            and the ones selected by namespaceSelector.
            null or empty namespaces list and null namespaceSelector means "this pod's namespace".
            """
            return self._set("namespaces", value)

        def topology_key(self, value: str, /) -> Self:
            """
            This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
            the labelSelector in the specified namespaces, where co-located is defined as running on a node
            whose value of the label with key topologyKey matches that of any node on which any of the
            selected pods is running.
            Empty topologyKey is not allowed.
            """
            return self._set("topology_key", value)

    class BuilderContext(
        BuilderContextBase["RequiredDuringSchedulingIgnoredDuringExecutionModel2.Builder"]
    ):
        def model_post_init(self, __context) -> None:
            self._builder = RequiredDuringSchedulingIgnoredDuringExecutionModel2.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for RequiredDuringSchedulingIgnoredDuringExecutionModel2."""
        return cls.BuilderContext()

    class ListBuilder(
        GenericListBuilder["RequiredDuringSchedulingIgnoredDuringExecutionModel2", Builder]
    ):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use RequiredDuringSchedulingIgnoredDuringExecutionModel2.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    label_selector: Annotated[Optional[LabelSelector], Field(alias="labelSelector")] = None
    """
    A label query over a set of resources, in this case pods.
    If it's null, this PodAffinityTerm matches with no Pods.
    """
    match_label_keys: Annotated[Optional[List[str]], Field(alias="matchLabelKeys")] = None
    """
    MatchLabelKeys is a set of pod label keys to select which pods will
    be taken into consideration. The keys are used to lookup values from the
    incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)`
    to select the group of existing pods which pods will be taken into consideration
    for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
    pod labels will be ignored. The default value is empty.
    The same key is forbidden to exist in both matchLabelKeys and labelSelector.
    Also, matchLabelKeys cannot be set when labelSelector isn't set.
    This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
    """
    mismatch_label_keys: Annotated[Optional[List[str]], Field(alias="mismatchLabelKeys")] = None
    """
    MismatchLabelKeys is a set of pod label keys to select which pods will
    be taken into consideration. The keys are used to lookup values from the
    incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)`
    to select the group of existing pods which pods will be taken into consideration
    for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming
    pod labels will be ignored. The default value is empty.
    The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
    Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
    This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
    """
    namespace_selector: Annotated[Optional[NamespaceSelector], Field(alias="namespaceSelector")] = (
        None
    )
    """
    A label query over the set of namespaces that the term applies to.
    The term is applied to the union of the namespaces selected by this field
    and the ones listed in the namespaces field.
    null selector and null or empty namespaces list means "this pod's namespace".
    An empty selector ({}) matches all namespaces.
    """
    namespaces: Optional[List[str]] = None
    """
    namespaces specifies a static list of namespace names that the term applies to.
    The term is applied to the union of the namespaces listed in this field
    and the ones selected by namespaceSelector.
    null or empty namespaces list and null namespaceSelector means "this pod's namespace".
    """
    topology_key: Annotated[str, Field(alias="topologyKey")]
    """
    This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
    the labelSelector in the specified namespaces, where co-located is defined as running on a node
    whose value of the label with key topologyKey matches that of any node on which any of the
    selected pods is running.
    Empty topologyKey is not allowed.
    """


class Ingress(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Ingress"]:
            return Ingress

        def build(self) -> "Ingress":
            return Ingress(**self._attrs)

        def class_(self, value: Optional[str], /) -> Self:
            """
            This field configures the annotation `kubernetes.io/ingress.class` when
            creating Ingress resources to solve ACME challenges that use this
            challenge solver. Only one of `class`, `name` or `ingressClassName` may
            be specified.
            """
            return self._set("class_", value)

        def ingress_class_name(self, value: Optional[str], /) -> Self:
            """
            This field configures the field `ingressClassName` on the created Ingress
            resources used to solve ACME challenges that use this challenge solver.
            This is the recommended way of configuring the ingress class. Only one of
            `class`, `name` or `ingressClassName` may be specified.
            """
            return self._set("ingress_class_name", value)

        @overload
        def ingress_template(
            self, value_or_callback: Optional[IngressTemplate], /
        ) -> "Ingress.Builder": ...

        @overload
        def ingress_template(
            self,
            value_or_callback: Callable[
                [IngressTemplate.Builder], IngressTemplate.Builder | IngressTemplate
            ],
            /,
        ) -> "Ingress.Builder": ...

        @overload
        def ingress_template(
            self, value_or_callback: Never = ...
        ) -> "IngressTemplate.BuilderContext": ...

        def ingress_template(self, value_or_callback=None, /):
            """
            Optional ingress template used to configure the ACME challenge solver
            ingress used for HTTP01 challenges.
            """
            if self._in_context and value_or_callback is None:
                context = IngressTemplate.BuilderContext()
                context._parent_builder = self
                context._field_name = "ingress_template"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(IngressTemplate.builder())
                if isinstance(output, IngressTemplate.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("ingress_template", value)

        def name(self, value: Optional[str], /) -> Self:
            """
            The name of the ingress resource that should have ACME challenge solving
            routes inserted into it in order to solve HTTP01 challenges.
            This is typically used in conjunction with ingress controllers like
            ingress-gce, which maintains a 1:1 mapping between external IPs and
            ingress resources. Only one of `class`, `name` or `ingressClassName` may
            be specified.
            """
            return self._set("name", value)

        @overload
        def pod_template(
            self, value_or_callback: Optional[PodTemplate], /
        ) -> "Ingress.Builder": ...

        @overload
        def pod_template(
            self,
            value_or_callback: Callable[[PodTemplate.Builder], PodTemplate.Builder | PodTemplate],
            /,
        ) -> "Ingress.Builder": ...

        @overload
        def pod_template(self, value_or_callback: Never = ...) -> "PodTemplate.BuilderContext": ...

        def pod_template(self, value_or_callback=None, /):
            """
            Optional pod template used to configure the ACME challenge solver pods
            used for HTTP01 challenges.
            """
            if self._in_context and value_or_callback is None:
                context = PodTemplate.BuilderContext()
                context._parent_builder = self
                context._field_name = "pod_template"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodTemplate.builder())
                if isinstance(output, PodTemplate.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("pod_template", value)

        def service_type(self, value: Optional[str], /) -> Self:
            """
            Optional service type for Kubernetes solver service. Supported values
            are NodePort or ClusterIP. If unset, defaults to NodePort.
            """
            return self._set("service_type", value)

    class BuilderContext(BuilderContextBase["Ingress.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Ingress.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Ingress."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Ingress", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Ingress.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    class_: Annotated[Optional[str], Field(alias="class")] = None
    """
    This field configures the annotation `kubernetes.io/ingress.class` when
    creating Ingress resources to solve ACME challenges that use this
    challenge solver. Only one of `class`, `name` or `ingressClassName` may
    be specified.
    """
    ingress_class_name: Annotated[Optional[str], Field(alias="ingressClassName")] = None
    """
    This field configures the field `ingressClassName` on the created Ingress
    resources used to solve ACME challenges that use this challenge solver.
    This is the recommended way of configuring the ingress class. Only one of
    `class`, `name` or `ingressClassName` may be specified.
    """
    ingress_template: Annotated[Optional[IngressTemplate], Field(alias="ingressTemplate")] = None
    """
    Optional ingress template used to configure the ACME challenge solver
    ingress used for HTTP01 challenges.
    """
    name: Optional[str] = None
    """
    The name of the ingress resource that should have ACME challenge solving
    routes inserted into it in order to solve HTTP01 challenges.
    This is typically used in conjunction with ingress controllers like
    ingress-gce, which maintains a 1:1 mapping between external IPs and
    ingress resources. Only one of `class`, `name` or `ingressClassName` may
    be specified.
    """
    pod_template: Annotated[Optional[PodTemplate], Field(alias="podTemplate")] = None
    """
    Optional pod template used to configure the ACME challenge solver pods
    used for HTTP01 challenges.
    """
    service_type: Annotated[Optional[str], Field(alias="serviceType")] = None
    """
    Optional service type for Kubernetes solver service. Supported values
    are NodePort or ClusterIP. If unset, defaults to NodePort.
    """


class Http01(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Http01"]:
            return Http01

        def build(self) -> "Http01":
            return Http01(**self._attrs)

        @overload
        def gateway_http_route(
            self, value_or_callback: Optional[GatewayHttpRoute], /
        ) -> "Http01.Builder": ...

        @overload
        def gateway_http_route(
            self,
            value_or_callback: Callable[
                [GatewayHttpRoute.Builder], GatewayHttpRoute.Builder | GatewayHttpRoute
            ],
            /,
        ) -> "Http01.Builder": ...

        @overload
        def gateway_http_route(
            self, value_or_callback: Never = ...
        ) -> "GatewayHttpRoute.BuilderContext": ...

        def gateway_http_route(self, value_or_callback=None, /):
            """
            The Gateway API is a sig-network community API that models service networking
            in Kubernetes (https://gateway-api.sigs.k8s.io/). The Gateway solver will
            create HTTPRoutes with the specified labels in the same namespace as the challenge.
            This solver is experimental, and fields / behaviour may change in the future.
            """
            if self._in_context and value_or_callback is None:
                context = GatewayHttpRoute.BuilderContext()
                context._parent_builder = self
                context._field_name = "gateway_http_route"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(GatewayHttpRoute.builder())
                if isinstance(output, GatewayHttpRoute.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("gateway_http_route", value)

        @overload
        def ingress(self, value_or_callback: Optional[Ingress], /) -> "Http01.Builder": ...

        @overload
        def ingress(
            self,
            value_or_callback: Callable[[Ingress.Builder], Ingress.Builder | Ingress],
            /,
        ) -> "Http01.Builder": ...

        @overload
        def ingress(self, value_or_callback: Never = ...) -> "Ingress.BuilderContext": ...

        def ingress(self, value_or_callback=None, /):
            """
            The ingress based HTTP01 challenge solver will solve challenges by
            creating or modifying Ingress resources in order to route requests for
            '/.well-known/acme-challenge/XYZ' to 'challenge solver' pods that are
            provisioned by cert-manager for each Challenge to be completed.
            """
            if self._in_context and value_or_callback is None:
                context = Ingress.BuilderContext()
                context._parent_builder = self
                context._field_name = "ingress"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Ingress.builder())
                if isinstance(output, Ingress.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("ingress", value)

    class BuilderContext(BuilderContextBase["Http01.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Http01.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Http01."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Http01", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Http01.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    gateway_http_route: Annotated[Optional[GatewayHttpRoute], Field(alias="gatewayHTTPRoute")] = (
        None
    )
    """
    The Gateway API is a sig-network community API that models service networking
    in Kubernetes (https://gateway-api.sigs.k8s.io/). The Gateway solver will
    create HTTPRoutes with the specified labels in the same namespace as the challenge.
    This solver is experimental, and fields / behaviour may change in the future.
    """
    ingress: Optional[Ingress] = None
    """
    The ingress based HTTP01 challenge solver will solve challenges by
    creating or modifying Ingress resources in order to route requests for
    '/.well-known/acme-challenge/XYZ' to 'challenge solver' pods that are
    provisioned by cert-manager for each Challenge to be completed.
    """


class Selector(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Selector"]:
            return Selector

        def build(self) -> "Selector":
            return Selector(**self._attrs)

        def dns_names(self, value: Optional[List[str]], /) -> Self:
            """
            List of DNSNames that this solver will be used to solve.
            If specified and a match is found, a dnsNames selector will take
            precedence over a dnsZones selector.
            If multiple solvers match with the same dnsNames value, the solver
            with the most matching labels in matchLabels will be selected.
            If neither has more matches, the solver defined earlier in the list
            will be selected.
            """
            return self._set("dns_names", value)

        def dns_zones(self, value: Optional[List[str]], /) -> Self:
            """
            List of DNSZones that this solver will be used to solve.
            The most specific DNS zone match specified here will take precedence
            over other DNS zone matches, so a solver specifying sys.example.com
            will be selected over one specifying example.com for the domain
            www.sys.example.com.
            If multiple solvers match with the same dnsZones value, the solver
            with the most matching labels in matchLabels will be selected.
            If neither has more matches, the solver defined earlier in the list
            will be selected.
            """
            return self._set("dns_zones", value)

        def match_labels(self, value: Optional[Dict[str, str]], /) -> Self:
            """
            A label selector that is used to refine the set of certificate's that
            this challenge solver will apply to.
            """
            return self._set("match_labels", value)

    class BuilderContext(BuilderContextBase["Selector.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Selector.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Selector."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Selector", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Selector.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    dns_names: Annotated[Optional[List[str]], Field(alias="dnsNames")] = None
    """
    List of DNSNames that this solver will be used to solve.
    If specified and a match is found, a dnsNames selector will take
    precedence over a dnsZones selector.
    If multiple solvers match with the same dnsNames value, the solver
    with the most matching labels in matchLabels will be selected.
    If neither has more matches, the solver defined earlier in the list
    will be selected.
    """
    dns_zones: Annotated[Optional[List[str]], Field(alias="dnsZones")] = None
    """
    List of DNSZones that this solver will be used to solve.
    The most specific DNS zone match specified here will take precedence
    over other DNS zone matches, so a solver specifying sys.example.com
    will be selected over one specifying example.com for the domain
    www.sys.example.com.
    If multiple solvers match with the same dnsZones value, the solver
    with the most matching labels in matchLabels will be selected.
    If neither has more matches, the solver defined earlier in the list
    will be selected.
    """
    match_labels: Annotated[Optional[Dict[str, str]], Field(alias="matchLabels")] = None
    """
    A label selector that is used to refine the set of certificate's that
    this challenge solver will apply to.
    """


class Solver(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Solver"]:
            return Solver

        def build(self) -> "Solver":
            return Solver(**self._attrs)

        @overload
        def dns01(self, value_or_callback: Optional[Dns01], /) -> "Solver.Builder": ...

        @overload
        def dns01(
            self, value_or_callback: Callable[[Dns01.Builder], Dns01.Builder | Dns01], /
        ) -> "Solver.Builder": ...

        @overload
        def dns01(self, value_or_callback: Never = ...) -> "Dns01.BuilderContext": ...

        def dns01(self, value_or_callback=None, /):
            """
            Configures cert-manager to attempt to complete authorizations by
            performing the DNS01 challenge flow.
            """
            if self._in_context and value_or_callback is None:
                context = Dns01.BuilderContext()
                context._parent_builder = self
                context._field_name = "dns01"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Dns01.builder())
                if isinstance(output, Dns01.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("dns01", value)

        @overload
        def http01(self, value_or_callback: Optional[Http01], /) -> "Solver.Builder": ...

        @overload
        def http01(
            self,
            value_or_callback: Callable[[Http01.Builder], Http01.Builder | Http01],
            /,
        ) -> "Solver.Builder": ...

        @overload
        def http01(self, value_or_callback: Never = ...) -> "Http01.BuilderContext": ...

        def http01(self, value_or_callback=None, /):
            """
            Configures cert-manager to attempt to complete authorizations by
            performing the HTTP01 challenge flow.
            It is not possible to obtain certificates for wildcard domain names
            (e.g. `*.example.com`) using the HTTP01 challenge mechanism.
            """
            if self._in_context and value_or_callback is None:
                context = Http01.BuilderContext()
                context._parent_builder = self
                context._field_name = "http01"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Http01.builder())
                if isinstance(output, Http01.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("http01", value)

        @overload
        def selector(self, value_or_callback: Optional[Selector], /) -> "Solver.Builder": ...

        @overload
        def selector(
            self,
            value_or_callback: Callable[[Selector.Builder], Selector.Builder | Selector],
            /,
        ) -> "Solver.Builder": ...

        @overload
        def selector(self, value_or_callback: Never = ...) -> "Selector.BuilderContext": ...

        def selector(self, value_or_callback=None, /):
            """
            Selector selects a set of DNSNames on the Certificate resource that
            should be solved using this challenge solver.
            If not specified, the solver will be treated as the 'default' solver
            with the lowest priority, i.e. if any other solver has a more specific
            match, it will be used instead.
            """
            if self._in_context and value_or_callback is None:
                context = Selector.BuilderContext()
                context._parent_builder = self
                context._field_name = "selector"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Selector.builder())
                if isinstance(output, Selector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("selector", value)

    class BuilderContext(BuilderContextBase["Solver.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Solver.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Solver."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Solver", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Solver.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    dns01: Optional[Dns01] = None
    """
    Configures cert-manager to attempt to complete authorizations by
    performing the DNS01 challenge flow.
    """
    http01: Optional[Http01] = None
    """
    Configures cert-manager to attempt to complete authorizations by
    performing the HTTP01 challenge flow.
    It is not possible to obtain certificates for wildcard domain names
    (e.g. `*.example.com`) using the HTTP01 challenge mechanism.
    """
    selector: Optional[Selector] = None
    """
    Selector selects a set of DNSNames on the Certificate resource that
    should be solved using this challenge solver.
    If not specified, the solver will be treated as the 'default' solver
    with the lowest priority, i.e. if any other solver has a more specific
    match, it will be used instead.
    """


class ChallengeSpec(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ChallengeSpec"]:
            return ChallengeSpec

        def build(self) -> "ChallengeSpec":
            return ChallengeSpec(**self._attrs)

        def authorization_url(self, value: str, /) -> Self:
            """
            The URL to the ACME Authorization resource that this
            challenge is a part of.
            """
            return self._set("authorization_url", value)

        def dns_name(self, value: str, /) -> Self:
            """
            dnsName is the identifier that this challenge is for, e.g. example.com.
            If the requested DNSName is a 'wildcard', this field MUST be set to the
            non-wildcard domain, e.g. for `*.example.com`, it must be `example.com`.
            """
            return self._set("dns_name", value)

        @overload
        def issuer_ref(self, value_or_callback: IssuerRef, /) -> "ChallengeSpec.Builder": ...

        @overload
        def issuer_ref(
            self,
            value_or_callback: Callable[[IssuerRef.Builder], IssuerRef.Builder | IssuerRef],
            /,
        ) -> "ChallengeSpec.Builder": ...

        @overload
        def issuer_ref(self, value_or_callback: Never = ...) -> "IssuerRef.BuilderContext": ...

        def issuer_ref(self, value_or_callback=None, /):
            """
            References a properly configured ACME-type Issuer which should
            be used to create this Challenge.
            If the Issuer does not exist, processing will be retried.
            If the Issuer is not an 'ACME' Issuer, an error will be returned and the
            Challenge will be marked as failed.
            """
            if self._in_context and value_or_callback is None:
                context = IssuerRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "issuer_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(IssuerRef.builder())
                if isinstance(output, IssuerRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("issuer_ref", value)

        def key(self, value: str, /) -> Self:
            """
            The ACME challenge key for this challenge
            For HTTP01 challenges, this is the value that must be responded with to
            complete the HTTP01 challenge in the format:
            `<private key JWK thumbprint>.<key from acme server for challenge>`.
            For DNS01 challenges, this is the base64 encoded SHA256 sum of the
            `<private key JWK thumbprint>.<key from acme server for challenge>`
            text that must be set as the TXT record content.
            """
            return self._set("key", value)

        @overload
        def solver(self, value_or_callback: Solver, /) -> "ChallengeSpec.Builder": ...

        @overload
        def solver(
            self,
            value_or_callback: Callable[[Solver.Builder], Solver.Builder | Solver],
            /,
        ) -> "ChallengeSpec.Builder": ...

        @overload
        def solver(self, value_or_callback: Never = ...) -> "Solver.BuilderContext": ...

        def solver(self, value_or_callback=None, /):
            """
            Contains the domain solving configuration that should be used to
            solve this challenge resource.
            """
            if self._in_context and value_or_callback is None:
                context = Solver.BuilderContext()
                context._parent_builder = self
                context._field_name = "solver"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Solver.builder())
                if isinstance(output, Solver.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("solver", value)

        def token(self, value: str, /) -> Self:
            """
            The ACME challenge token for this challenge.
            This is the raw value returned from the ACME server.
            """
            return self._set("token", value)

        def type(self, value: Literal["HTTP-01", "DNS-01"], /) -> Self:
            """
            The type of ACME challenge this resource represents.
            One of "HTTP-01" or "DNS-01".
            """
            return self._set("type", value)

        def url(self, value: str, /) -> Self:
            """
            The URL of the ACME Challenge resource for this challenge.
            This can be used to lookup details about the status of this challenge.
            """
            return self._set("url", value)

        def wildcard(self, value: Optional[bool], /) -> Self:
            """
            wildcard will be true if this challenge is for a wildcard identifier,
            for example '*.example.com'.
            """
            return self._set("wildcard", value)

    class BuilderContext(BuilderContextBase["ChallengeSpec.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ChallengeSpec.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ChallengeSpec."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ChallengeSpec", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ChallengeSpec.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    authorization_url: Annotated[str, Field(alias="authorizationURL")]
    """
    The URL to the ACME Authorization resource that this
    challenge is a part of.
    """
    dns_name: Annotated[str, Field(alias="dnsName")]
    """
    dnsName is the identifier that this challenge is for, e.g. example.com.
    If the requested DNSName is a 'wildcard', this field MUST be set to the
    non-wildcard domain, e.g. for `*.example.com`, it must be `example.com`.
    """
    issuer_ref: Annotated[IssuerRef, Field(alias="issuerRef")]
    """
    References a properly configured ACME-type Issuer which should
    be used to create this Challenge.
    If the Issuer does not exist, processing will be retried.
    If the Issuer is not an 'ACME' Issuer, an error will be returned and the
    Challenge will be marked as failed.
    """
    key: str
    """
    The ACME challenge key for this challenge
    For HTTP01 challenges, this is the value that must be responded with to
    complete the HTTP01 challenge in the format:
    `<private key JWK thumbprint>.<key from acme server for challenge>`.
    For DNS01 challenges, this is the base64 encoded SHA256 sum of the
    `<private key JWK thumbprint>.<key from acme server for challenge>`
    text that must be set as the TXT record content.
    """
    solver: Solver
    """
    Contains the domain solving configuration that should be used to
    solve this challenge resource.
    """
    token: str
    """
    The ACME challenge token for this challenge.
    This is the raw value returned from the ACME server.
    """
    type: Literal["HTTP-01", "DNS-01"]
    """
    The type of ACME challenge this resource represents.
    One of "HTTP-01" or "DNS-01".
    """
    url: str
    """
    The URL of the ACME Challenge resource for this challenge.
    This can be used to lookup details about the status of this challenge.
    """
    wildcard: Optional[bool] = None
    """
    wildcard will be true if this challenge is for a wildcard identifier,
    for example '*.example.com'.
    """


class ChallengeStatus(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ChallengeStatus"]:
            return ChallengeStatus

        def build(self) -> "ChallengeStatus":
            return ChallengeStatus(**self._attrs)

        def presented(self, value: Optional[bool], /) -> Self:
            """
            presented will be set to true if the challenge values for this challenge
            are currently 'presented'.
            This *does not* imply the self check is passing. Only that the values
            have been 'submitted' for the appropriate challenge mechanism (i.e. the
            DNS01 TXT record has been presented, or the HTTP01 configuration has been
            configured).
            """
            return self._set("presented", value)

        def processing(self, value: Optional[bool], /) -> Self:
            """
            Used to denote whether this challenge should be processed or not.
            This field will only be set to true by the 'scheduling' component.
            It will only be set to false by the 'challenges' controller, after the
            challenge has reached a final state or timed out.
            If this field is set to false, the challenge controller will not take
            any more action.
            """
            return self._set("processing", value)

        def reason(self, value: Optional[str], /) -> Self:
            """
            Contains human readable information on why the Challenge is in the
            current state.
            """
            return self._set("reason", value)

        def state(
            self,
            value: Optional[
                Literal[
                    "valid",
                    "ready",
                    "pending",
                    "processing",
                    "invalid",
                    "expired",
                    "errored",
                ]
            ],
            /,
        ) -> Self:
            """
            Contains the current 'state' of the challenge.
            If not set, the state of the challenge is unknown.
            """
            return self._set("state", value)

    class BuilderContext(BuilderContextBase["ChallengeStatus.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ChallengeStatus.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ChallengeStatus."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ChallengeStatus", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ChallengeStatus.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    presented: Optional[bool] = None
    """
    presented will be set to true if the challenge values for this challenge
    are currently 'presented'.
    This *does not* imply the self check is passing. Only that the values
    have been 'submitted' for the appropriate challenge mechanism (i.e. the
    DNS01 TXT record has been presented, or the HTTP01 configuration has been
    configured).
    """
    processing: Optional[bool] = None
    """
    Used to denote whether this challenge should be processed or not.
    This field will only be set to true by the 'scheduling' component.
    It will only be set to false by the 'challenges' controller, after the
    challenge has reached a final state or timed out.
    If this field is set to false, the challenge controller will not take
    any more action.
    """
    reason: Optional[str] = None
    """
    Contains human readable information on why the Challenge is in the
    current state.
    """
    state: Optional[
        Literal["valid", "ready", "pending", "processing", "invalid", "expired", "errored"]
    ] = None
    """
    Contains the current 'state' of the challenge.
    If not set, the state of the challenge is unknown.
    """


class OrderSpec(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["OrderSpec"]:
            return OrderSpec

        def build(self) -> "OrderSpec":
            return OrderSpec(**self._attrs)

        def common_name(self, value: Optional[str], /) -> Self:
            """
            CommonName is the common name as specified on the DER encoded CSR.
            If specified, this value must also be present in `dnsNames` or `ipAddresses`.
            This field must match the corresponding field on the DER encoded CSR.
            """
            return self._set("common_name", value)

        def dns_names(self, value: Optional[List[str]], /) -> Self:
            """
            DNSNames is a list of DNS names that should be included as part of the Order
            validation process.
            This field must match the corresponding field on the DER encoded CSR.
            """
            return self._set("dns_names", value)

        def duration(self, value: Optional[str], /) -> Self:
            """
            Duration is the duration for the not after date for the requested certificate.
            this is set on order creation as pe the ACME spec.
            """
            return self._set("duration", value)

        def ip_addresses(self, value: Optional[List[str]], /) -> Self:
            """
            IPAddresses is a list of IP addresses that should be included as part of the Order
            validation process.
            This field must match the corresponding field on the DER encoded CSR.
            """
            return self._set("ip_addresses", value)

        @overload
        def issuer_ref(self, value_or_callback: IssuerRef, /) -> "OrderSpec.Builder": ...

        @overload
        def issuer_ref(
            self,
            value_or_callback: Callable[[IssuerRef.Builder], IssuerRef.Builder | IssuerRef],
            /,
        ) -> "OrderSpec.Builder": ...

        @overload
        def issuer_ref(self, value_or_callback: Never = ...) -> "IssuerRef.BuilderContext": ...

        def issuer_ref(self, value_or_callback=None, /):
            """
            IssuerRef references a properly configured ACME-type Issuer which should
            be used to create this Order.
            If the Issuer does not exist, processing will be retried.
            If the Issuer is not an 'ACME' Issuer, an error will be returned and the
            Order will be marked as failed.
            """
            if self._in_context and value_or_callback is None:
                context = IssuerRef.BuilderContext()
                context._parent_builder = self
                context._field_name = "issuer_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(IssuerRef.builder())
                if isinstance(output, IssuerRef.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("issuer_ref", value)

        def request(self, value: str, /) -> Self:
            """
            Certificate signing request bytes in DER encoding.
            This will be used when finalizing the order.
            This field must be set on the order.
            """
            return self._set("request", value)

    class BuilderContext(BuilderContextBase["OrderSpec.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = OrderSpec.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for OrderSpec."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["OrderSpec", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use OrderSpec.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    common_name: Annotated[Optional[str], Field(alias="commonName")] = None
    """
    CommonName is the common name as specified on the DER encoded CSR.
    If specified, this value must also be present in `dnsNames` or `ipAddresses`.
    This field must match the corresponding field on the DER encoded CSR.
    """
    dns_names: Annotated[Optional[List[str]], Field(alias="dnsNames")] = None
    """
    DNSNames is a list of DNS names that should be included as part of the Order
    validation process.
    This field must match the corresponding field on the DER encoded CSR.
    """
    duration: Optional[str] = None
    """
    Duration is the duration for the not after date for the requested certificate.
    this is set on order creation as pe the ACME spec.
    """
    ip_addresses: Annotated[Optional[List[str]], Field(alias="ipAddresses")] = None
    """
    IPAddresses is a list of IP addresses that should be included as part of the Order
    validation process.
    This field must match the corresponding field on the DER encoded CSR.
    """
    issuer_ref: Annotated[IssuerRef, Field(alias="issuerRef")]
    """
    IssuerRef references a properly configured ACME-type Issuer which should
    be used to create this Order.
    If the Issuer does not exist, processing will be retried.
    If the Issuer is not an 'ACME' Issuer, an error will be returned and the
    Order will be marked as failed.
    """
    request: str
    """
    Certificate signing request bytes in DER encoding.
    This will be used when finalizing the order.
    This field must be set on the order.
    """


class Challenge(Resource):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Challenge"]:
            return Challenge

        def build(self) -> "Challenge":
            return Challenge(**self._attrs)

        def token(self, value: str, /) -> Self:
            """
            Token is the token that must be presented for this challenge.
            This is used to compute the 'key' that must also be presented.
            """
            return self._set("token", value)

        def type(self, value: str, /) -> Self:
            """
            Type is the type of challenge being offered, e.g. 'http-01', 'dns-01',
            'tls-sni-01', etc.
            This is the raw value retrieved from the ACME server.
            Only 'http-01' and 'dns-01' are supported by cert-manager, other values
            will be ignored.
            """
            return self._set("type", value)

        def url(self, value: str, /) -> Self:
            """
            URL is the URL of this challenge. It can be used to retrieve additional
            metadata about the Challenge from the ACME server.
            """
            return self._set("url", value)

    class BuilderContext(BuilderContextBase["Challenge.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Challenge.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Challenge."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Challenge", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Challenge.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    token: str
    """
    Token is the token that must be presented for this challenge.
    This is used to compute the 'key' that must also be presented.
    """
    type: str
    """
    Type is the type of challenge being offered, e.g. 'http-01', 'dns-01',
    'tls-sni-01', etc.
    This is the raw value retrieved from the ACME server.
    Only 'http-01' and 'dns-01' are supported by cert-manager, other values
    will be ignored.
    """
    url: str
    """
    URL is the URL of this challenge. It can be used to retrieve additional
    metadata about the Challenge from the ACME server.
    """


class Authorization(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Authorization"]:
            return Authorization

        def build(self) -> "Authorization":
            return Authorization(**self._attrs)

        @overload
        def challenges(self, value_or_callback: List[Challenge], /) -> "Authorization.Builder": ...

        @overload
        def challenges(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[Challenge, Challenge.Builder]],
                GenericListBuilder[Challenge, Challenge.Builder] | List[Challenge],
            ],
            /,
        ) -> "Authorization.Builder": ...

        @overload
        def challenges(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[Challenge.Builder]: ...

        def challenges(self, value_or_callback=None, /):
            """
            Challenges specifies the challenge types offered by the ACME server.
            One of these challenge types will be selected when validating the DNS
            name and an appropriate Challenge resource will be created to perform
            the ACME challenge process.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[Challenge.Builder]()
                context._parent_builder = self
                context._field_name = "challenges"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Challenge.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("challenges", value)

        def identifier(self, value: Optional[str], /) -> Self:
            """
            Identifier is the DNS name to be validated as part of this authorization
            """
            return self._set("identifier", value)

        def initial_state(
            self,
            value: Optional[
                Literal[
                    "valid",
                    "ready",
                    "pending",
                    "processing",
                    "invalid",
                    "expired",
                    "errored",
                ]
            ],
            /,
        ) -> Self:
            """
            InitialState is the initial state of the ACME authorization when first
            fetched from the ACME server.
            If an Authorization is already 'valid', the Order controller will not
            create a Challenge resource for the authorization. This will occur when
            working with an ACME server that enables 'authz reuse' (such as Let's
            Encrypt's production endpoint).
            If not set and 'identifier' is set, the state is assumed to be pending
            and a Challenge will be created.
            """
            return self._set("initial_state", value)

        def url(self, value: str, /) -> Self:
            """
            URL is the URL of the Authorization that must be completed
            """
            return self._set("url", value)

        def wildcard(self, value: Optional[bool], /) -> Self:
            """
            Wildcard will be true if this authorization is for a wildcard DNS name.
            If this is true, the identifier will be the *non-wildcard* version of
            the DNS name.
            For example, if '*.example.com' is the DNS name being validated, this
            field will be 'true' and the 'identifier' field will be 'example.com'.
            """
            return self._set("wildcard", value)

    class BuilderContext(BuilderContextBase["Authorization.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Authorization.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Authorization."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Authorization", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Authorization.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    challenges: Optional[List[Challenge]] = None
    """
    Challenges specifies the challenge types offered by the ACME server.
    One of these challenge types will be selected when validating the DNS
    name and an appropriate Challenge resource will be created to perform
    the ACME challenge process.
    """
    identifier: Optional[str] = None
    """
    Identifier is the DNS name to be validated as part of this authorization
    """
    initial_state: Annotated[
        Optional[
            Literal[
                "valid",
                "ready",
                "pending",
                "processing",
                "invalid",
                "expired",
                "errored",
            ]
        ],
        Field(alias="initialState"),
    ] = None
    """
    InitialState is the initial state of the ACME authorization when first
    fetched from the ACME server.
    If an Authorization is already 'valid', the Order controller will not
    create a Challenge resource for the authorization. This will occur when
    working with an ACME server that enables 'authz reuse' (such as Let's
    Encrypt's production endpoint).
    If not set and 'identifier' is set, the state is assumed to be pending
    and a Challenge will be created.
    """
    url: str
    """
    URL is the URL of the Authorization that must be completed
    """
    wildcard: Optional[bool] = None
    """
    Wildcard will be true if this authorization is for a wildcard DNS name.
    If this is true, the identifier will be the *non-wildcard* version of
    the DNS name.
    For example, if '*.example.com' is the DNS name being validated, this
    field will be 'true' and the 'identifier' field will be 'example.com'.
    """


class OrderStatus(BaseModel):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["OrderStatus"]:
            return OrderStatus

        def build(self) -> "OrderStatus":
            return OrderStatus(**self._attrs)

        @overload
        def authorizations(
            self, value_or_callback: List[Authorization], /
        ) -> "OrderStatus.Builder": ...

        @overload
        def authorizations(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[Authorization, Authorization.Builder]],
                GenericListBuilder[Authorization, Authorization.Builder] | List[Authorization],
            ],
            /,
        ) -> "OrderStatus.Builder": ...

        @overload
        def authorizations(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[Authorization.Builder]: ...

        def authorizations(self, value_or_callback=None, /):
            """
            Authorizations contains data returned from the ACME server on what
            authorizations must be completed in order to validate the DNS names
            specified on the Order.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[Authorization.Builder]()
                context._parent_builder = self
                context._field_name = "authorizations"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(Authorization.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("authorizations", value)

        def certificate(self, value: Optional[str], /) -> Self:
            """
            Certificate is a copy of the PEM encoded certificate for this Order.
            This field will be populated after the order has been successfully
            finalized with the ACME server, and the order has transitioned to the
            'valid' state.
            """
            return self._set("certificate", value)

        def failure_time(self, value: Optional[datetime], /) -> Self:
            """
            FailureTime stores the time that this order failed.
            This is used to influence garbage collection and back-off.
            """
            return self._set("failure_time", value)

        def finalize_url(self, value: Optional[str], /) -> Self:
            """
            FinalizeURL of the Order.
            This is used to obtain certificates for this order once it has been completed.
            """
            return self._set("finalize_url", value)

        def reason(self, value: Optional[str], /) -> Self:
            """
            Reason optionally provides more information about a why the order is in
            the current state.
            """
            return self._set("reason", value)

        def state(
            self,
            value: Optional[
                Literal[
                    "valid",
                    "ready",
                    "pending",
                    "processing",
                    "invalid",
                    "expired",
                    "errored",
                ]
            ],
            /,
        ) -> Self:
            """
            State contains the current state of this Order resource.
            States 'success' and 'expired' are 'final'
            """
            return self._set("state", value)

        def url(self, value: Optional[str], /) -> Self:
            """
            URL of the Order.
            This will initially be empty when the resource is first created.
            The Order controller will populate this field when the Order is first processed.
            This field will be immutable after it is initially set.
            """
            return self._set("url", value)

    class BuilderContext(BuilderContextBase["OrderStatus.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = OrderStatus.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for OrderStatus."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["OrderStatus", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use OrderStatus.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    authorizations: Optional[List[Authorization]] = None
    """
    Authorizations contains data returned from the ACME server on what
    authorizations must be completed in order to validate the DNS names
    specified on the Order.
    """
    certificate: Optional[str] = None
    """
    Certificate is a copy of the PEM encoded certificate for this Order.
    This field will be populated after the order has been successfully
    finalized with the ACME server, and the order has transitioned to the
    'valid' state.
    """
    failure_time: Annotated[Optional[datetime], Field(alias="failureTime")] = None
    """
    FailureTime stores the time that this order failed.
    This is used to influence garbage collection and back-off.
    """
    finalize_url: Annotated[Optional[str], Field(alias="finalizeURL")] = None
    """
    FinalizeURL of the Order.
    This is used to obtain certificates for this order once it has been completed.
    """
    reason: Optional[str] = None
    """
    Reason optionally provides more information about a why the order is in
    the current state.
    """
    state: Optional[
        Literal["valid", "ready", "pending", "processing", "invalid", "expired", "errored"]
    ] = None
    """
    State contains the current state of this Order resource.
    States 'success' and 'expired' are 'final'
    """
    url: Optional[str] = None
    """
    URL of the Order.
    This will initially be empty when the resource is first created.
    The Order controller will populate this field when the Order is first processed.
    This field will be immutable after it is initially set.
    """


class ChallengeModel(Resource):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["ChallengeModel"]:
            return ChallengeModel

        def build(self) -> "ChallengeModel":
            return ChallengeModel(**self._attrs)

        def api_version(self, value: Optional[Literal["acme.cert-manager.io/v1"]], /) -> Self:
            """
            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
            """
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["Challenge"]], /) -> Self:
            """
            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
            """
            return self._set("kind", value)

        @overload
        def metadata(
            self, value_or_callback: Optional[apimachinery.ObjectMeta], /
        ) -> "ChallengeModel.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [apimachinery.ObjectMeta.Builder],
                apimachinery.ObjectMeta.Builder | apimachinery.ObjectMeta,
            ],
            /,
        ) -> "ChallengeModel.Builder": ...

        @overload
        def metadata(
            self, value_or_callback: Never = ...
        ) -> "apimachinery.ObjectMeta.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            if self._in_context and value_or_callback is None:
                context = apimachinery.ObjectMeta.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(apimachinery.ObjectMeta.builder())
                if isinstance(output, apimachinery.ObjectMeta.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def spec(self, value_or_callback: ChallengeSpec, /) -> "ChallengeModel.Builder": ...

        @overload
        def spec(
            self,
            value_or_callback: Callable[
                [ChallengeSpec.Builder], ChallengeSpec.Builder | ChallengeSpec
            ],
            /,
        ) -> "ChallengeModel.Builder": ...

        @overload
        def spec(self, value_or_callback: Never = ...) -> "ChallengeSpec.BuilderContext": ...

        def spec(self, value_or_callback=None, /):
            if self._in_context and value_or_callback is None:
                context = ChallengeSpec.BuilderContext()
                context._parent_builder = self
                context._field_name = "spec"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ChallengeSpec.builder())
                if isinstance(output, ChallengeSpec.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("spec", value)

        @overload
        def status(
            self, value_or_callback: Optional[ChallengeStatus], /
        ) -> "ChallengeModel.Builder": ...

        @overload
        def status(
            self,
            value_or_callback: Callable[
                [ChallengeStatus.Builder], ChallengeStatus.Builder | ChallengeStatus
            ],
            /,
        ) -> "ChallengeModel.Builder": ...

        @overload
        def status(self, value_or_callback: Never = ...) -> "ChallengeStatus.BuilderContext": ...

        def status(self, value_or_callback=None, /):
            if self._in_context and value_or_callback is None:
                context = ChallengeStatus.BuilderContext()
                context._parent_builder = self
                context._field_name = "status"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ChallengeStatus.builder())
                if isinstance(output, ChallengeStatus.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("status", value)

    class BuilderContext(BuilderContextBase["ChallengeModel.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ChallengeModel.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ChallengeModel."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["ChallengeModel", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ChallengeModel.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_version: Annotated[
        Optional[Literal["acme.cert-manager.io/v1"]], Field(alias="apiVersion")
    ] = "acme.cert-manager.io/v1"
    """
    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[Literal["Challenge"]] = "Challenge"
    """
    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[apimachinery.ObjectMeta] = None
    spec: ChallengeSpec
    status: Optional[ChallengeStatus] = None


class Order(Resource):
    class Builder(BaseModelBuilder):
        @property
        def cls(self) -> Type["Order"]:
            return Order

        def build(self) -> "Order":
            return Order(**self._attrs)

        def api_version(self, value: Optional[Literal["acme.cert-manager.io/v1"]], /) -> Self:
            """
            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
            """
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["Order"]], /) -> Self:
            """
            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
            """
            return self._set("kind", value)

        @overload
        def metadata(
            self, value_or_callback: Optional[apimachinery.ObjectMeta], /
        ) -> "Order.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [apimachinery.ObjectMeta.Builder],
                apimachinery.ObjectMeta.Builder | apimachinery.ObjectMeta,
            ],
            /,
        ) -> "Order.Builder": ...

        @overload
        def metadata(
            self, value_or_callback: Never = ...
        ) -> "apimachinery.ObjectMeta.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            if self._in_context and value_or_callback is None:
                context = apimachinery.ObjectMeta.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(apimachinery.ObjectMeta.builder())
                if isinstance(output, apimachinery.ObjectMeta.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def spec(self, value_or_callback: OrderSpec, /) -> "Order.Builder": ...

        @overload
        def spec(
            self,
            value_or_callback: Callable[[OrderSpec.Builder], OrderSpec.Builder | OrderSpec],
            /,
        ) -> "Order.Builder": ...

        @overload
        def spec(self, value_or_callback: Never = ...) -> "OrderSpec.BuilderContext": ...

        def spec(self, value_or_callback=None, /):
            if self._in_context and value_or_callback is None:
                context = OrderSpec.BuilderContext()
                context._parent_builder = self
                context._field_name = "spec"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(OrderSpec.builder())
                if isinstance(output, OrderSpec.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("spec", value)

        @overload
        def status(self, value_or_callback: Optional[OrderStatus], /) -> "Order.Builder": ...

        @overload
        def status(
            self,
            value_or_callback: Callable[[OrderStatus.Builder], OrderStatus.Builder | OrderStatus],
            /,
        ) -> "Order.Builder": ...

        @overload
        def status(self, value_or_callback: Never = ...) -> "OrderStatus.BuilderContext": ...

        def status(self, value_or_callback=None, /):
            if self._in_context and value_or_callback is None:
                context = OrderStatus.BuilderContext()
                context._parent_builder = self
                context._field_name = "status"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(OrderStatus.builder())
                if isinstance(output, OrderStatus.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("status", value)

    class BuilderContext(BuilderContextBase["Order.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = Order.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for Order."""
        return cls.BuilderContext()

    class ListBuilder(GenericListBuilder["Order", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use Order.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_version: Annotated[
        Optional[Literal["acme.cert-manager.io/v1"]], Field(alias="apiVersion")
    ] = "acme.cert-manager.io/v1"
    """
    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[Literal["Order"]] = "Order"
    """
    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[apimachinery.ObjectMeta] = None
    spec: OrderSpec
    status: Optional[OrderStatus] = None
