removeAccountPolicyRule method

  1. @override
Future<WaasPolicyLayerResponse> removeAccountPolicyRule(
  1. String businessAccountId,
  2. String ruleId
)
override

Removes one rule from a business-account policy layer.

Implementation

@override
Future<WaasPolicyLayerResponse> removeAccountPolicyRule(String businessAccountId, String ruleId) async {
  Future<WaasPolicyLayerResponse> instrumentationOperation() async {
    final operationScope = _state.flowScope.capture(replace: false);
    await operationScope.ready();
    if (!_state.initialized) {
      throw DynamicStateException("call initialize() before using the client");
    }
    if (_state.token == null) {
      throw DynamicStateException("not authenticated — sign in first");
    }
    operationScope.check();
    final layer = await _api.patch<WaasPolicyLayerResponse>(path: "/businessAccounts/${Uri.encodeComponent(businessAccountId)}/policy-layer", body: <String, dynamic>{"op": "remove", "ruleId": ruleId}, token: _state.token, sessionPublicKey: _state.sessionPublicKey, parse: WaasPolicyLayerResponse.fromJson);
    operationScope.check();
    return layer;
  }
  return await _api.instrumentation.runAsync("policyEngine.removeAccountPolicyRule", instrumentationOperation);
}