Coverage Report

Created: 2026-08-18 17:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
common/cpp/obj-client/auth/azure_auth_factory.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
20
#include <azure/storage/blobs/blob_container_client.hpp>
21
#include <memory>
22
#include <string>
23
#include <string_view>
24
25
namespace Azure::Storage {
26
class StorageSharedKeyCredential;
27
}
28
29
namespace doris {
30
31
enum class AzureCredentialType {
32
    SHARED_KEY,
33
};
34
35
struct AzureCredentialOptions {
36
    AzureCredentialType type = AzureCredentialType::SHARED_KEY;
37
    std::string account_name;
38
    std::string account_key;
39
};
40
41
struct AzureClientBuildResult {
42
    std::shared_ptr<Azure::Storage::Blobs::BlobContainerClient> container_client {};
43
    std::shared_ptr<Azure::Storage::StorageSharedKeyCredential> shared_key_credential {};
44
    std::string error {};
45
46
0
    explicit operator bool() const { return container_client != nullptr; }
47
};
48
49
class AzureAuthFactory {
50
public:
51
    static AzureClientBuildResult create(std::string_view container_url,
52
                                         const AzureCredentialOptions& credential,
53
                                         Azure::Storage::Blobs::BlobClientOptions client_options);
54
};
55
56
} // namespace doris