Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions reconcile/gql_definitions/common/app_interface_clusterrole.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# qenerate: plugin=pydantic_v2
query AppInterfaceClusterRoles {
clusterRoles: roles_v1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation:

Suggested change
clusterRoles: roles_v1 {
clusterRoles: roles_v1 {

name
users {
org_username
github_username
}
bots {
openshift_serviceaccount
}
access {
cluster {
name
auth {
service
}
}
clusterRole
}
expirationDate
}
}
104 changes: 104 additions & 0 deletions reconcile/gql_definitions/common/app_interface_clusterrole.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"""
Generated by qenerate plugin=pydantic_v2. DO NOT MODIFY MANUALLY!
"""
from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
from datetime import datetime # noqa: F401 # pylint: disable=W0611
from enum import Enum # noqa: F401 # pylint: disable=W0611
from typing import ( # noqa: F401 # pylint: disable=W0611
Any,
Optional,
Union,
)

from pydantic import ( # noqa: F401 # pylint: disable=W0611
BaseModel,
ConfigDict,
Field,
Json,
)


DEFINITION = """
query AppInterfaceClusterRoles {
clusterRoles: roles_v1 {
name
users {
org_username
github_username
}
bots {
openshift_serviceaccount
}
access {
cluster {
name
auth {
service
}
}
clusterRole
}
expirationDate
}
}
"""


class ConfiguredBaseModel(BaseModel):
model_config = ConfigDict(
extra='forbid'
)


class UserV1(ConfiguredBaseModel):
org_username: str = Field(..., alias="org_username")
github_username: str = Field(..., alias="github_username")


class BotV1(ConfiguredBaseModel):
openshift_serviceaccount: Optional[str] = Field(..., alias="openshift_serviceaccount")


class ClusterAuthV1(ConfiguredBaseModel):
service: str = Field(..., alias="service")


class ClusterV1(ConfiguredBaseModel):
name: str = Field(..., alias="name")
auth: list[ClusterAuthV1] = Field(..., alias="auth")


class AccessV1(ConfiguredBaseModel):
cluster: Optional[ClusterV1] = Field(..., alias="cluster")
cluster_role: Optional[str] = Field(..., alias="clusterRole")


class RoleV1(ConfiguredBaseModel):
name: str = Field(..., alias="name")
users: list[UserV1] = Field(..., alias="users")
bots: list[BotV1] = Field(..., alias="bots")
access: Optional[list[AccessV1]] = Field(..., alias="access")
expiration_date: Optional[str] = Field(..., alias="expirationDate")


class AppInterfaceClusterRolesQueryData(ConfiguredBaseModel):
cluster_roles: Optional[list[RoleV1]] = Field(..., alias="clusterRoles")


def query(query_func: Callable, **kwargs: Any) -> AppInterfaceClusterRolesQueryData:
"""
This is a convenience function which queries and parses the data into
concrete types. It should be compatible with most GQL clients.
You do not have to use it to consume the generated data classes.
Alternatively, you can also mime and alternate the behavior
of this function in the caller.

Parameters:
query_func (Callable): Function which queries your GQL Server
kwargs: optional arguments that will be passed to the query function

Returns:
AppInterfaceClusterRolesQueryData: queried data parsed into generated classes
"""
raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
return AppInterfaceClusterRolesQueryData(**raw_data)
Loading