Skip to content

Commit e47f32a

Browse files
ctronclaude
andcommitted
chore!: change all APIs to v3, or mark them deprecated
Co-authored-by: Claude <noreply@anthropic.com>
1 parent ecf520c commit e47f32a

49 files changed

Lines changed: 647 additions & 647 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/src/api/advisory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::common::{
44
new_delete_result,
55
};
66

7-
const ADVISORY_PATH: &str = "/v2/advisory";
7+
const ADVISORY_PATH: &str = "/v3/advisory";
88

99
pub async fn list(client: &ApiClient, params: &ListParams) -> Result<String, ApiError> {
1010
client.get_with_query(ADVISORY_PATH, params).await

cli/src/api/sbom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::common::{
1919
new_delete_result,
2020
};
2121

22-
const SBOM_PATH: &str = "/v2/sbom";
22+
const SBOM_PATH: &str = "/v3/sbom";
2323

2424
/// Parameters for find duplicates
2525
pub struct FindDuplicatesParams {

modules/analysis/src/endpoints/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct StatusQuery {
5353
(status = 200, description = "Analysis status", body = AnalysisStatus),
5454
),
5555
)]
56-
#[get("/v2/analysis/status")]
56+
#[get("/v3/analysis/status")]
5757
/// Get the status of the analysis service.
5858
pub async fn analysis_status(
5959
service: web::Data<AnalysisService>,
@@ -80,7 +80,7 @@ pub async fn analysis_status(
8080
(status = 200, description = "Retrieved component(s) located by an exact match of name, pURL, or CPE", body = PaginatedResults<Node>),
8181
),
8282
)]
83-
#[get("/v2/analysis/component/{key}")]
83+
#[get("/v3/analysis/component/{key}")]
8484
/// Retrieve SBOM components (packages) by name, Package URL, or CPE.
8585
pub async fn get_component(
8686
service: web::Data<AnalysisService>,
@@ -112,7 +112,7 @@ pub async fn get_component(
112112
(status = 200, description = "Retrieved component(s) located by search", body = PaginatedResults<Node>),
113113
),
114114
)]
115-
#[get("/v2/analysis/component")]
115+
#[get("/v3/analysis/component")]
116116
/// Retrieve SBOM components (packages) by a complex search.
117117
pub async fn search_component(
118118
service: web::Data<AnalysisService>,
@@ -143,7 +143,7 @@ pub async fn search_component(
143143
(status = 415, description = "Unsupported rendering format"),
144144
),
145145
)]
146-
#[get("/v2/analysis/sbom/{sbom}/render.{ext}")]
146+
#[get("/v3/analysis/sbom/{sbom}/render.{ext}")]
147147
/// Render an SBOM graph
148148
pub async fn render_sbom_graph(
149149
service: web::Data<AnalysisService>,
@@ -181,7 +181,7 @@ pub async fn render_sbom_graph(
181181
(status = 200, description = "Retrieved latest component(s) located by search", body = PaginatedResults<Node>),
182182
),
183183
)]
184-
#[get("/v2/analysis/latest/component")]
184+
#[get("/v3/analysis/latest/component")]
185185
/// Retrieve latest SBOM components (packages) by a complex search.
186186
pub async fn search_latest_component(
187187
service: web::Data<AnalysisService>,
@@ -211,7 +211,7 @@ pub async fn search_latest_component(
211211
(status = 200, description = "Retrieved latest component(s) located by an exact match of name, pURL, or CPE", body = PaginatedResults<Node>),
212212
),
213213
)]
214-
#[get("/v2/analysis/latest/component/{key}")]
214+
#[get("/v3/analysis/latest/component/{key}")]
215215
/// Retrieve latest SBOM components (packages) by name, Package URL, or CPE.
216216
pub async fn get_latest_component(
217217
service: web::Data<AnalysisService>,

modules/analysis/src/endpoints/tests/dot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async fn render_dot(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
1414
let sbom = sbom.id;
1515

1616
// Ensure child has an ancestor that includes it
17-
let uri = format!("/api/v2/analysis/sbom/{sbom}/render.dot");
17+
let uri = format!("/api/v3/analysis/sbom/{sbom}/render.dot");
1818
let request: Request = TestRequest::get().uri(&uri).to_request();
1919
let response: String = String::from_utf8(app.call_and_read_body(request).await.into())?;
2020
log::debug!("{response}");
@@ -57,7 +57,7 @@ async fn render_unsupported_ext(ctx: &TrustifyContext) -> Result<(), anyhow::Err
5757
let sbom = sbom.id;
5858

5959
// Ensure child has an ancestor that includes it
60-
let uri = format!("/api/v2/analysis/sbom/{sbom}/render.foo");
60+
let uri = format!("/api/v3/analysis/sbom/{sbom}/render.foo");
6161
let request: Request = TestRequest::get().uri(&uri).to_request();
6262
let response = app.call_service(request).await;
6363

modules/analysis/src/endpoints/tests/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ async fn test_status_endpoint(ctx: &TrustifyContext) -> Result<(), anyhow::Error
184184
})
185185
.await?;
186186

