43 lines
1.7 KiB
C++
43 lines
1.7 KiB
C++
#pragma once
|
|||
|
|
|
||
|
|
// Every Google API service this build calls, with the console page that
|
||
|
|
// enables it. A disabled API answers 403 SERVICE_DISABLED; the URL below is
|
||
|
|
// the same activation page Google puts in that error.
|
||
|
|
// Add a row in api_catalog.cpp when a module starts calling a new service.
|
||
|
|
|
||
|
|
#include <string>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
namespace molo::google::apis {
|
||
|
|
|
||
|
|
// Placeholder project used in docs and examples. Valid project id format:
|
||
|
|
// 6-30 chars, lowercase letters, digits and hyphens, starts with a letter.
|
||
|
|
inline constexpr const char* kExampleProject = "example-214512124";
|
||
|
|
|
||
|
|
struct ApiInfo {
|
||
|
|
std::string service; // "agentregistry.googleapis.com"
|
||
|
|
std::string title; // Console title, as Service Usage reports it
|
||
|
|
std::string used_by; // Modules under src/google that call it
|
||
|
|
std::string note; // Extra activation step beyond enabling, or empty
|
||
|
|
};
|
||
|
|
|
||
|
|
// All known services, fixed order.
|
||
|
|
const std::vector<ApiInfo>& all();
|
||
|
|
// Null when the service is not in the catalog.
|
||
|
|
const ApiInfo* find(const std::string& service);
|
||
|
|
|
||
|
|
// True for a valid project id (see kExampleProject).
|
||
|
|
bool valid_project(const std::string& project);
|
||
|
|
|
||
|
|
// https://console.developers.google.com/apis/api/<service>/overview?project=<id>
|
||
|
|
// Throws GoogleError::invalid for an unknown service or a bad project id.
|
||
|
|
std::string enable_url(const std::string& service, const std::string& project);
|
||
|
|
// gcloud services enable <service> --project=<id>
|
||
|
|
std::string enable_command(const std::string& service, const std::string& project);
|
||
|
|
|
||
|
|
// Console pages for credentials, not tied to one API.
|
||
|
|
std::string api_keys_url(const std::string& project);
|
||
|
|
std::string service_accounts_url(const std::string& project);
|
||
|
|
|
||
|
|
} // namespace molo::google::apis
|