blob: 1ad7ee02a870acbcf7eb444f2ef085fa8d261cac [file]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Generated from bindings/java ServiceConfig definitions.
using OpenDAL.ServiceConfig.Abstractions;
namespace OpenDAL.ServiceConfig
{
/// <summary>
/// Configuration for service d1.
/// </summary>
public sealed class D1ServiceConfig : IServiceConfig
{
/// <summary>
/// Set the account id of cloudflare api.
/// </summary>
public string? AccountId { get; init; }
/// <summary>
/// Set the database id of cloudflare api.
/// </summary>
public string? DatabaseId { get; init; }
/// <summary>
/// Set the key field of D1 Database.
/// </summary>
public string? KeyField { get; init; }
/// <summary>
/// Set the working directory of OpenDAL.
/// </summary>
public string? Root { get; init; }
/// <summary>
/// Set the table of D1 Database.
/// </summary>
public string? Table { get; init; }
/// <summary>
/// Set the token of cloudflare api.
/// </summary>
public string? Token { get; init; }
/// <summary>
/// Set the value field of D1 Database.
/// </summary>
public string? ValueField { get; init; }
public string Scheme => "d1";
public IReadOnlyDictionary<string, string> ToOptions()
{
var map = new Dictionary<string, string>();
if (AccountId is not null)
{
map["account_id"] = Utilities.ToOptionString(AccountId);
}
if (DatabaseId is not null)
{
map["database_id"] = Utilities.ToOptionString(DatabaseId);
}
if (KeyField is not null)
{
map["key_field"] = Utilities.ToOptionString(KeyField);
}
if (Root is not null)
{
map["root"] = Utilities.ToOptionString(Root);
}
if (Table is not null)
{
map["table"] = Utilities.ToOptionString(Table);
}
if (Token is not null)
{
map["token"] = Utilities.ToOptionString(Token);
}
if (ValueField is not null)
{
map["value_field"] = Utilities.ToOptionString(ValueField);
}
return map;
}
}
}