Class PolicyExpression
oneOf union members used throughout the IAM
access-control schemas - the permissions/intersect/subtract entries of an
AccessPolicy, PermissionSet and PrincipalPolicy, and the
managedPolicies/managedPermissionSets/subtract fields of a
PolicyMask.
Each of these union members may be:
- a bare string - a literal such as
"none"/"all", an Equinix Resource Name (ERN), apermissionset:/managedset:/managedpolicy:id, etc.; or - a structured value - an inline-permission object, a foreign-access-policy reference, a
general permission-set reference, an array of ids, a
subtractobject, and so on.
Rather than collapsing this to a raw Object (which loses type fidelity and is awkward
to inspect), a PolicyExpression preserves whichever form was received on read and emits
exactly that form on write. Internally it carries the underlying JsonNode verbatim, so
both the string and structured shapes round-trip losslessly; serialization simply re-emits
the captured node via toJsonNode() (annotated JsonValue), and deserialization
captures any incoming JSON via fromJsonNode(JsonNode) (annotated JsonCreator).
Convenience accessors (isString(), asString(), isArray(),
asStringList(), isObject()) let callers branch on the form without depending on
Jackson types, while toJsonNode() exposes the full structure for richer navigation.
-
Method Summary
Modifier and TypeMethodDescriptionasString()Returns the array members as strings when this entry is an array of textual values, otherwisenull.booleanstatic PolicyExpressionfromJsonNode(com.fasterxml.jackson.databind.JsonNode node) Captures an arbitrary deserialized JSON value (string, array or object) verbatim.inthashCode()booleanisArray()booleanisObject()booleanisString()static PolicyExpressionof(com.fasterxml.jackson.databind.JsonNode node) Wraps an already-built structured node (e.g. an inline-permission object or asubtractobject) verbatim.static PolicyExpressionCreates aPolicyExpressionfrom a bare string member (e.g.static PolicyExpressionCreates aPolicyExpressionfrom a list of string members (e.g. an array ofmanagedpolicy:ids), preserving the array form on write.com.fasterxml.jackson.databind.JsonNodeExposes the underlying JSON node verbatim for full structural navigation, and is the value Jackson serializes (so the captured form is re-emitted exactly).toString()
-
Method Details
-
fromJsonNode
Captures an arbitrary deserialized JSON value (string, array or object) verbatim. Used by Jackson when deserializing a union member.- Parameters:
node- the raw JSON node (nevernullin practice;null/missing maps to a JSON null node)- Returns:
- a
PolicyExpressionwrapping the node
-
of
Creates aPolicyExpressionfrom a bare string member (e.g."none", an ERN, or a permission-set id).- Parameters:
value- the string value- Returns:
- a string-form
PolicyExpression
-
ofStrings
Creates aPolicyExpressionfrom a list of string members (e.g. an array ofmanagedpolicy:ids), preserving the array form on write.- Parameters:
values- the string values- Returns:
- an array-form
PolicyExpression
-
of
Wraps an already-built structured node (e.g. an inline-permission object or asubtractobject) verbatim.- Parameters:
node- the structured JSON node- Returns:
- a structured-form
PolicyExpression
-
isString
public boolean isString()- Returns:
truewhen this entry is a bare JSON string
-
isArray
public boolean isArray()- Returns:
truewhen this entry is a JSON array
-
isObject
public boolean isObject()- Returns:
truewhen this entry is a structured JSON object
-
asString
- Returns:
- the string value when
isString(), otherwisenull
-
asStringList
-
toJsonNode
public com.fasterxml.jackson.databind.JsonNode toJsonNode()Exposes the underlying JSON node verbatim for full structural navigation, and is the value Jackson serializes (so the captured form is re-emitted exactly).- Returns:
- the underlying
JsonNode
-
equals
-
hashCode
-
toString
-