internal SearchIndexerDataSource(string name, string description, SearchIndexerDataSourceType type, DataSourceCredentials credentialsInternal, SearchIndexerDataContainer container, DataChangeDetectionPolicy dataChangeDetectionPolicy, DataDeletionDetectionPolicy dataDeletionDetectionPolicy, string Etag)
 {
     Name                        = name;
     Description                 = description;
     Type                        = type;
     CredentialsInternal         = credentialsInternal;
     Container                   = container;
     DataChangeDetectionPolicy   = dataChangeDetectionPolicy;
     DataDeletionDetectionPolicy = dataDeletionDetectionPolicy;
     _etag                       = Etag;
 }
示例#2
0
 /// <summary>
 /// Creates a new instance of the <see cref="SearchIndexerDataSource"/> class.
 /// </summary>
 /// <param name="name">The name of the data source.</param>
 /// <param name="type">The type of the data source.</param>
 /// <param name="connectionString">The connection string to the data source.</param>
 /// <param name="container">The data container for the data source.</param>
 /// <exception cref="ArgumentNullException"><paramref name="name"/>, <paramref name="connectionString"/>, or <paramref name="container"/> is null.</exception>
 public SearchIndexerDataSource(string name, SearchIndexerDataSourceType type, string connectionString, SearchIndexerDataContainer container)
 {
     Name             = name ?? throw new ArgumentNullException(nameof(name));
     ConnectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString));
     Container        = container ?? throw new ArgumentNullException(nameof(container));
     Type             = type;
 }
        internal static SearchIndexerDataSource DeserializeSearchIndexerDataSource(JsonElement element)
        {
            string name        = default;
            string description = default;
            SearchIndexerDataSourceType type        = default;
            DataSourceCredentials       credentials = default;
            SearchIndexerDataContainer  container   = default;
            DataChangeDetectionPolicy   dataChangeDetectionPolicy   = default;
            DataDeletionDetectionPolicy dataDeletionDetectionPolicy = default;
            string odataEtag = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new SearchIndexerDataSourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    credentials = DataSourceCredentials.DeserializeDataSourceCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("container"))
                {
                    container = SearchIndexerDataContainer.DeserializeSearchIndexerDataContainer(property.Value);
                    continue;
                }
                if (property.NameEquals("dataChangeDetectionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    dataChangeDetectionPolicy = DataChangeDetectionPolicy.DeserializeDataChangeDetectionPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("dataDeletionDetectionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    dataDeletionDetectionPolicy = DataDeletionDetectionPolicy.DeserializeDataDeletionDetectionPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("@odata.etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    odataEtag = property.Value.GetString();
                    continue;
                }
            }
            return(new SearchIndexerDataSource(name, description, type, credentials, container, dataChangeDetectionPolicy, dataDeletionDetectionPolicy, odataEtag));
        }