Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-133954 / 25.04-RC.1 / Fix keychaincredentials schema errors (by themylogin) #15627

Merged
merged 1 commit into from
Feb 7, 2025
Merged
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
16 changes: 11 additions & 5 deletions src/middlewared/middlewared/api/v25_04_0/keychain.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import abc
from typing import Literal
from typing import Annotated, Literal, Union

from pydantic import Secret
from pydantic import Discriminator, Secret

from middlewared.api.base import (BaseModel, Excluded, excluded_field, ForUpdateMetaclass, HttpUrl, LongString,
NonEmptyString, single_argument_args, single_argument_result)
Expand Down Expand Up @@ -182,10 +182,13 @@ class SetupSSHConnectionManualSetup(SSHCredentials):


class SetupSSHConnectionManual(BaseModel):
private_key: KeychainCredentialSetupSSHConnectionKeyNew | KeychainCredentialSetupSSHConnectionKeyExisting
private_key: Annotated[
Union[KeychainCredentialSetupSSHConnectionKeyNew, KeychainCredentialSetupSSHConnectionKeyExisting],
Discriminator("generate_key"),
]
connection_name: NonEmptyString
setup_type: Literal["MANUAL"] = "MANUAL"
manual_setup: SSHCredentials
manual_setup: SetupSSHConnectionManualSetup


class SetupSSHConnectionSemiautomatic(SetupSSHConnectionManual):
Expand All @@ -195,7 +198,10 @@ class SetupSSHConnectionSemiautomatic(SetupSSHConnectionManual):


class KeychainCredentialSetupSSHConnectionArgs(BaseModel):
options: SetupSSHConnectionManual | SetupSSHConnectionSemiautomatic
options: Annotated[
Union[SetupSSHConnectionManual, SetupSSHConnectionSemiautomatic],
Discriminator("setup_type"),
]


class KeychainCredentialSetupSSHConnectionResult(BaseModel):
Expand Down