| #ifndef THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_REDFISH_GRPC_PASSTHROUGH_H_ |
| #define THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_REDFISH_GRPC_PASSTHROUGH_H_ |
| |
| #include <memory> |
| |
| #include "absl/base/no_destructor.h" |
| #include "absl/log/log.h" |
| #include "absl/status/status.h" |
| #include "absl/status/statusor.h" |
| #include "redfish_query_engine/redfish/transport/interface.h" |
| #include "proxy_config.pb.h" |
| #include "redfish_plugin.h" |
| #include "remote_credentials.h" |
| #include "request_response.h" |
| |
| namespace milotic { |
| class RedfishGrpcPassthroughPlugin : public RedfishPlugin { |
| public: |
| explicit RedfishGrpcPassthroughPlugin( |
| const milotic_grpc_proxy::Plugin::RedfishGrpc& config) |
| : config_(config) {} |
| |
| RequestAction PreprocessRequest(RedfishPlugin::RequestVerb verb, |
| ProxyRequest& request) override { |
| return RequestAction::kHandle; |
| } |
| |
| absl::StatusOr<ProxyResponse> HandleRequest( |
| RedfishPlugin::RequestVerb verb, |
| std::unique_ptr<ProxyRequest> request) override; |
| |
| absl::Status Subscribe(std::unique_ptr<ProxyRequest> /*request*/, |
| EventHandler* /*handler*/) override { |
| return absl::UnknownError("Function should never be called"); |
| } |
| |
| absl::Status Initialize(Proxy* proxy) override; |
| |
| static milotic::GrpcCredentialFetcher& GrpcCredentialFetcher() { |
| static absl::NoDestructor<milotic::GrpcCredentialFetcher> fetcher( |
| UnimplementedGrpcCredentialFetcher); |
| return *fetcher; |
| } |
| |
| private: |
| const milotic_grpc_proxy::Plugin::RedfishGrpc config_; |
| Proxy* proxy_; |
| std::unique_ptr<ecclesia::RedfishTransport> redfish_transport_; |
| }; |
| |
| } // namespace milotic |
| |
| #endif // THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_REDFISH_GRPC_PASSTHROUGH_H_ |