Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public SasDatastoreCredentials(SasDatastoreSecrets secrets)
        {
            if (secrets == null)
            {
                throw new ArgumentNullException(nameof(secrets));
            }

            Secrets         = secrets;
            CredentialsType = CredentialsType.Sas;
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 internal SasDatastoreCredentials(CredentialsType credentialsType, SasDatastoreSecrets secrets) : base(credentialsType)
 {
     Secrets         = secrets;
     CredentialsType = credentialsType;
 }