Ejemplo n.º 1
0
        public AzureSQLConnectionStringCredential(string dataSourceCredentialName, AzureSQLConnectionStringParam parameters) : base(dataSourceCredentialName)
        {
            if (dataSourceCredentialName == null)
            {
                throw new ArgumentNullException(nameof(dataSourceCredentialName));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            Parameters = parameters;
            DataSourceCredentialType = DataSourceCredentialType.AzureSQLConnectionString;
        }
Ejemplo n.º 2
0
        internal static AzureSQLConnectionStringCredential DeserializeAzureSQLConnectionStringCredential(JsonElement element)
        {
            AzureSQLConnectionStringParam parameters = default;
            DataSourceCredentialType      dataSourceCredentialType = default;
            Optional <Guid>   dataSourceCredentialId          = default;
            string            dataSourceCredentialName        = default;
            Optional <string> dataSourceCredentialDescription = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("parameters"))
                {
                    parameters = AzureSQLConnectionStringParam.DeserializeAzureSQLConnectionStringParam(property.Value);
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialType"))
                {
                    dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dataSourceCredentialId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialName"))
                {
                    dataSourceCredentialName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialDescription"))
                {
                    dataSourceCredentialDescription = property.Value.GetString();
                    continue;
                }
            }
            return(new AzureSQLConnectionStringCredential(dataSourceCredentialType, Optional.ToNullable(dataSourceCredentialId), dataSourceCredentialName, dataSourceCredentialDescription.Value, parameters));
        }
Ejemplo n.º 3
0
        internal static SqlConnectionStringDatasourceCredential DeserializeSqlConnectionStringDatasourceCredential(JsonElement element)
        {
            AzureSQLConnectionStringParam parameters = default;
            DataSourceCredentialType      dataSourceCredentialType = default;
            Optional <string>             dataSourceCredentialId   = default;
            string            dataSourceCredentialName             = default;
            Optional <string> dataSourceCredentialDescription      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("parameters"))
                {
                    parameters = AzureSQLConnectionStringParam.DeserializeAzureSQLConnectionStringParam(property.Value);
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialType"))
                {
                    dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialId"))
                {
                    dataSourceCredentialId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialName"))
                {
                    dataSourceCredentialName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialDescription"))
                {
                    dataSourceCredentialDescription = property.Value.GetString();
                    continue;
                }
            }
            return(new SqlConnectionStringDatasourceCredential(dataSourceCredentialType, dataSourceCredentialId.Value, dataSourceCredentialName, dataSourceCredentialDescription.Value, parameters));
        }
        /// <summary>
        /// Initializes a new instance of <see cref="Administration.SqlConnectionStringCredentialEntity"/> for mocking purposes.
        /// </summary>
        /// <param name="id">Sets the <see cref="DataSourceCredentialEntity.Id"/> property.</param>
        /// <param name="name">Sets the <see cref="DataSourceCredentialEntity.Name"/> property.</param>
        /// <param name="description">Sets the <see cref="DataSourceCredentialEntity.Description"/> property.</param>
        /// <param name="connectionString">Sets the connection string. This secret is not exposed in a property.</param>
        /// <returns>A new instance of <see cref="Administration.SqlConnectionStringCredentialEntity"/> for mocking purposes.</returns>
        public static SqlConnectionStringCredentialEntity SqlConnectionStringCredentialEntity(string id = null, string name = null, string description = null, string connectionString = null)
        {
            AzureSQLConnectionStringParam parameters = new AzureSQLConnectionStringParam(connectionString);

            return(new SqlConnectionStringCredentialEntity(DataSourceCredentialKind.SqlConnectionString, id, name, description, parameters));
        }
 internal SqlConnectionStringDatasourceCredential(DataSourceCredentialType dataSourceCredentialType, string id, string name, string description, AzureSQLConnectionStringParam parameters)
     : base(dataSourceCredentialType, id, name, description)
 {
     DataSourceCredentialType = dataSourceCredentialType;
     ConnectionString         = parameters.ConnectionString;
 }
Ejemplo n.º 6
0
 internal AzureSQLConnectionStringCredential(DataSourceCredentialType dataSourceCredentialType, Guid?dataSourceCredentialId, string dataSourceCredentialName, string dataSourceCredentialDescription, AzureSQLConnectionStringParam parameters) : base(dataSourceCredentialType, dataSourceCredentialId, dataSourceCredentialName, dataSourceCredentialDescription)
 {
     Parameters = parameters;
     DataSourceCredentialType = dataSourceCredentialType;
 }