18 from typing
import Dict, Any
20 from .type
import SecretType
21 from .secret
import Secret
22 from .aws_secret
import AWSSecret
23 from .git_secret
import GitSecret
24 from .credentials
import CredentialsSecret
25 from .project_secret
import ProjectSecret
28 def create(value: Dict[str, Any]) -> Secret:
29 rawType = value.get(
"type_")
31 raise ValueError(
"Invalid Secret json received. \"type_\" field missing")
34 type_ = SecretType(rawType)
36 if type_ == SecretType.aws:
37 return AWSSecret.decode(value)
39 if type_ == SecretType.git:
40 return GitSecret.decode(value)
42 if type_ == SecretType.credentials:
43 return CredentialsSecret.decode(value)
45 if type_ == SecretType.project:
46 return ProjectSecret.decode(value)