Files
zeekayandHanzo Dev 472238ddb0 cd: the API is /v1, not /api/v1 — no /api prefix anywhere
House rule: /v1/ is the API prefix, everywhere, and /api/ is never added on
top of it. The api.* subdomain names the API; a path prefix restating it is
noise. This applies it to the whole route surface:

  /api/v1/*      -> /v1/*        106 proto annotations, 109 gateway patterns
  /api/version   -> /v1/version
  /api/badge     -> /v1/badge
  /api/webhook   -> /v1/webhook  (server + applicationset controller)
  /api/dex/*     -> /v1/dex/*    (constants; dex is built, not deployed)

The grpc-gateway .pb.gw.go files are generated, and the plugin toolchain is
not on this machine, so they were rewritten by a script that applies exactly
the transform codegen would: for /api/v1 paths, drop the leading "api"
literal-push opcode pair and decrement every LitPush(2,N)/Capture(5,N) pool
index; for /api/version, rename the segment. ConcatN(4,N) operands are
counts, not pool indexes, and are untouched. The .proto annotations moved in
the same commit, so the next real codegen run is a no-op against these files.

MustPattern panics at package init on a malformed pattern, so every rewritten
pattern is validated by any import of pkg/apiclient — those tests pass.

Also moved: assets/swagger.json (82 paths), the UI's two roots (apiRoot()
'/v1', version-service '/v1/version') and its two relative composers (app
logs download, badge panel), the five audit-pattern regexes in server.go, and
the tests that asserted the old paths. terminal_test's request URL claimed
/api/v1/terminal, a route that never existed — the handler is mounted at
/terminal; the fixture now says so.

NOT touched, deliberately: /api/v3 in GitHub Enterprise base-url examples
(GitHub's URL shape, not ours), util/vendored/kubeclientmetrics (parses the
KUBERNETES API server's /api/v1 paths), and util/http's cookie-path fixture
(arbitrary string exercising slash normalization).

go build ./... clean. Pre-existing failures in badge/session/webhook/account
tests reproduce identically on the parent commit (rebrand fallout — badge
colors, cookie name length, dex issuer) and are not made worse here.

External consumers checked: universe has zero references to cd.hanzo.ai/api;
the CLI speaks gRPC, not the REST gateway; UI and server ship in one image so
they move together.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-29 12:01:34 -07:00

261 lines
8.7 KiB
Protocol Buffer

syntax = "proto3";
option go_package = "github.com/hanzoai/cd/pkg/apiclient/repository";
// Repository Service
//
// Repository Service API performs CRUD actions against repository resources
package repository;
import "google/api/annotations.proto";
import "github.com/hanzoai/cd/pkg/apis/application/v1alpha1/generated.proto";
import "github.com/hanzoai/cd/reposerver/repository/repository.proto";
// RepoAppsQuery is a query for Repository apps
message RepoAppsQuery {
string repo = 1;
string revision = 2;
string appName = 3;
string appProject = 4;
}
// AppInfo contains application type and app file path
message AppInfo {
string type = 1;
string path = 2;
}
// RepoAppDetailsQuery contains query information for app details request
message RepoAppDetailsQuery {
github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.ApplicationSource source = 1;
string appName = 2;
string appProject = 3;
// source index (for multi source apps)
int32 sourceIndex = 4;
// versionId from historical data (for multi source apps)
int32 versionId = 5;
}
// RepoAppsResponse contains applications of specified repository
message RepoAppsResponse {
repeated AppInfo items = 1;
}
// RepoQuery is a query for Repository resources
message RepoQuery {
// Repo URL for query
string repo = 1;
// Whether to force a cache refresh on repo's connection state
bool forceRefresh = 2;
// App project for query
string appProject = 3;
}
// RepoAccessQuery is a query for checking access to a repo
message RepoAccessQuery {
// The URL to the repo
string repo = 1;
// Username for accessing repo
string username = 2;
// Password for accessing repo
string password = 3;
// Private key data for accessing SSH repository
string sshPrivateKey = 4;
// Whether to skip certificate or host key validation
bool insecure = 5;
// TLS client cert data for accessing HTTPS repository
string tlsClientCertData = 6;
// TLS client cert key for accessing HTTPS repository
string tlsClientCertKey = 7;
// The type of the repo
string type = 9;
// The name of the repo
string name = 10;
// Whether helm-oci support should be enabled for this repo
bool enableOci = 11;
// Github App Private Key PEM data
string githubAppPrivateKey = 12;
// Github App ID of the app used to access the repo
int64 githubAppID = 13;
// Github App Installation ID of the installed GitHub App
int64 githubAppInstallationID = 14;
// Github App Enterprise base url if empty will default to https://api.github.com
string githubAppEnterpriseBaseUrl = 15;
// HTTP/HTTPS proxy to access the repository
string proxy = 16;
// Reference between project and repository that allow you automatically to be added as item inside SourceRepos project entity
string project = 17;
// Google Cloud Platform service account key
string gcpServiceAccountKey = 18;
// Whether to force HTTP basic auth
bool forceHttpBasicAuth = 19;
// Whether to use azure workload identity for authentication
bool useAzureWorkloadIdentity = 20;
// BearerToken contains the bearer token used for Git auth at the repo server
string bearerToken = 21;
// Whether https should be disabled for an OCI repo
bool insecureOciForceHttp = 22;
// Azure Service Principal Client ID
string azureServicePrincipalClientId = 23;
// Azure Service Principal Client Secret
string azureServicePrincipalClientSecret = 24;
// Azure Service Principal Tenant ID
string azureServicePrincipalTenantId = 25;
// Azure Active Directory Endpoint
string azureActiveDirectoryEndpoint = 26;
}
message RepoResponse {}
// RepoCreateRequest is a request for creating repository config
message RepoCreateRequest {
// Repository definition
github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository repo = 1;
// Whether to create in upsert mode
bool upsert = 2;
// Whether to operate on credential set instead of repository
bool credsOnly = 3;
}
message RepoUpdateRequest {
github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository repo = 1;
}
// RepositoryService
service RepositoryService {
// List returns list of repos or repository credentials
rpc List(RepoQuery) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.RepositoryList) {
option (google.api.http).get = "/v1/repositories";
option deprecated = true;
}
// Get returns a repository or its credentials
rpc Get(RepoQuery) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http).get = "/v1/repositories/{repo}";
}
// GetWrite returns a repository or its write credentials
rpc GetWrite(RepoQuery) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http).get = "/v1/write-repositories/{repo}";
}
// ListRepositories gets a list of all configured repositories
rpc ListRepositories(RepoQuery) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.RepositoryList) {
option (google.api.http).get = "/v1/repositories";
}
// ListWriteRepositories gets a list of all configured write repositories
rpc ListWriteRepositories(RepoQuery) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.RepositoryList) {
option (google.api.http).get = "/v1/write-repositories";
}
rpc ListRefs(RepoQuery) returns (Refs) {
option (google.api.http).get = "/v1/repositories/{repo}/refs";
}
rpc ListOCITags(RepoQuery) returns (Refs) {
option (google.api.http).get = "/v1/repositories/{repo}/oci-tags";
}
// ListApps returns list of apps in the repo
rpc ListApps(RepoAppsQuery) returns (RepoAppsResponse) {
option (google.api.http).get = "/v1/repositories/{repo}/apps";
}
// GetAppDetails returns application details by given path
rpc GetAppDetails(RepoAppDetailsQuery) returns (repository.RepoAppDetailsResponse) {
option (google.api.http) = {
post: "/v1/repositories/{source.repoURL}/appdetails"
body: "*"
};
}
// GetHelmCharts returns list of helm charts in the specified repository
rpc GetHelmCharts(RepoQuery) returns (repository.HelmChartsResponse) {
option (google.api.http).get = "/v1/repositories/{repo}/helmcharts";
}
// Create creates a repo or a repo credential set
rpc Create(RepoCreateRequest) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http) = {
post: "/v1/repositories"
body: "repo"
};
option deprecated = true;
}
// CreateRepository creates a new repository configuration
rpc CreateRepository(RepoCreateRequest) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http) = {
post: "/v1/repositories"
body: "repo"
};
}
// CreateWriteRepository creates a new write repository configuration
rpc CreateWriteRepository(RepoCreateRequest) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http) = {
post: "/v1/write-repositories"
body: "repo"
};
}
// Update updates a repo or repo credential set
rpc Update(RepoUpdateRequest) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http) = {
put: "/v1/repositories/{repo.repo}"
body: "repo"
};
option deprecated = true;
}
// UpdateRepository updates a repository configuration
rpc UpdateRepository(RepoUpdateRequest) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http) = {
put: "/v1/repositories/{repo.repo}"
body: "repo"
};
}
// UpdateWriteRepository updates a write repository configuration
rpc UpdateWriteRepository(RepoUpdateRequest) returns (github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.Repository) {
option (google.api.http) = {
put: "/v1/write-repositories/{repo.repo}"
body: "repo"
};
}
// Delete deletes a repository from the configuration
rpc Delete(RepoQuery) returns (RepoResponse) {
option (google.api.http).delete = "/v1/repositories/{repo}";
option deprecated = true;
}
// DeleteRepository deletes a repository from the configuration
rpc DeleteRepository(RepoQuery) returns (RepoResponse) {
option (google.api.http).delete = "/v1/repositories/{repo}";
}
// DeleteWriteRepository deletes a write repository from the configuration
rpc DeleteWriteRepository(RepoQuery) returns (RepoResponse) {
option (google.api.http).delete = "/v1/write-repositories/{repo}";
}
// ValidateAccess validates access to a repository with given parameters
rpc ValidateAccess(RepoAccessQuery) returns (RepoResponse) {
option (google.api.http) = {
post: "/v1/repositories/{repo}/validate"
body: "repo"
};
}
// ValidateWriteAccess validates write access to a repository with given parameters
rpc ValidateWriteAccess(RepoAccessQuery) returns (RepoResponse) {
option (google.api.http) = {
post: "/v1/write-repositories/{repo}/validate"
body: "repo"
};
}
}