|
| 1 | +# generated by datamodel-codegen: |
| 2 | +# timestamp: 2024-04-28T13:01:54+00:00 |
| 3 | +# k8s version: v1.30.0 |
| 4 | + |
| 5 | +from __future__ import annotations |
| 6 | + |
| 7 | +from datetime import datetime |
| 8 | +from typing import Dict, List, Optional |
| 9 | + |
| 10 | +from pydantic import BaseModel, Field |
| 11 | + |
| 12 | +from ...apimachinery.pkg.apis.meta import v1 |
| 13 | + |
| 14 | + |
| 15 | +class BoundObjectReference(BaseModel): |
| 16 | + apiVersion: Optional[str] = Field( |
| 17 | + default=None, description="API version of the referent." |
| 18 | + ) |
| 19 | + kind: Optional[str] = Field( |
| 20 | + default=None, |
| 21 | + description="Kind of the referent. Valid kinds are 'Pod' and 'Secret'.", |
| 22 | + ) |
| 23 | + name: Optional[str] = Field(default=None, description="Name of the referent.") |
| 24 | + uid: Optional[str] = Field(default=None, description="UID of the referent.") |
| 25 | + |
| 26 | + |
| 27 | +class TokenRequestSpec(BaseModel): |
| 28 | + audiences: List[str] = Field( |
| 29 | + ..., |
| 30 | + description=( |
| 31 | + "Audiences are the intendend audiences of the token. A recipient of a token" |
| 32 | + " must identify themself with an identifier in the list of audiences of the" |
| 33 | + " token, and otherwise should reject the token. A token issued for multiple" |
| 34 | + " audiences may be used to authenticate against any of the audiences listed" |
| 35 | + " but implies a high degree of trust between the target audiences." |
| 36 | + ), |
| 37 | + ) |
| 38 | + boundObjectRef: Optional[BoundObjectReference] = Field( |
| 39 | + default=None, |
| 40 | + description=( |
| 41 | + "BoundObjectRef is a reference to an object that the token will be bound" |
| 42 | + " to. The token will only be valid for as long as the bound object exists." |
| 43 | + " NOTE: The API server's TokenReview endpoint will validate the" |
| 44 | + " BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small" |
| 45 | + " if you want prompt revocation." |
| 46 | + ), |
| 47 | + ) |
| 48 | + expirationSeconds: Optional[int] = Field( |
| 49 | + default=None, |
| 50 | + description=( |
| 51 | + "ExpirationSeconds is the requested duration of validity of the request." |
| 52 | + " The token issuer may return a token with a different validity duration so" |
| 53 | + " a client needs to check the 'expiration' field in a response." |
| 54 | + ), |
| 55 | + ) |
| 56 | + |
| 57 | + |
| 58 | +class TokenReviewSpec(BaseModel): |
| 59 | + audiences: Optional[List[str]] = Field( |
| 60 | + default=None, |
| 61 | + description=( |
| 62 | + "Audiences is a list of the identifiers that the resource server presented" |
| 63 | + " with the token identifies as. Audience-aware token authenticators will" |
| 64 | + " verify that the token was intended for at least one of the audiences in" |
| 65 | + " this list. If no audiences are provided, the audience will default to the" |
| 66 | + " audience of the Kubernetes apiserver." |
| 67 | + ), |
| 68 | + ) |
| 69 | + token: Optional[str] = Field( |
| 70 | + default=None, description="Token is the opaque bearer token." |
| 71 | + ) |
| 72 | + |
| 73 | + |
| 74 | +class UserInfo(BaseModel): |
| 75 | + extra: Optional[Dict[str, List[str]]] = Field( |
| 76 | + default=None, |
| 77 | + description="Any additional information provided by the authenticator.", |
| 78 | + ) |
| 79 | + groups: Optional[List[str]] = Field( |
| 80 | + default=None, description="The names of groups this user is a part of." |
| 81 | + ) |
| 82 | + uid: Optional[str] = Field( |
| 83 | + default=None, |
| 84 | + description=( |
| 85 | + "A unique value that identifies this user across time. If this user is" |
| 86 | + " deleted and another user by the same name is added, they will have" |
| 87 | + " different UIDs." |
| 88 | + ), |
| 89 | + ) |
| 90 | + username: Optional[str] = Field( |
| 91 | + default=None, |
| 92 | + description=( |
| 93 | + "The name that uniquely identifies this user among all active users." |
| 94 | + ), |
| 95 | + ) |
| 96 | + |
| 97 | + |
| 98 | +class TokenRequestStatus(BaseModel): |
| 99 | + expirationTimestamp: datetime = Field( |
| 100 | + ..., |
| 101 | + description=( |
| 102 | + "ExpirationTimestamp is the time of expiration of the returned token." |
| 103 | + ), |
| 104 | + ) |
| 105 | + token: str = Field(..., description="Token is the opaque bearer token.") |
| 106 | + |
| 107 | + |
| 108 | +class SelfSubjectReviewStatus(BaseModel): |
| 109 | + userInfo: Optional[UserInfo] = Field( |
| 110 | + default=None, description="User attributes of the user making this request." |
| 111 | + ) |
| 112 | + |
| 113 | + |
| 114 | +class TokenReviewStatus(BaseModel): |
| 115 | + audiences: Optional[List[str]] = Field( |
| 116 | + default=None, |
| 117 | + description=( |
| 118 | + "Audiences are audience identifiers chosen by the authenticator that are" |
| 119 | + " compatible with both the TokenReview and token. An identifier is any" |
| 120 | + " identifier in the intersection of the TokenReviewSpec audiences and the" |
| 121 | + " token's audiences. A client of the TokenReview API that sets the" |
| 122 | + " spec.audiences field should validate that a compatible audience" |
| 123 | + " identifier is returned in the status.audiences field to ensure that the" |
| 124 | + " TokenReview server is audience aware. If a TokenReview returns an empty" |
| 125 | + ' status.audience field where status.authenticated is "true", the token is' |
| 126 | + " valid against the audience of the Kubernetes API server." |
| 127 | + ), |
| 128 | + ) |
| 129 | + authenticated: Optional[bool] = Field( |
| 130 | + default=None, |
| 131 | + description=( |
| 132 | + "Authenticated indicates that the token was associated with a known user." |
| 133 | + ), |
| 134 | + ) |
| 135 | + error: Optional[str] = Field( |
| 136 | + default=None, description="Error indicates that the token couldn't be checked" |
| 137 | + ) |
| 138 | + user: Optional[UserInfo] = Field( |
| 139 | + default=None, |
| 140 | + description="User is the UserInfo associated with the provided token.", |
| 141 | + ) |
| 142 | + |
| 143 | + |
| 144 | +class TokenRequest(BaseModel): |
| 145 | + apiVersion: Optional[str] = Field( |
| 146 | + default="authentication.k8s.io/v1", |
| 147 | + description=( |
| 148 | + "APIVersion defines the versioned schema of this representation of an" |
| 149 | + " object. Servers should convert recognized schemas to the latest internal" |
| 150 | + " value, and may reject unrecognized values. More info:" |
| 151 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" |
| 152 | + ), |
| 153 | + ) |
| 154 | + kind: Optional[str] = Field( |
| 155 | + default="TokenRequest", |
| 156 | + description=( |
| 157 | + "Kind is a string value representing the REST resource this object" |
| 158 | + " represents. Servers may infer this from the endpoint the client submits" |
| 159 | + " requests to. Cannot be updated. In CamelCase. More info:" |
| 160 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" |
| 161 | + ), |
| 162 | + ) |
| 163 | + metadata: Optional[v1.ObjectMeta] = Field( |
| 164 | + default=None, |
| 165 | + description=( |
| 166 | + "Standard object's metadata. More info:" |
| 167 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" |
| 168 | + ), |
| 169 | + ) |
| 170 | + spec: TokenRequestSpec = Field( |
| 171 | + ..., description="Spec holds information about the request being evaluated" |
| 172 | + ) |
| 173 | + status: Optional[TokenRequestStatus] = Field( |
| 174 | + default=None, |
| 175 | + description=( |
| 176 | + "Status is filled in by the server and indicates whether the token can be" |
| 177 | + " authenticated." |
| 178 | + ), |
| 179 | + ) |
| 180 | + |
| 181 | + |
| 182 | +class SelfSubjectReview(BaseModel): |
| 183 | + apiVersion: Optional[str] = Field( |
| 184 | + default="authentication.k8s.io/v1", |
| 185 | + description=( |
| 186 | + "APIVersion defines the versioned schema of this representation of an" |
| 187 | + " object. Servers should convert recognized schemas to the latest internal" |
| 188 | + " value, and may reject unrecognized values. More info:" |
| 189 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" |
| 190 | + ), |
| 191 | + ) |
| 192 | + kind: Optional[str] = Field( |
| 193 | + default="SelfSubjectReview", |
| 194 | + description=( |
| 195 | + "Kind is a string value representing the REST resource this object" |
| 196 | + " represents. Servers may infer this from the endpoint the client submits" |
| 197 | + " requests to. Cannot be updated. In CamelCase. More info:" |
| 198 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" |
| 199 | + ), |
| 200 | + ) |
| 201 | + metadata: Optional[v1.ObjectMeta] = Field( |
| 202 | + default=None, |
| 203 | + description=( |
| 204 | + "Standard object's metadata. More info:" |
| 205 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" |
| 206 | + ), |
| 207 | + ) |
| 208 | + status: Optional[SelfSubjectReviewStatus] = Field( |
| 209 | + default=None, |
| 210 | + description="Status is filled in by the server with the user attributes.", |
| 211 | + ) |
| 212 | + |
| 213 | + |
| 214 | +class TokenReview(BaseModel): |
| 215 | + apiVersion: Optional[str] = Field( |
| 216 | + default="authentication.k8s.io/v1", |
| 217 | + description=( |
| 218 | + "APIVersion defines the versioned schema of this representation of an" |
| 219 | + " object. Servers should convert recognized schemas to the latest internal" |
| 220 | + " value, and may reject unrecognized values. More info:" |
| 221 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" |
| 222 | + ), |
| 223 | + ) |
| 224 | + kind: Optional[str] = Field( |
| 225 | + default="TokenReview", |
| 226 | + description=( |
| 227 | + "Kind is a string value representing the REST resource this object" |
| 228 | + " represents. Servers may infer this from the endpoint the client submits" |
| 229 | + " requests to. Cannot be updated. In CamelCase. More info:" |
| 230 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" |
| 231 | + ), |
| 232 | + ) |
| 233 | + metadata: Optional[v1.ObjectMeta] = Field( |
| 234 | + default=None, |
| 235 | + description=( |
| 236 | + "Standard object's metadata. More info:" |
| 237 | + " https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" |
| 238 | + ), |
| 239 | + ) |
| 240 | + spec: TokenReviewSpec = Field( |
| 241 | + ..., description="Spec holds information about the request being evaluated" |
| 242 | + ) |
| 243 | + status: Optional[TokenReviewStatus] = Field( |
| 244 | + default=None, |
| 245 | + description=( |
| 246 | + "Status is filled in by the server and indicates whether the request can be" |
| 247 | + " authenticated." |
| 248 | + ), |
| 249 | + ) |
0 commit comments