Flex Gateway新着情報
Governance新着情報
Monitoring API Manager| ポリシー違反のレポートの例については、 「Stream Payload Policy (ストリームペイロードポリシーの収集)」を参照してください。 |
PDK には、ポリシー違反をレポートする関数があります。レポートされたポリシー違反は、Anypoint Monitoring に表示されます。
要求に対して一度に 1 つのポリシー違反のみがアクティブになります。新しい違反が発生すると、既存の違反が上書きされます。複数のポリシーで 1 つの要求の違反が生成されても、Anypoint Monitoring には 1 つの違反のみが表示されます。
ポリシー違反がレポートされても、要求は拒否されません。要求を拒否するには、要求実行の停止を参照してください。
現在のポリシー違反を表示したり、新しいポリシー違反を生成するには、次の PDK 関数を使用します。
/// Returns the existing policy violation of the current request. Returns None if no violation exists.
pub fn policy_violation(&self) -> Option<PolicyViolation>;
/// Generates a new policy violation for the current request. If a violation was previously generated, the previous violation is overridden.
pub fn generate_policy_violation(&self);
/// Generates a new policy violation with the client application details for the current request. This overwrites any previous policy violations.
pub fn generate_policy_violation_for_client_app<T: Into<String>, K: Into<String>>(
&self,
client_name: T,
client_id: K,
);
現在のポリシー違反に関する情報を取得するには、次の PDK 関数を使用します。
/// The name of the policy that generated the violation
pub fn get_policy_name(&self) -> &str;
/// Client name associated with the violation, only available if a previous policy reported the client ID
pub fn get_client_name(&self) -> Option<&str>;
/// Client ID associated with the violation, only available if a previous policy reported the client ID
pub fn get_client_id(&self) -> Option<&str>;