Policy class

Constructors

Policy({Map<String, int> cachePaths = const {}, int? cacheTtlSec, List<String> corsOrigins = const [], List<String> methods = const [], String? mode, int? orgRpm, int? perIpRpm, int? updatedAt, String? updatedBy, int? windowSec})
Returns a new Policy instance.

Properties

cachePaths ↔ Map<String, int>
CachePaths overrides CacheTTLSec per path PREFIX (key "/v1/models" → seconds). The longest matching prefix wins.
getter/setter pair
cacheTtlSec ↔ int?
CacheTTLSec is the org's default edge-cache TTL for its responses, in seconds; 0 means no caching. Unset inherits the platform default.
getter/setter pair
corsOrigins ↔ List<String>
CORSOrigins is the PLATFORM-scope CORS allowlist EdgeCORS admits: an exact origin, a bare host, or a "*.host" wildcard. Writable only by a SuperAdmin — CORS is evaluated before identity, so it has no tenant to scope to.
getter/setter pair
hashCode → int
The hash code for this object.
no setteroverride
methods ↔ List<String>
Methods is the allowlist of HTTP methods the edge accepts for this org. Empty means all are accepted.
getter/setter pair
mode ↔ String?
Mode is the abuse gate's posture for THIS scope: "shadow" scores traffic and records the verdict without acting on it, "live" enforces it. Unset means shadow. It is the one per-org field that does NOT inherit. Every other field here layers a platform default under the org's own value, which is right for a default: a tenant that sets no rate ceiling should get the platform's. Mode is not a default, it is an ARMING DECISION — it is what makes a statistical judgement start refusing real traffic — and inheriting it means arming one scope arms every tenant that never asked for it, without a write to their row and without anything in their config changing. So a tenant is live only if that tenant's OWN row says live, and the platform row's mode governs exactly one scope: the anonymous lane, which has no tenant of its own. It is also not self-service. Writing it requires SuperAdmin (see the /v1/gateway config op): the subject of an abuse control does not get to switch the control off.
getter/setter pair
orgRpm ↔ int?
OrgRPM is the org's OWN authenticated rate ceiling, requests per minute, as ScopeRateLimit enforces it. Unset inherits the platform default, then the static boot default.
getter/setter pair
perIpRpm ↔ int?
PerIPRPM is the PLATFORM-scope pre-auth flood cap: requests EdgeRateLimit admits per WindowSec from one client IP. SuperAdmin-only, same reason.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
updatedAt ↔ int?
UpdatedAt is the unix second this policy row was last written. Server-stamped; a client-supplied value is ignored.
getter/setter pair
updatedBy ↔ String?
UpdatedBy is the validated user id that wrote this policy row. Server-stamped; a client-supplied value is ignored.
getter/setter pair
windowSec ↔ int?
WindowSec is the window PerIPRPM is counted over, in seconds. SuperAdmin-only.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

fromJson(dynamic value) → Policy?
Returns a new Policy instance and imports its values from value if it's a Map, null otherwise.
listFromJson(dynamic json, {bool growable = false}) → List<Policy>
mapFromJson(dynamic json) → Map<String, Policy>
mapListFromJson(dynamic json, {bool growable = false}) → Map<String, List<Policy>>

Constants

requiredKeys → const Set<String>
The list of required keys that must be present in a JSON.