// Copyright (C) 2024 Simon Quigley // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef ARCHIVE_H #define ARCHIVE_H #include "source_package_publishing_history.h" #include "archive_permission.h" #include "binary_package_publishing_history.h" #include "archive_dependency.h" #include #include #include #include #include #ifndef LAUNCHPAD_API #ifdef BUILDING_LAUNCHPAD #define LAUNCHPAD_API __attribute__((visibility("default"))) #else #define LAUNCHPAD_API #endif #endif class launchpad; struct build_record { nlohmann::json data; }; class archive { public: archive(); ~archive(); static std::optional parse(const std::string& json_data); void parse_json(const std::string& json_data); void set_lp(launchpad* lp_ptr); int authorized_size; bool build_debug_symbols; std::string description; std::string displayname; std::string distribution_link; std::string external_dependencies; nlohmann::json metadata_overrides; std::string name; std::string owner_link; bool permit_obsolete_series_uploads; bool is_private; bool publish; bool publish_debug_symbols; std::string publishing_method; int relative_build_score; std::string repository_format; bool require_virtualized; std::string signing_key_fingerprint; bool suppress_subscription_notifications; std::string owner_name; std::string ppa_name; std::string self_link; std::string dependencies_collection_link; std::string enabled_restricted_processors_collection_link; std::string http_etag; std::string processors_collection_link; std::string reference; std::string resource_type_link; std::string status; std::string web_link; std::generator getPublishedSources(const std::string& status) const; std::generator getAllPermissions() const; std::optional checkUpload(const std::string& component, const std::string& distroseries, const std::string& person, const std::string& pocket, const std::string& sourcepackagename, bool strict_component = false) const; std::optional getArchiveDependency(const std::string& dependency_link) const; std::optional getBuildCounters(bool include_needsbuild = false) const; std::generator getBuildRecords(const std::string& build_state = "", const std::string& pocket = "", const std::string& source_name = "") const; std::optional getBuildSummariesForSourceIds(const std::vector& source_ids) const; std::generator getComponentsForQueueAdmin(const std::string& person_link) const; std::optional getNamedAuthToken(const std::string& name) const; std::optional getNamedAuthTokens(const std::vector& names = {}) const; std::generator getPackagesetsForSource(const std::string& sourcepackagename, bool direct_permissions = false) const; std::generator getPackagesetsForSourceUploader(const std::string& person_link, const std::string& sourcepackagename) const; std::generator getPackagesetsForUploader(const std::string& person_link) const; std::generator getPermissionsForPerson(const std::string& person_link) const; std::generator getPocketsForQueueAdmin(const std::string& person_link) const; std::generator getPocketsForUploader(const std::string& person_link) const; std::generator getPublishedBinaries(const std::string& binary_name = "", const std::string& component_name = "", const std::string& created_since_date = "", const std::string& distro_arch_series = "", bool exact_match = false, bool order_by_date = false, bool ordered = true, const std::string& pocket = "", const std::string& status = "", const std::string& version = "") const; std::generator getQueueAdminsForComponent(const std::string& component_name) const; std::generator getQueueAdminsForPocket(const std::string& distroseries, const std::string& pocket) const; std::optional getSigningKeyData() const; std::generator getUploadersForComponent(const std::string& component_name) const; std::generator getUploadersForPackage(const std::string& source_package_name) const; std::generator getUploadersForPackageset(const std::string& packageset, bool direct_permissions = false) const; std::generator getUploadersForPocket(const std::string& pocket) const; std::optional isSourceUploadAllowed(const std::string& distroseries, const std::string& person, const std::string& sourcepackagename) const; // Custom POST methods std::optional addArchiveDependency(const std::string& dependency_link, const std::string& component, const std::string& pocket) const; bool copyPackage(const std::string& from_archive, const std::string& from_pocket, const std::string& from_series, bool include_binaries, bool move, std::optional phased_update_percentage, bool silent, const std::string& source_name, const std::string& sponsored, const std::string& to_pocket, const std::string& to_series, bool unembargo, const std::string& version, bool auto_approve = false) const; bool copyPackages(const std::string& from_archive, const std::string& from_series, bool include_binaries, bool silent, const std::vector& source_names, const std::string& sponsored, const std::string& to_pocket, const std::string& to_series, bool unembargo, bool auto_approve = false) const; bool deleteComponentUploader(const std::string& component_name, const std::string& person) const; bool deletePackageUploader(const std::string& person, const std::string& source_package_name) const; bool deletePackagesetUploader(const std::string& packageset, const std::string& person, bool explicit_) const; bool deletePocketQueueAdmin(const std::string& distroseries, const std::string& person, const std::string& pocket) const; bool deletePocketUploader(const std::string& person, const std::string& pocket) const; bool deleteQueueAdmin(const std::string& component_name, const std::string& person) const; bool enableRestrictedProcessor(const std::string& processor) const; bool markSuiteDirty(const std::string& distroseries, const std::string& pocket) const; std::optional newComponentUploader(const std::string& component_name, const std::string& person) const; std::optional newNamedAuthToken(const std::string& name, const std::optional& token) const; std::optional newNamedAuthTokens(const std::vector& names) const; std::optional newPackageUploader(const std::string& person, const std::string& source_package_name) const; std::optional newPackagesetUploader(const std::string& packageset, const std::string& person, bool explicit_) const; std::optional newPocketQueueAdmin(const std::string& distroseries, const std::string& person, const std::string& pocket) const; std::optional newPocketUploader(const std::string& person, const std::string& pocket) const; std::optional newQueueAdmin(const std::string& component_name, const std::string& person) const; std::optional newSubscription(const std::string& subscriber, const std::optional& date_expires, const std::optional& description) const; bool removeArchiveDependency(const std::string& dependency_link) const; bool removeCopyNotification(const std::string& job_id) const; bool revokeNamedAuthToken(const std::string& name) const; bool revokeNamedAuthTokens(const std::vector& names) const; bool setProcessors(const std::vector& processors) const; bool syncSource(const std::string& from_archive, bool include_binaries, const std::string& source_name, const std::string& to_pocket, const std::string& to_series, const std::string& version) const; bool syncSources(const std::string& from_archive, const std::string& from_series, bool include_binaries, const std::vector& source_names, const std::string& to_pocket, const std::string& to_series) const; bool uploadCIBuild(const std::string& ci_build, const std::string& to_channel, const std::string& to_pocket, const std::string& to_series) const; private: std::string build_archive_endpoint() const; launchpad* lp; }; #endif // ARCHIVE_H