Android-cuttlefish cvd tool
android_build_url.h
Go to the documentation of this file.
1//
2// Copyright (C) 2025 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 <ostream>
19#include <string>
20#include <string_view>
21#include <vector>
22
23#include "absl/strings/string_view.h"
24
25namespace cuttlefish {
26
27enum class SafeLevel {
29 kSafe0,
30 kSafe1,
31 kSafe2,
33};
34
35std::string_view format_as(SafeLevel level);
36
37template <typename Sink>
38void AbslStringify(Sink& sink, SafeLevel level) {
39 sink.Append(format_as(level));
40}
41
42std::ostream& operator<<(std::ostream& os, SafeLevel level);
43
44inline constexpr SafeLevel kAllSafeLevels[] = {
50};
51
52inline constexpr char kAndroidBuildServiceUrl[] =
53 "https://androidbuild-pa.googleapis.com/v4";
54
56 public:
57 AndroidBuildUrl(std::string api_base_url, std::string api_key,
58 std::string project_id);
59
61 absl::string_view branch, absl::string_view target,
63 std::string GetBuildUrl(absl::string_view id, absl::string_view target);
64 std::string GetArtifactUrl(absl::string_view id, absl::string_view target,
65 const std::vector<std::string>& artifact_filenames,
66 absl::string_view page_token);
67 std::string GetArtifactDownloadUrl(absl::string_view id,
68 absl::string_view target,
69 absl::string_view artifact);
70
71 private:
72 std::string api_base_url_;
73 std::string api_key_;
74 std::string project_id_;
75};
76
77} // namespace cuttlefish
Definition: android_build_url.h:55
AndroidBuildUrl(std::string api_base_url, std::string api_key, std::string project_id)
Definition: android_build_url.cpp:132
std::string GetLatestBuildCandidateUrl(absl::string_view branch, absl::string_view target, SafeLevel safe_level=SafeLevel::kSafeLevelUnspecified)
Definition: android_build_url.cpp:138
std::string GetArtifactUrl(absl::string_view id, absl::string_view target, const std::vector< std::string > &artifact_filenames, absl::string_view page_token)
Definition: android_build_url.cpp:163
std::string api_key_
Definition: android_build_url.h:73
std::string api_base_url_
Definition: android_build_url.h:72
std::string GetBuildUrl(absl::string_view id, absl::string_view target)
Definition: android_build_url.cpp:155
std::string GetArtifactDownloadUrl(absl::string_view id, absl::string_view target, absl::string_view artifact)
Definition: android_build_url.cpp:182
std::string project_id_
Definition: android_build_url.h:74
Definition: alloc_driver.h:21
void AbslStringify(Sink &sink, DeviceType device_type)
Definition: device_type.h:44
constexpr char kAndroidBuildServiceUrl[]
Definition: android_build_url.h:52
constexpr SafeLevel kAllSafeLevels[]
Definition: android_build_url.h:44
std::ostream & operator<<(std::ostream &out, DeviceType device_type)
Definition: device_type.cpp:73
std::string_view format_as(DeviceType device_type)
Definition: device_type.cpp:77
SafeLevel
Definition: android_build_url.h:27