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

from __future__ import annotations

from typing import Annotated, Callable, Dict, List, Literal, Optional, Type, Union

from pydantic import Field

from cloudcoil import apimachinery
from cloudcoil.pydantic import BaseBuilder, BaseModel, GenericListBuilder, Self
from cloudcoil.resources import Resource


class NonResourceAttributes(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["NonResourceAttributes"]:
            return NonResourceAttributes

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

        def path(self, value: Optional[str]) -> Self:
            return self._set("path", value)

        def verb(self, value: Optional[str]) -> Self:
            return self._set("verb", value)

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

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

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

    path: Annotated[Optional[str], Field(description="Path is the URL path of the request")] = None
    verb: Annotated[Optional[str], Field(description="Verb is the standard HTTP verb")] = None


class NonResourceRule(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["NonResourceRule"]:
            return NonResourceRule

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

        def non_resource_ur_ls(self, value: Optional[List[str]]) -> Self:
            return self._set("non_resource_ur_ls", value)

        def verbs(self, value: List[str]) -> Self:
            return self._set("verbs", value)

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

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

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

    non_resource_ur_ls: Annotated[
        Optional[List[str]],
        Field(
            alias="nonResourceURLs",
            description='NonResourceURLs is a set of partial urls that a user should have access to.  *s are allowed, but only as the full, final step in the path.  "*" means all.',
        ),
    ] = None
    verbs: Annotated[
        List[str],
        Field(
            description='Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options.  "*" means all.'
        ),
    ]


class ResourceAttributes(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceAttributes"]:
            return ResourceAttributes

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

        def group(self, value: Optional[str]) -> Self:
            return self._set("group", value)

        def name(self, value: Optional[str]) -> Self:
            return self._set("name", value)

        def namespace(self, value: Optional[str]) -> Self:
            return self._set("namespace", value)

        def resource(self, value: Optional[str]) -> Self:
            return self._set("resource", value)

        def subresource(self, value: Optional[str]) -> Self:
            return self._set("subresource", value)

        def verb(self, value: Optional[str]) -> Self:
            return self._set("verb", value)

        def version(self, value: Optional[str]) -> Self:
            return self._set("version", value)

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

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

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

    group: Annotated[
        Optional[str],
        Field(description='Group is the API Group of the Resource.  "*" means all.'),
    ] = None
    name: Annotated[
        Optional[str],
        Field(
            description='Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all.'
        ),
    ] = None
    namespace: Annotated[
        Optional[str],
        Field(
            description='Namespace is the namespace of the action being requested.  Currently, there is no distinction between no namespace and all namespaces "" (empty) is defaulted for LocalSubjectAccessReviews "" (empty) is empty for cluster-scoped resources "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview'
        ),
    ] = None
    resource: Annotated[
        Optional[str],
        Field(description='Resource is one of the existing resource types.  "*" means all.'),
    ] = None
    subresource: Annotated[
        Optional[str],
        Field(description='Subresource is one of the existing resource types.  "" means none.'),
    ] = None
    verb: Annotated[
        Optional[str],
        Field(
            description='Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy.  "*" means all.'
        ),
    ] = None
    version: Annotated[
        Optional[str],
        Field(description='Version is the API Version of the Resource.  "*" means all.'),
    ] = None


class ResourceRule(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceRule"]:
            return ResourceRule

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

        def api_groups(self, value: Optional[List[str]]) -> Self:
            return self._set("api_groups", value)

        def resource_names(self, value: Optional[List[str]]) -> Self:
            return self._set("resource_names", value)

        def resources(self, value: Optional[List[str]]) -> Self:
            return self._set("resources", value)

        def verbs(self, value: List[str]) -> Self:
            return self._set("verbs", value)

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

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

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

    api_groups: Annotated[
        Optional[List[str]],
        Field(
            alias="apiGroups",
            description='APIGroups is the name of the APIGroup that contains the resources.  If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed.  "*" means all.',
        ),
    ] = None
    resource_names: Annotated[
        Optional[List[str]],
        Field(
            alias="resourceNames",
            description='ResourceNames is an optional white list of names that the rule applies to.  An empty set means that everything is allowed.  "*" means all.',
        ),
    ] = None
    resources: Annotated[
        Optional[List[str]],
        Field(
            description='Resources is a list of resources this rule applies to.  "*" means all in the specified apiGroups.\n "*/foo" represents the subresource \'foo\' for all resources in the specified apiGroups.'
        ),
    ] = None
    verbs: Annotated[
        List[str],
        Field(
            description='Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy.  "*" means all.'
        ),
    ]


class SelfSubjectAccessReviewSpec(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SelfSubjectAccessReviewSpec"]:
            return SelfSubjectAccessReviewSpec

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

        """  """

        def non_resource_attributes(
            self,
            value_or_callback: Union[
                Optional[NonResourceAttributes],
                Callable[[NonResourceAttributes.Builder], NonResourceAttributes.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(NonResourceAttributes.builder()).build()
            return self._set("non_resource_attributes", value)

        """  """

        def resource_attributes(
            self,
            value_or_callback: Union[
                Optional[ResourceAttributes],
                Callable[[ResourceAttributes.Builder], ResourceAttributes.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceAttributes.builder()).build()
            return self._set("resource_attributes", value)

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

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

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

    non_resource_attributes: Annotated[
        Optional[NonResourceAttributes],
        Field(
            alias="nonResourceAttributes",
            description="NonResourceAttributes describes information for a non-resource access request",
        ),
    ] = None
    resource_attributes: Annotated[
        Optional[ResourceAttributes],
        Field(
            alias="resourceAttributes",
            description="ResourceAuthorizationAttributes describes information for a resource access request",
        ),
    ] = None


class SelfSubjectRulesReviewSpec(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SelfSubjectRulesReviewSpec"]:
            return SelfSubjectRulesReviewSpec

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

        def namespace(self, value: Optional[str]) -> Self:
            return self._set("namespace", value)

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

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

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

    namespace: Annotated[
        Optional[str], Field(description="Namespace to evaluate rules for. Required.")
    ] = None


class SubjectAccessReviewSpec(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SubjectAccessReviewSpec"]:
            return SubjectAccessReviewSpec

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

        def extra(self, value: Optional[Dict[str, List[str]]]) -> Self:
            return self._set("extra", value)

        def groups(self, value: Optional[List[str]]) -> Self:
            return self._set("groups", value)

        """  """

        def non_resource_attributes(
            self,
            value_or_callback: Union[
                Optional[NonResourceAttributes],
                Callable[[NonResourceAttributes.Builder], NonResourceAttributes.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(NonResourceAttributes.builder()).build()
            return self._set("non_resource_attributes", value)

        """  """

        def resource_attributes(
            self,
            value_or_callback: Union[
                Optional[ResourceAttributes],
                Callable[[ResourceAttributes.Builder], ResourceAttributes.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceAttributes.builder()).build()
            return self._set("resource_attributes", value)

        def uid(self, value: Optional[str]) -> Self:
            return self._set("uid", value)

        def user(self, value: Optional[str]) -> Self:
            return self._set("user", value)

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

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

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

    extra: Annotated[
        Optional[Dict[str, List[str]]],
        Field(
            description="Extra corresponds to the user.Info.GetExtra() method from the authenticator.  Since that is input to the authorizer it needs a reflection here."
        ),
    ] = None
    groups: Annotated[
        Optional[List[str]],
        Field(description="Groups is the groups you're testing for."),
    ] = None
    non_resource_attributes: Annotated[
        Optional[NonResourceAttributes],
        Field(
            alias="nonResourceAttributes",
            description="NonResourceAttributes describes information for a non-resource access request",
        ),
    ] = None
    resource_attributes: Annotated[
        Optional[ResourceAttributes],
        Field(
            alias="resourceAttributes",
            description="ResourceAuthorizationAttributes describes information for a resource access request",
        ),
    ] = None
    uid: Annotated[
        Optional[str], Field(description="UID information about the requesting user.")
    ] = None
    user: Annotated[
        Optional[str],
        Field(
            description='User is the user you\'re testing for. If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups'
        ),
    ] = None


class SubjectAccessReviewStatus(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SubjectAccessReviewStatus"]:
            return SubjectAccessReviewStatus

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

        def allowed(self, value: bool) -> Self:
            return self._set("allowed", value)

        def denied(self, value: Optional[bool]) -> Self:
            return self._set("denied", value)

        def evaluation_error(self, value: Optional[str]) -> Self:
            return self._set("evaluation_error", value)

        def reason(self, value: Optional[str]) -> Self:
            return self._set("reason", value)

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

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

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

    allowed: Annotated[
        bool,
        Field(
            description="Allowed is required. True if the action would be allowed, false otherwise."
        ),
    ]
    denied: Annotated[
        Optional[bool],
        Field(
            description="Denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true."
        ),
    ] = None
    evaluation_error: Annotated[
        Optional[str],
        Field(
            alias="evaluationError",
            description="EvaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.",
        ),
    ] = None
    reason: Annotated[
        Optional[str],
        Field(description="Reason is optional.  It indicates why a request was allowed or denied."),
    ] = None


class SubjectRulesReviewStatus(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SubjectRulesReviewStatus"]:
            return SubjectRulesReviewStatus

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

        def evaluation_error(self, value: Optional[str]) -> Self:
            return self._set("evaluation_error", value)

        def incomplete(self, value: bool) -> Self:
            return self._set("incomplete", value)

        """  """

        def non_resource_rules(
            self,
            value_or_callback: Union[
                List[NonResourceRule],
                Callable[
                    [GenericListBuilder[NonResourceRule, NonResourceRule.Builder]],
                    GenericListBuilder[NonResourceRule, NonResourceRule.Builder],
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(NonResourceRule.list_builder()).build()
            return self._set("non_resource_rules", value)

        """  """

        def resource_rules(
            self,
            value_or_callback: Union[
                List[ResourceRule],
                Callable[
                    [GenericListBuilder[ResourceRule, ResourceRule.Builder]],
                    GenericListBuilder[ResourceRule, ResourceRule.Builder],
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceRule.list_builder()).build()
            return self._set("resource_rules", value)

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

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

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

    evaluation_error: Annotated[
        Optional[str],
        Field(
            alias="evaluationError",
            description="EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.",
        ),
    ] = None
    incomplete: Annotated[
        bool,
        Field(
            description="Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation."
        ),
    ]
    non_resource_rules: Annotated[
        List[NonResourceRule],
        Field(
            alias="nonResourceRules",
            description="NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
        ),
    ]
    resource_rules: Annotated[
        List[ResourceRule],
        Field(
            alias="resourceRules",
            description="ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
        ),
    ]


class LocalSubjectAccessReview(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["LocalSubjectAccessReview"]:
            return LocalSubjectAccessReview

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

        def api_version(self, value: Optional[Literal["authorization.k8s.io/v1"]]) -> Self:
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["LocalSubjectAccessReview"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                SubjectAccessReviewSpec,
                Callable[[SubjectAccessReviewSpec.Builder], SubjectAccessReviewSpec.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SubjectAccessReviewSpec.builder()).build()
            return self._set("spec", value)

        """  """

        def status(
            self,
            value_or_callback: Union[
                Optional[SubjectAccessReviewStatus],
                Callable[
                    [SubjectAccessReviewStatus.Builder],
                    SubjectAccessReviewStatus.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SubjectAccessReviewStatus.builder()).build()
            return self._set("status", value)

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

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

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

    api_version: Annotated[
        Optional[Literal["authorization.k8s.io/v1"]],
        Field(
            alias="apiVersion",
            description="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",
        ),
    ] = "authorization.k8s.io/v1"
    kind: Annotated[
        Optional[Literal["LocalSubjectAccessReview"]],
        Field(
            description="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"
        ),
    ] = "LocalSubjectAccessReview"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
        ),
    ] = None
    spec: Annotated[
        SubjectAccessReviewSpec,
        Field(
            description="Spec holds information about the request being evaluated.  spec.namespace must be equal to the namespace you made the request against.  If empty, it is defaulted."
        ),
    ]
    status: Annotated[
        Optional[SubjectAccessReviewStatus],
        Field(
            description="Status is filled in by the server and indicates whether the request is allowed or not"
        ),
    ] = None


class SelfSubjectAccessReview(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SelfSubjectAccessReview"]:
            return SelfSubjectAccessReview

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

        def api_version(self, value: Optional[Literal["authorization.k8s.io/v1"]]) -> Self:
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["SelfSubjectAccessReview"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                SelfSubjectAccessReviewSpec,
                Callable[
                    [SelfSubjectAccessReviewSpec.Builder],
                    SelfSubjectAccessReviewSpec.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SelfSubjectAccessReviewSpec.builder()).build()
            return self._set("spec", value)

        """  """

        def status(
            self,
            value_or_callback: Union[
                Optional[SubjectAccessReviewStatus],
                Callable[
                    [SubjectAccessReviewStatus.Builder],
                    SubjectAccessReviewStatus.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SubjectAccessReviewStatus.builder()).build()
            return self._set("status", value)

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

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

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

    api_version: Annotated[
        Optional[Literal["authorization.k8s.io/v1"]],
        Field(
            alias="apiVersion",
            description="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",
        ),
    ] = "authorization.k8s.io/v1"
    kind: Annotated[
        Optional[Literal["SelfSubjectAccessReview"]],
        Field(
            description="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"
        ),
    ] = "SelfSubjectAccessReview"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
        ),
    ] = None
    spec: Annotated[
        SelfSubjectAccessReviewSpec,
        Field(
            description="Spec holds information about the request being evaluated.  user and groups must be empty"
        ),
    ]
    status: Annotated[
        Optional[SubjectAccessReviewStatus],
        Field(
            description="Status is filled in by the server and indicates whether the request is allowed or not"
        ),
    ] = None


class SelfSubjectRulesReview(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SelfSubjectRulesReview"]:
            return SelfSubjectRulesReview

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

        def api_version(self, value: Optional[Literal["authorization.k8s.io/v1"]]) -> Self:
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["SelfSubjectRulesReview"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                SelfSubjectRulesReviewSpec,
                Callable[
                    [SelfSubjectRulesReviewSpec.Builder],
                    SelfSubjectRulesReviewSpec.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SelfSubjectRulesReviewSpec.builder()).build()
            return self._set("spec", value)

        """  """

        def status(
            self,
            value_or_callback: Union[
                Optional[SubjectRulesReviewStatus],
                Callable[[SubjectRulesReviewStatus.Builder], SubjectRulesReviewStatus.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SubjectRulesReviewStatus.builder()).build()
            return self._set("status", value)

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

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

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

    api_version: Annotated[
        Optional[Literal["authorization.k8s.io/v1"]],
        Field(
            alias="apiVersion",
            description="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",
        ),
    ] = "authorization.k8s.io/v1"
    kind: Annotated[
        Optional[Literal["SelfSubjectRulesReview"]],
        Field(
            description="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"
        ),
    ] = "SelfSubjectRulesReview"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
        ),
    ] = None
    spec: Annotated[
        SelfSubjectRulesReviewSpec,
        Field(description="Spec holds information about the request being evaluated."),
    ]
    status: Annotated[
        Optional[SubjectRulesReviewStatus],
        Field(
            description="Status is filled in by the server and indicates the set of actions a user can perform."
        ),
    ] = None


class SubjectAccessReview(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["SubjectAccessReview"]:
            return SubjectAccessReview

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

        def api_version(self, value: Optional[Literal["authorization.k8s.io/v1"]]) -> Self:
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["SubjectAccessReview"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                SubjectAccessReviewSpec,
                Callable[[SubjectAccessReviewSpec.Builder], SubjectAccessReviewSpec.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SubjectAccessReviewSpec.builder()).build()
            return self._set("spec", value)

        """  """

        def status(
            self,
            value_or_callback: Union[
                Optional[SubjectAccessReviewStatus],
                Callable[
                    [SubjectAccessReviewStatus.Builder],
                    SubjectAccessReviewStatus.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(SubjectAccessReviewStatus.builder()).build()
            return self._set("status", value)

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

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

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

    api_version: Annotated[
        Optional[Literal["authorization.k8s.io/v1"]],
        Field(
            alias="apiVersion",
            description="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",
        ),
    ] = "authorization.k8s.io/v1"
    kind: Annotated[
        Optional[Literal["SubjectAccessReview"]],
        Field(
            description="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"
        ),
    ] = "SubjectAccessReview"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
        ),
    ] = None
    spec: Annotated[
        SubjectAccessReviewSpec,
        Field(description="Spec holds information about the request being evaluated"),
    ]
    status: Annotated[
        Optional[SubjectAccessReviewStatus],
        Field(
            description="Status is filled in by the server and indicates whether the request is allowed or not"
        ),
    ] = None
