Android-cuttlefish cvd tool
http_build_api.h
Go to the documentation of this file.
1//
2// Copyright (C) 2026 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#pragma once
17
18#include <memory>
19#include <string>
20
27
28namespace cuttlefish {
29
30// Reads builds held behind plain `https://` URLs. Holds no credential, so it
31// cannot leak one: an origin that needs authorization is reached through a URL
32// that carries its own, as a pre-signed URL does.
33class HttpBuildApi : public BuildApi<HttpBuildString, HttpBuild> {
34 public:
35 explicit HttpBuildApi(HttpClient& http_client);
36
37 Result<HttpBuild> GetBuild(const HttpBuildString& build_string) override;
38
40 const std::string& target_directory,
41 const std::string& artifact_name) override;
42
44 const HttpBuild& build, const std::string& artifact_name) override;
45
46 private:
48};
49
50} // namespace cuttlefish
Definition: build_api.h:27
Definition: http_build_api.h:33
HttpBuildApi(HttpClient &http_client)
Definition: http_build_api.cpp:56
Result< HttpBuild > GetBuild(const HttpBuildString &build_string) override
Definition: http_build_api.cpp:59
Result< std::string > DownloadFile(const HttpBuild &build, const std::string &target_directory, const std::string &artifact_name) override
Definition: http_build_api.cpp:69
Result< std::unique_ptr< ReaderSeeker > > FileReader(const HttpBuild &build, const std::string &artifact_name) override
Definition: http_build_api.cpp:107
HttpClient & http_client_
Definition: http_build_api.h:47
Definition: http_client.h:100
Definition: alloc_driver.h:21
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30
Definition: http_build_string.h:26
Definition: android_build.h:95