Android-cuttlefish cvd tool
gcs_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 <map>
19#include <memory>
20#include <string>
21#include <vector>
22
30
31namespace cuttlefish {
32
33// Reads builds held in Cloud Storage through the JSON API. The credential
34// source is optional because public buckets are readable without one.
35class GcsBuildApi : public BuildApi<GcsBuildString, GcsBuild> {
36 public:
37 GcsBuildApi(HttpClient& http_client, CredentialSource* credential_source);
38
39 Result<GcsBuild> GetBuild(const GcsBuildString& build_string) override;
40
42 const std::string& target_directory,
43 const std::string& artifact_name) override;
44
46 const GcsBuild& build, const std::string& artifact_name) override;
47
48 private:
50
52 const GcsBuild& build);
54
57};
58
59} // namespace cuttlefish
Definition: build_api.h:27
Definition: credential_source.h:24
Definition: gcs_build_api.h:35
GcsBuildApi(HttpClient &http_client, CredentialSource *credential_source)
Definition: gcs_build_api.cpp:190
Result< std::unique_ptr< ReaderSeeker > > FileReader(const GcsBuild &build, const std::string &artifact_name) override
Definition: gcs_build_api.cpp:302
Result< std::map< std::string, GcsObjectInfo > > ListContents(const GcsBuild &build)
Definition: gcs_build_api.cpp:213
Result< std::vector< std::string > > Headers()
Definition: gcs_build_api.cpp:194
Result< GcsBuild > GetBuild(const GcsBuildString &build_string) override
Definition: gcs_build_api.cpp:203
Result< std::string > DownloadFile(const GcsBuild &build, const std::string &target_directory, const std::string &artifact_name) override
Definition: gcs_build_api.cpp:272
Result< GcsObjectInfo > ProbeObject(const GcsBuild &build)
Definition: gcs_build_api.cpp:254
CredentialSource * credential_source_
Definition: gcs_build_api.h:56
HttpClient & http_client_
Definition: gcs_build_api.h:55
Definition: http_client.h:100
Definition: alloc_driver.h:21
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30
Definition: gcs_build_string.h:26
Definition: android_build.h:72