-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gateway: Gateway support plugin instance (#671)
- Loading branch information
Showing
18 changed files
with
483 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,37 @@ | ||
use http::Extensions; | ||
use spacegate_shell::{kernel::extension::ExtensionPack as _, BoxError}; | ||
use tardis::serde_json::{self, Value}; | ||
|
||
use self::audit_log_param::LogParamContent; | ||
|
||
pub mod audit_log_param; | ||
pub mod before_encrypt_body; | ||
pub mod cert_info; | ||
pub mod request_crypto_status; | ||
|
||
pub enum ExtensionPackEnum { | ||
LogParamContent(), | ||
None, | ||
} | ||
|
||
impl From<String> for ExtensionPackEnum { | ||
fn from(value: String) -> Self { | ||
match value.as_str() { | ||
"log_content" => ExtensionPackEnum::LogParamContent(), | ||
_ => ExtensionPackEnum::None, | ||
} | ||
} | ||
} | ||
impl ExtensionPackEnum { | ||
pub fn to_value(&self, ext: &Extensions) -> Result<Option<Value>, BoxError> { | ||
match self { | ||
ExtensionPackEnum::LogParamContent() => { | ||
if let Some(ext) = LogParamContent::get(ext) { | ||
return Ok(Some(serde_json::to_value(ext)?)); | ||
} | ||
} | ||
ExtensionPackEnum::None => (), | ||
} | ||
Ok(None) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.