Module org.elasticsearch.xcore
Class RoleMappingMetadata
java.lang.Object
org.elasticsearch.cluster.AbstractNamedDiffable<Metadata.ProjectCustom>
org.elasticsearch.xpack.core.security.authz.RoleMappingMetadata
- All Implemented Interfaces:
Diffable<Metadata.ProjectCustom>,Metadata.MetadataCustom<Metadata.ProjectCustom>,Metadata.ProjectCustom,NamedDiffable<Metadata.ProjectCustom>,NamedWriteable,VersionedNamedWriteable,Writeable,ChunkedToXContent
public final class RoleMappingMetadata
extends AbstractNamedDiffable<Metadata.ProjectCustom>
implements Metadata.ProjectCustom
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRoleMappingMetadata(Set<ExpressionRoleMapping> roleMappings) RoleMappingMetadata(StreamInput input) -
Method Summary
Modifier and TypeMethodDescriptioncontext()static ExpressionRoleMappingcopyWithNameInMetadata(ExpressionRoleMapping roleMapping) Ensures role mapping names are preserved when stored on disk using XContent format, which omits names.booleanstatic RoleMappingMetadatafromXContent(org.elasticsearch.xcontent.XContentParser parser) static RoleMappingMetadatagetFromProject(ProjectMetadata project) booleanCheck if any of the role mappings have a fallback namestatic booleanhasFallbackName(ExpressionRoleMapping expressionRoleMapping) If a role mapping does not yet have a name persisted in metadata, it will use a constant fallback name.inthashCode()booleanisEmpty()static ExpressionRoleMappingparseWithNameFromMetadata(org.elasticsearch.xcontent.XContentParser parser) Parse a role mapping from XContent, restoring the name from a reserved metadata field.static NamedDiff<Metadata.ProjectCustom> readDiffFrom(StreamInput streamInput) toString()Iterator<? extends org.elasticsearch.xcontent.ToXContent> toXContentChunked(org.elasticsearch.xcontent.ToXContent.Params params) updateClusterState(ClusterState clusterState) Deprecated.updateProject(ProjectMetadata project) voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.cluster.AbstractNamedDiffable
diff, get, readDiffFromMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
isFragment, toXContentChunked, toXContentChunkedV8Methods inherited from interface org.elasticsearch.cluster.metadata.Metadata.MetadataCustom
isRestorableMethods inherited from interface org.elasticsearch.common.io.stream.VersionedNamedWriteable
supportsVersion
-
Field Details
-
TYPE
- See Also:
-
METADATA_NAME_FIELD
- See Also:
-
FALLBACK_NAME
- See Also:
-
-
Constructor Details
-
RoleMappingMetadata
-
RoleMappingMetadata
- Throws:
IOException
-
-
Method Details
-
getFromProject
-
getRoleMappings
-
isEmpty
public boolean isEmpty() -
updateClusterState
Deprecated. -
updateProject
-
readDiffFrom
public static NamedDiff<Metadata.ProjectCustom> readDiffFrom(StreamInput streamInput) throws IOException - Throws:
IOException
-
toXContentChunked
public Iterator<? extends org.elasticsearch.xcontent.ToXContent> toXContentChunked(org.elasticsearch.xcontent.ToXContent.Params params) - Specified by:
toXContentChunkedin interfaceChunkedToXContent
-
fromXContent
public static RoleMappingMetadata fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException - Throws:
IOException
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable- Specified by:
getWriteableNamein interfaceVersionedNamedWriteable
-
getMinimalSupportedVersion
- Specified by:
getMinimalSupportedVersionin interfaceVersionedNamedWriteable
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-
context
- Specified by:
contextin interfaceMetadata.MetadataCustom<Metadata.ProjectCustom>
-
copyWithNameInMetadata
Ensures role mapping names are preserved when stored on disk using XContent format, which omits names. This method copies the role mapping's name into a reserved metadata field during serialization, allowing recovery during deserialization (e.g., after a master-node restart).parseWithNameFromMetadata(XContentParser)restores the name during parsing. -
hasFallbackName
If a role mapping does not yet have a name persisted in metadata, it will use a constant fallback name. This method checks if a role mapping has the fallback name. -
hasAnyMappingWithFallbackName
public boolean hasAnyMappingWithFallbackName()Check if any of the role mappings have a fallback name- Returns:
- true if any role mappings have the fallback name
-
parseWithNameFromMetadata
public static ExpressionRoleMapping parseWithNameFromMetadata(org.elasticsearch.xcontent.XContentParser parser) throws IOException Parse a role mapping from XContent, restoring the name from a reserved metadata field. Used to parse a role mapping annotated with its name in metadata via @seecopyWithNameInMetadata(ExpressionRoleMapping).- Throws:
IOException
-