| /* |
| * 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 gcs. |
| /// </summary> |
| public sealed class GcsServiceConfig : IServiceConfig |
| { |
| /// <summary> |
| /// Allow opendal to send requests without signing when credentials are not loaded. |
| /// </summary> |
| public bool? AllowAnonymous { get; init; } |
| /// <summary> |
| /// bucket name |
| /// </summary> |
| public string? Bucket { get; init; } |
| /// <summary> |
| /// Credentials string for GCS service OAuth2 authentication. |
| /// </summary> |
| public string? Credential { get; init; } |
| /// <summary> |
| /// Local path to credentials file for GCS service OAuth2 authentication. |
| /// </summary> |
| public string? CredentialPath { get; init; } |
| /// <summary> |
| /// The default storage class used by gcs. |
| /// </summary> |
| public string? DefaultStorageClass { get; init; } |
| /// <summary> |
| /// Disable loading configuration from the environment. |
| /// </summary> |
| public bool? DisableConfigLoad { get; init; } |
| /// <summary> |
| /// Disable attempting to load credentials from the GCE metadata server when running within Google Cloud. |
| /// </summary> |
| public bool? DisableVmMetadata { get; init; } |
| /// <summary> |
| /// endpoint URI of GCS service, default is https://storage.googleapis.com |
| /// </summary> |
| public string? Endpoint { get; init; } |
| /// <summary> |
| /// The predefined acl for GCS. |
| /// </summary> |
| public string? PredefinedAcl { get; init; } |
| /// <summary> |
| /// root URI, all operations happens under root |
| /// </summary> |
| public string? Root { get; init; } |
| /// <summary> |
| /// Scope for gcs. |
| /// </summary> |
| public string? Scope { get; init; } |
| /// <summary> |
| /// Service Account for gcs. |
| /// </summary> |
| public string? ServiceAccount { get; init; } |
| /// <summary> |
| /// A Google Cloud OAuth2 token. Takes precedence over credential and credential_path. |
| /// </summary> |
| public string? Token { get; init; } |
| |
| public string Scheme => "gcs"; |
| |
| public IReadOnlyDictionary<string, string> ToOptions() |
| { |
| var map = new Dictionary<string, string>(); |
| if (AllowAnonymous is not null) |
| { |
| map["allow_anonymous"] = Utilities.ToOptionString(AllowAnonymous); |
| } |
| if (Bucket is not null) |
| { |
| map["bucket"] = Utilities.ToOptionString(Bucket); |
| } |
| if (Credential is not null) |
| { |
| map["credential"] = Utilities.ToOptionString(Credential); |
| } |
| if (CredentialPath is not null) |
| { |
| map["credential_path"] = Utilities.ToOptionString(CredentialPath); |
| } |
| if (DefaultStorageClass is not null) |
| { |
| map["default_storage_class"] = Utilities.ToOptionString(DefaultStorageClass); |
| } |
| if (DisableConfigLoad is not null) |
| { |
| map["disable_config_load"] = Utilities.ToOptionString(DisableConfigLoad); |
| } |
| if (DisableVmMetadata is not null) |
| { |
| map["disable_vm_metadata"] = Utilities.ToOptionString(DisableVmMetadata); |
| } |
| if (Endpoint is not null) |
| { |
| map["endpoint"] = Utilities.ToOptionString(Endpoint); |
| } |
| if (PredefinedAcl is not null) |
| { |
| map["predefined_acl"] = Utilities.ToOptionString(PredefinedAcl); |
| } |
| if (Root is not null) |
| { |
| map["root"] = Utilities.ToOptionString(Root); |
| } |
| if (Scope is not null) |
| { |
| map["scope"] = Utilities.ToOptionString(Scope); |
| } |
| if (ServiceAccount is not null) |
| { |
| map["service_account"] = Utilities.ToOptionString(ServiceAccount); |
| } |
| if (Token is not null) |
| { |
| map["token"] = Utilities.ToOptionString(Token); |
| } |
| return map; |
| } |
| } |
| |
| } |