Skip to content

Commit ca55427

Browse files
Remove code for fetching collector auth tokens (#1801)
1 parent 4be5f5e commit ca55427

File tree

11 files changed

+0
-358
lines changed

11 files changed

+0
-358
lines changed

app/src/ApiClient.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,6 @@ export class ApiClient {
305305
return res.data as Task;
306306
}
307307

308-
async taskCollectorAuthTokens(taskId: string): Promise<CollectorAuthToken[]> {
309-
const res = await this.get(`/api/tasks/${taskId}/collector_auth_tokens`);
310-
return res.data as CollectorAuthToken[];
311-
}
312-
313308
async deleteMembership(membershipId: string): Promise<null> {
314309
await this.delete(`/api/memberships/${membershipId}`);
315310
return null;

app/src/tasks/TaskDetail/CollectorAuthTokens.tsx

Lines changed: 0 additions & 65 deletions
This file was deleted.

app/src/tasks/TaskDetail/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Task } from "../../ApiClient";
77
import "@github/relative-time-element";
88
import { AccountBreadcrumbs } from "../../util";
99
import Placeholder from "react-bootstrap/Placeholder";
10-
import CollectorAuthTokens from "./CollectorAuthTokens";
1110
import Metrics from "./Metrics";
1211
import ClientConfig from "./ClientConfig";
1312
import TaskPropertyTable from "./TaskPropertyTable";
@@ -63,7 +62,6 @@ export default function TaskDetail() {
6362
<TaskPropertyTable />
6463
<ClientConfig />
6564
<Metrics />
66-
<CollectorAuthTokens />
6765
</Row>
6866
</>
6967
);

app/src/tasks/index.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,6 @@ export default function tasks(apiClient: ApiClient): RouteObject {
6464
throw new Error(`unexpected method ${request.method}`);
6565
}
6666
},
67-
children: [
68-
{
69-
path: "collector_auth_tokens",
70-
loader({ params }) {
71-
return defer({
72-
collectorAuthTokens: apiClient.taskCollectorAuthTokens(
73-
params.taskId as string,
74-
),
75-
});
76-
},
77-
},
78-
],
7967
},
8068
{
8169
path: "new",

cli/src/tasks.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ pub enum TaskAction {
8888
#[arg(long, action, conflicts_with = "expiration")]
8989
now: bool,
9090
},
91-
92-
/// retrieve the collector auth tokens for a task
93-
CollectorAuthTokens { task_id: String },
9491
}
9592

9693
impl TaskAction {
@@ -274,9 +271,6 @@ impl TaskAction {
274271
output.display(client.rename_task(&task_id, &name).await?)
275272
}
276273

277-
TaskAction::CollectorAuthTokens { task_id } => {
278-
output.display(client.task_collector_auth_tokens(&task_id).await?)
279-
}
280274
TaskAction::Delete { task_id, force } => {
281275
if force {
282276
client.force_delete_task(&task_id).await?

client/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,6 @@ impl DivviupClient {
278278
.await
279279
}
280280

281-
pub async fn task_collector_auth_tokens(
282-
&self,
283-
task_id: &str,
284-
) -> ClientResult<Vec<CollectorAuthenticationToken>> {
285-
self.get(&format!("api/tasks/{task_id}/collector_auth_tokens"))
286-
.await
287-
}
288-
289281
pub async fn rename_task(&self, task_id: &str, new_name: &str) -> ClientResult<Task> {
290282
self.patch(&format!("api/tasks/{task_id}"), &json!({"name": new_name}))
291283
.await

client/tests/integration/tasks.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -157,33 +157,3 @@ async fn force_delete_task(
157157
assert!(response_tasks.is_empty());
158158
Ok(())
159159
}
160-
161-
#[test(harness = with_configured_client)]
162-
async fn collector_auth_tokens_no_token_hash(
163-
app: Arc<DivviupApi>,
164-
account: Account,
165-
client: DivviupClient,
166-
) -> TestResult {
167-
let task = fixtures::task(&app, &account).await;
168-
169-
let mut leader = task.leader_aggregator(app.db()).await?.into_active_model();
170-
leader.features = ActiveValue::Set(Features::default().into());
171-
leader.update(app.db()).await?;
172-
173-
let tokens = client.task_collector_auth_tokens(&task.id).await?;
174-
assert!(!tokens.is_empty()); // we don't have aggregator-api client logs here
175-
Ok(())
176-
}
177-
178-
#[test(harness = with_configured_client)]
179-
async fn collector_auth_tokens_token_hash(
180-
app: Arc<DivviupApi>,
181-
account: Account,
182-
client: DivviupClient,
183-
) -> TestResult {
184-
let task = fixtures::task(&app, &account).await;
185-
let leader = task.leader_aggregator(app.db()).await?;
186-
assert!(leader.features.token_hash_enabled());
187-
assert!(client.task_collector_auth_tokens(&task.id).await.is_err());
188-
Ok(())
189-
}

documentation/openapi.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -235,37 +235,6 @@ paths:
235235
"404":
236236
description: Not Found
237237

238-
/tasks/{task_id}/collector_auth_tokens:
239-
get:
240-
parameters:
241-
- in: path
242-
name: task_id
243-
schema:
244-
type: string
245-
required: true
246-
description: UUID of the task
247-
tags: ["tasks"]
248-
summary: retrieve the collector auth tokens for the task specified by `task_id`
249-
description: retrieve the collector auth tokens for the task specified by `task_id`
250-
operationId: showTaskCollectorAuthTokens
251-
responses:
252-
"200":
253-
description: success
254-
content:
255-
application/vnd.divviup+json;version=0.1:
256-
schema:
257-
type: array
258-
items:
259-
type: object
260-
properties:
261-
type:
262-
type: string
263-
enum: [bearer]
264-
token:
265-
type: string
266-
"404":
267-
$ref: "#/components/responses/NotFound"
268-
269238
/accounts/{account_id}/tasks:
270239
parameters:
271240
- $ref: "#/components/parameters/AccountId"

src/routes.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ fn api_routes() -> impl Handler {
6565
.post("/accounts", api(accounts::create))
6666
.delete("/memberships/:membership_id", api(memberships::delete))
6767
.get("/tasks/:task_id", api(tasks::show))
68-
.get(
69-
"/tasks/:task_id/collector_auth_tokens",
70-
api(tasks::collector_auth_tokens::index),
71-
)
7268
.patch("/tasks/:task_id", api(tasks::update))
7369
.delete("/tasks/:task_id", api(tasks::delete))
7470
.patch("/aggregators/:aggregator_id", api(aggregators::update))

src/routes/tasks.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,3 @@ pub async fn delete(
177177
am.update(&db).await?;
178178
Ok(Status::NoContent)
179179
}
180-
181-
pub mod collector_auth_tokens {
182-
use super::*;
183-
pub async fn index(
184-
conn: &mut Conn,
185-
(task, db, State(client)): (Task, Db, State<Client>),
186-
) -> Result<impl Handler, Error> {
187-
let leader = task.leader_aggregator(&db).await?;
188-
if leader.features.token_hash_enabled() {
189-
Err(Error::NotFound)
190-
} else {
191-
let crypter = conn.state().unwrap();
192-
let client = leader.client(client, crypter)?;
193-
let task_response = client.get_task(&task.id).await?;
194-
Ok(Json([task_response.collector_auth_token]))
195-
}
196-
}
197-
}

0 commit comments

Comments
 (0)