internal static DatastoreSecrets DeserializeDatastoreSecrets(JsonElement element) { if (element.TryGetProperty("secretsType", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "Certificate": return(CertificateDatastoreSecrets.DeserializeCertificateDatastoreSecrets(element)); case "KerberosKeytab": return(KerberosKeytabSecrets.DeserializeKerberosKeytabSecrets(element)); case "KerberosPassword": return(KerberosPasswordSecrets.DeserializeKerberosPasswordSecrets(element)); case "Sas": return(SasDatastoreSecrets.DeserializeSasDatastoreSecrets(element)); case "ServicePrincipal": return(ServicePrincipalDatastoreSecrets.DeserializeServicePrincipalDatastoreSecrets(element)); case "AccountKey": return(AccountKeyDatastoreSecrets.DeserializeAccountKeyDatastoreSecrets(element)); } } SecretsType secretsType = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretsType")) { secretsType = new SecretsType(property.Value.GetString()); continue; } } return(new DatastoreSecrets(secretsType)); }
public SasDatastoreCredentials(SasDatastoreSecrets secrets) { if (secrets == null) { throw new ArgumentNullException(nameof(secrets)); } Secrets = secrets; CredentialsType = CredentialsType.Sas; }
internal static SasDatastoreCredentials DeserializeSasDatastoreCredentials(JsonElement element) { SasDatastoreSecrets secrets = default; CredentialsType credentialsType = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secrets")) { secrets = SasDatastoreSecrets.DeserializeSasDatastoreSecrets(property.Value); continue; } if (property.NameEquals("credentialsType")) { credentialsType = new CredentialsType(property.Value.GetString()); continue; } } return(new SasDatastoreCredentials(credentialsType, secrets)); }
internal SasDatastoreCredentials(CredentialsType credentialsType, SasDatastoreSecrets secrets) : base(credentialsType) { Secrets = secrets; CredentialsType = credentialsType; }