187-
let uri = "/api/v2/analysis/status";
187+
let uri = "/api/v3/analysis/status";
188188
let request: Request = TestRequest::get().uri(uri).to_request();
189189
let response: Value = app.call_and_read_body_json(request).await;
190190

@@ -194,7 +194,7 @@ async fn test_status_endpoint(ctx: &TrustifyContext) -> Result<(), anyhow::Error
194194
// ingest duplicate sbom which has different date
195195
ctx.ingest_documents(["spdx/simple-dup.json"]).await?;
196196

197-
let uri = "/api/v2/analysis/status";
197+
let uri = "/api/v3/analysis/status";
198198
let request: Request = TestRequest::get().uri(uri).to_request();
199199
let response: Value = app.call_and_read_body_json(request).await;
200200

modules/analysis/src/endpoints/tests/req.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<C: CallService> ReqExt for C {
6464
false => "",
6565
};
6666

67-
const BASE: &str = "/api/v2/analysis/";
67+
const BASE: &str = "/api/v3/analysis/";
6868

6969
let mut uri = match loc {
7070
What::None => {

modules/analysis/src/endpoints/tests/spdx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ async fn spdx_only_contains_relationships(ctx: &TrustifyContext) -> Result<(), a
249249
let purl = "pkg:rpm/redhat/rubygem-google-cloud-compute@0.5.0-1.el8sat?arch=src";
250250

251251
let uri = format!(
252-
"/api/v2/analysis/component/{}?descendants=10&relationships=contains",
252+
"/api/v3/analysis/component/{}?descendants=10&relationships=contains",
253253
urlencoding::encode(purl)
254254
);
255255
let request: Request = TestRequest::get().uri(&uri).to_request();

modules/fundamental/src/advisory/endpoints/label.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod default {
3838
(status = 200, description = "List all unique key/value labels from all Advisories", body = Vec<Value>),
3939
),
4040
)]
41-
#[get("/v2/advisory-labels")]
41+
#[get("/v3/advisory-labels")]
4242
/// List all unique key/value labels from all Advisories
4343
pub async fn all(
4444
db: web::Data<Database>,
@@ -67,7 +67,7 @@ pub async fn all(
6767
(status = 404, description = "The advisory could not be found"),
6868
),
6969
)]
70-
#[put("/v2/advisory/{id}/label")]
70+
#[put("/v3/advisory/{id}/label")]
7171
pub async fn set(
7272
advisory: web::Data<AdvisoryService>,
7373
db: web::Data<Database>,
@@ -99,7 +99,7 @@ pub async fn set(
9999
(status = 404, description = "The advisory could not be found"),
100100
),
101101
)]
102-
#[patch("/v2/advisory/{id}/label")]
102+
#[patch("/v3/advisory/{id}/label")]
103103
pub async fn update(
104104
advisory: web::Data<AdvisoryService>,
105105
id: web::Path<Id>,

modules/fundamental/src/advisory/endpoints/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub async fn get(
144144
(status = 404, description = "The advisory could not be found"),
145145
),
146146
)]
147-
#[delete("/v2/advisory/{key}")]
147+
#[delete("/v3/advisory/{key}")]
148148
/// Delete an advisory
149149
pub async fn delete(
150150
i: web::Data<IngestorService>,
@@ -201,7 +201,7 @@ const fn default_format() -> Format {
201201
(status = 400, description = "The file could not be parsed as an advisory"),
202202
)
203203
)]
204-
#[post("/v2/advisory")]
204+
#[post("/v3/advisory")]
205205
/// Upload a new advisory
206206
pub async fn upload(
207207
service: web::Data<IngestorService>,
@@ -248,7 +248,7 @@ pub async fn upload(
248248
(status = 404, description = "The document could not be found"),
249249
)
250250
)]
251-
#[get("/v2/advisory/{key}/download")]
251+
#[get("/v3/advisory/{key}/download")]
252252
/// Download an advisory document
253253
pub async fn download(
254254
db: web::Data<Database>,

modules/fundamental/src/advisory/endpoints/test.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ async fn upload_default_csaf_format(ctx: &TrustifyContext) -> Result<(), anyhow:
406406

407407
let payload = document_bytes("csaf/cve-2023-33201.json").await?;
408408

409-
let uri = "/api/v2/advisory";
409+
let uri = "/api/v3/advisory";
410410
let request = TestRequest::post()
411411
.uri(uri)
412412
.set_payload(payload)
@@ -444,7 +444,7 @@ async fn upload_default_csaf_format_multiple(ctx: &TrustifyContext) -> Result<()
444444
"csaf/rhsa-2024-2705.json",
445445
];
446446

