Skip to content

Commit

Permalink
feat: Add list_endpoints to internal server (#1823)
Browse files Browse the repository at this point in the history
  • Loading branch information
chubei authored Aug 11, 2023
1 parent d9626eb commit 3349ade
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
18 changes: 17 additions & 1 deletion dozer-api/src/grpc/internal/internal_pipeline_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use dozer_types::grpc_types::internal::internal_pipeline_service_server::{
InternalPipelineService, InternalPipelineServiceServer,
};
use dozer_types::grpc_types::internal::{
BuildRequest, BuildResponse, LogRequest, LogResponse, StorageRequest, StorageResponse,
BuildRequest, BuildResponse, EndpointResponse, EndpointsResponse, LogRequest, LogResponse,
StorageRequest, StorageResponse,
};
use dozer_types::log::info;
use dozer_types::models::api_config::AppGrpcOptions;
Expand Down Expand Up @@ -53,6 +54,21 @@ impl InternalPipelineService for InternalPipelineServer {
}))
}

async fn list_endpoints(
&self,
_request: Request<()>,
) -> Result<Response<EndpointsResponse>, Status> {
let endpoints = self
.endpoints
.iter()
.map(|(endpoint, build)| EndpointResponse {
endpoint: endpoint.clone(),
build_name: build.build.id.name().to_string(),
})
.collect();
Ok(Response::new(EndpointsResponse { endpoints }))
}

async fn describe_build(
&self,
request: Request<BuildRequest>,
Expand Down
12 changes: 12 additions & 0 deletions dozer-types/protos/internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ syntax = "proto3";

package dozer.internal;

import "google/protobuf/empty.proto";

service InternalPipelineService {
rpc DescribeStorage(StorageRequest) returns (StorageResponse);
rpc ListEndpoints(google.protobuf.Empty) returns (EndpointsResponse);
rpc DescribeBuild(BuildRequest) returns (BuildResponse);
/// For every `LogRequest` sent, the server will reply one `LogResponse`.
rpc GetLog(stream LogRequest) returns (stream LogResponse);
Expand All @@ -29,6 +32,15 @@ message StorageResponse {
};
}

message EndpointResponse {
string endpoint = 1;
string build_name = 2;
}

message EndpointsResponse {
repeated EndpointResponse endpoints = 1;
}

message BuildRequest {
string endpoint = 1;
}
Expand Down

0 comments on commit 3349ade

Please sign in to comment.