class ProjectConfigs
Defined at line 34 of file ../../third_party/cobalt/src/registry/project_configs.h
ProjectConfigs provides a convenient interface over a |CobaltRegistry|
that is intended to be used on Cobalt's client-side.
A CobaltRegistry can be in one of three states:
(1) It can contain data for a single Cobalt 1.* project.
(2) It can contain data for multiple Cobalt projects.
So an instance of this class can be in one of two states corresponding
to the two states above:
(1) It can contain data for a single Cobalt 1.* project.
(2) It can contain data for multiple Cobalt 1.* projects.
Public Methods
std::unique_ptr<ProjectConfigs> CreateFromCobaltRegistryBase64 (const std::string & cobalt_registry_base64)
Constructs and returns an instance of ProjectConfigs by first parsing
a CobaltRegistry proto message from |cobalt_registry_base64|, which should
contain the Base64 encoding of the bytes of the binary serialization of
such a message.
Returns nullptr to indicate failure.
std::unique_ptr<ProjectConfigs> CreateFromCobaltRegistryBytes (const std::string & cobalt_registry_bytes)
Constructs and returns an instance of ProjectConfigs by first parsing
a CobaltRegistry proto message from |cobalt_registry_bytes|, which should
contain the bytes of the binary serialization of such a message.
Returns nullptr to indicate failure.
std::unique_ptr<ProjectConfigs> CreateFromCobaltRegistryProto (std::unique_ptr<CobaltRegistry> cobalt_registry)
Constructs and returns and instance of ProjectConfigs that contains the
data from |cobalt_registry|.
std::unique_ptr<ProjectConfigs> CreateFromNotNullCobaltRegistryProto (util::NotNullUniquePtr<CobaltRegistry> cobalt_registry)
void ProjectConfigs (util::NotNullUniquePtr<CobaltRegistry> cobalt_registry)
Constructs a ProjectConfigs that contains the data from |cobalt_registry|.
const CustomerConfig * GetCustomerConfig (lib::CustomerIdentifier customer)
Returns the CustomerConfig for the customer with the given ID, or
nullptr if there is no such customer.
const ProjectConfig * GetProjectConfig (lib::ProjectIdentifier project)
Returns the ProjectConfig for the project with the given
(customer_id, project_id), or nullptr if there is no such project.
const MetricDefinition * GetMetricDefinition (lib::MetricIdentifier metric)
Returns the MetricDefinition for the metric with the given
(customer_id, project_id, metric_id), or nullptr if no such metric exists.
const ReportDefinition * GetReportDefinition (lib::ReportIdentifier report)
Returns the ReportDefinition for the metric with the given
(customer_id, project_id, metric_id, report_id), or nullptr if no such
report exists.
std::unique_ptr<ProjectConfig> TakeSingleProjectConfig ()
If is_single_project() is true then this removes and returns the single
ProjectConfig from the data owned by this object leaving this object
empty. Otherwise returns nullptr.
std::vector<lib::ProjectIdentifier> ListProjects ()
ListProjects returns a list of tuples of the form (customer_id, project_id) for all of the
projects in the registry.
bool is_single_project ()
Returns whether or not this instance of ProjectConfigs contains data for
exactly one project.
Defined at line 83 of file ../../third_party/cobalt/src/registry/project_configs.h
bool is_empty ()
Returns whether or not this instance of ProjectConfigs contains no
project data.
Defined at line 87 of file ../../third_party/cobalt/src/registry/project_configs.h
uint32_t single_customer_id ()
If is_single_project() is true then this returns the customer ID of
the single project. Otherwise the return value is undefined.
Defined at line 91 of file ../../third_party/cobalt/src/registry/project_configs.h
std::string single_customer_name ()
If is_single_project() is true then this returns the customer name of
the single project. Otherwise the return value is undefined.
Defined at line 95 of file ../../third_party/cobalt/src/registry/project_configs.h
uint32_t single_project_id ()
If is_single_project() is true then this returns the project ID of
the single project. Otherwise the return value is undefined.
Defined at line 99 of file ../../third_party/cobalt/src/registry/project_configs.h
std::string single_project_name ()
If is_single_project() is true then this returns the project name of
the single project. Otherwise the return value is undefined.
Defined at line 103 of file ../../third_party/cobalt/src/registry/project_configs.h