447-
let uri = "/api/v2/advisory";
447+
let uri = "/api/v3/advisory";
448448

449449
for file in files {
450450
let payload = document_bytes(file).await?;
@@ -467,7 +467,7 @@ async fn upload_osv_format(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
467467
let app = caller(ctx).await?;
468468
let payload = document_bytes("osv/RUSTSEC-2021-0079.json").await?;
469469

470-
let uri = "/api/v2/advisory";
470+
let uri = "/api/v3/advisory";
471471
let request = TestRequest::post()
472472
.uri(uri)
473473
.set_payload(payload)
@@ -485,7 +485,7 @@ async fn upload_cve_format(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
485485
let app = caller(ctx).await?;
486486
let payload = document_bytes("mitre/CVE-2024-27088.json").await?;
487487

488-
let uri = "/api/v2/advisory";
488+
let uri = "/api/v3/advisory";
489489
let request = TestRequest::post()
490490
.uri(uri)
491491
.set_payload(payload)
@@ -502,7 +502,7 @@ async fn upload_cve_format(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
502502
async fn upload_unknown_format(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
503503
let app = caller(ctx).await?;
504504

505-
let uri = "/api/v2/advisory";
505+
let uri = "/api/v3/advisory";
506506
let request = TestRequest::post().uri(uri).to_request();
507507

508508
let response = app.call_service(request).await;
@@ -523,7 +523,7 @@ async fn upload_with_labels(ctx: &TrustifyContext) -> Result<(), anyhow::Error>
523523
let app = caller(ctx).await?;
524524
let payload = document_bytes("csaf/cve-2023-33201.json").await?;
525525

526-
let uri = "/api/v2/advisory?labels.foo=bar&labels.bar=baz";
526+
let uri = "/api/v3/advisory?labels.foo=bar&labels.bar=baz";
527527
let request = TestRequest::post()
528528
.uri(uri)
529529
.set_payload(payload)
@@ -565,7 +565,7 @@ async fn download_advisory(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
565565
let digest: String = Sha256::digest(document_bytes(DOC).await?).encode_hex();
566566
let app = caller(ctx).await?;
567567
ctx.ingest_document(DOC).await?;
568-
let uri = format!("/api/v2/advisory/sha256:{digest}/download");
568+
let uri = format!("/api/v3/advisory/sha256:{digest}/download");
569569
let request = TestRequest::get().uri(&uri).to_request();
570570
let doc: Value = app.call_and_read_body_json(request).await;
571571
assert_eq!(doc["document"]["tracking"]["id"], "CVE-2023-33201");
@@ -579,7 +579,7 @@ async fn download_advisory(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
579579
async fn download_advisory_by_id(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
580580
let app = caller(ctx).await?;
581581
let result = ctx.ingest_document(DOC).await?;
582-
let uri = format!("/api/v2/advisory/urn:uuid:{}/download", result.id);
582+
let uri = format!("/api/v3/advisory/urn:uuid:{}/download", result.id);
583583
let request = TestRequest::get().uri(&uri).to_request();
584584
let doc: Value = app.call_and_read_body_json(request).await;
585585
assert_eq!(doc["document"]["tracking"]["id"], "CVE-2023-33201");
@@ -624,7 +624,7 @@ async fn delete_advisory(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
624624
let response = app
625625
.call_service(
626626
TestRequest::delete()
627-
.uri(&format!("/api/v2/advisory/urn:uuid:{}", doc.id))
627+
.uri(&format!("/api/v3/advisory/urn:uuid:{}", doc.id))
628628
.to_request(),
629629
)
630630
.await;
@@ -647,7 +647,7 @@ async fn delete_advisory(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
647647
let response = app
648648
.call_service(
649649
TestRequest::delete()
650-
.uri(&format!("/api/v2/advisory/urn:uuid:{}", doc.id))
650+
.uri(&format!("/api/v3/advisory/urn:uuid:{}", doc.id))
651651
.to_request(),
652652
)
653653
.await;
@@ -743,7 +743,7 @@ async fn test_label(
743743
.id
744744
.to_string();
745745

746-
let mut uri = format!("/api/v2/advisory-labels?filter_text={}", encode(query));
746+
let mut uri = format!("/api/v3/advisory-labels?filter_text={}", encode(query));
747747

748748
if let Some(limit) = limit.into() {
749749
uri.push_str(&format!("&limit={limit}"));

0 commit comments

Comments
 (0)