Package com.github.udpa.udpa.type.v1
Class TypedStruct
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite
-
- com.google.protobuf.AbstractMessage
-
- com.google.protobuf.GeneratedMessageV3
-
- com.github.udpa.udpa.type.v1.TypedStruct
-
- All Implemented Interfaces:
TypedStructOrBuilder,com.google.protobuf.Message,com.google.protobuf.MessageLite,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Serializable
public final class TypedStruct extends com.google.protobuf.GeneratedMessageV3 implements TypedStructOrBuilder
A TypedStruct contains an arbitrary JSON serialized protocol buffer message with a URL that describes the type of the serialized message. This is very similar to google.protobuf.Any, instead of having protocol buffer binary, this employs google.protobuf.Struct as value. This message is intended to be embedded inside Any, so it shouldn't be directly referred from other UDPA messages. When packing an opaque extension config, packing the expected type into Any is preferred wherever possible for its efficiency. TypedStruct should be used only if a proto descriptor is not available, for example if: - A control plane sends opaque message that is originally from external source in human readable format such as JSON or YAML. - The control plane doesn't have the knowledge of the protocol buffer schema hence it cannot serialize the message in protocol buffer binary format. - The DPLB doesn't have have the knowledge of the protocol buffer schema its plugin or extension uses. This has to be indicated in the DPLB capability negotiation. When a DPLB receives a TypedStruct in Any, it should: - Check if the type_url of the TypedStruct matches the type the extension expects. - Convert value to the type described in type_url and perform validation. TODO(lizan): Figure out how TypeStruct should be used with DPLB extensions that doesn't link protobuf descriptor with DPLB itself, (e.g. gRPC LB Plugin, Envoy WASM extensions).
Protobuf typeudpa.type.v1.TypedStruct- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTypedStruct.BuilderA TypedStruct contains an arbitrary JSON serialized protocol buffer message with a URL that describes the type of the serialized message.-
Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter
-
-
Field Summary
Fields Modifier and Type Field Description static intTYPE_URL_FIELD_NUMBERstatic intVALUE_FIELD_NUMBER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)static TypedStructgetDefaultInstance()TypedStructgetDefaultInstanceForType()static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Parser<TypedStruct>getParserForType()intgetSerializedSize()StringgetTypeUrl()A URL that uniquely identifies the type of the serialize protocol buffer message.com.google.protobuf.ByteStringgetTypeUrlBytes()A URL that uniquely identifies the type of the serialize protocol buffer message.com.google.protobuf.UnknownFieldSetgetUnknownFields()com.google.protobuf.StructgetValue()A JSON representation of the above specified type.com.google.protobuf.StructOrBuildergetValueOrBuilder()A JSON representation of the above specified type.inthashCode()booleanhasValue()A JSON representation of the above specified type.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()booleanisInitialized()static TypedStruct.BuildernewBuilder()static TypedStruct.BuildernewBuilder(TypedStruct prototype)TypedStruct.BuildernewBuilderForType()protected TypedStruct.BuildernewBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)protected ObjectnewInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)static TypedStructparseDelimitedFrom(InputStream input)static TypedStructparseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static TypedStructparseFrom(byte[] data)static TypedStructparseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static TypedStructparseFrom(com.google.protobuf.ByteString data)static TypedStructparseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static TypedStructparseFrom(com.google.protobuf.CodedInputStream input)static TypedStructparseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static TypedStructparseFrom(InputStream input)static TypedStructparseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static TypedStructparseFrom(ByteBuffer data)static TypedStructparseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)static com.google.protobuf.Parser<TypedStruct>parser()TypedStruct.BuildertoBuilder()voidwriteTo(com.google.protobuf.CodedOutputStream output)-
Methods inherited from class com.google.protobuf.GeneratedMessageV3
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTag
-
Methods inherited from class com.google.protobuf.AbstractMessage
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
TYPE_URL_FIELD_NUMBER
public static final int TYPE_URL_FIELD_NUMBER
- See Also:
- Constant Field Values
-
VALUE_FIELD_NUMBER
public static final int VALUE_FIELD_NUMBER
- See Also:
- Constant Field Values
-
-
Method Detail
-
newInstance
protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
- Overrides:
newInstancein classcom.google.protobuf.GeneratedMessageV3
-
getUnknownFields
public final com.google.protobuf.UnknownFieldSet getUnknownFields()
- Specified by:
getUnknownFieldsin interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3
-
getTypeUrl
public String getTypeUrl()
A URL that uniquely identifies the type of the serialize protocol buffer message. This has same semantics and format described in google.protobuf.Any: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto
string type_url = 1;- Specified by:
getTypeUrlin interfaceTypedStructOrBuilder- Returns:
- The typeUrl.
-
getTypeUrlBytes
public com.google.protobuf.ByteString getTypeUrlBytes()
A URL that uniquely identifies the type of the serialize protocol buffer message. This has same semantics and format described in google.protobuf.Any: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto
string type_url = 1;- Specified by:
getTypeUrlBytesin interfaceTypedStructOrBuilder- Returns:
- The bytes for typeUrl.
-
hasValue
public boolean hasValue()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;- Specified by:
hasValuein interfaceTypedStructOrBuilder- Returns:
- Whether the value field is set.
-
getValue
public com.google.protobuf.Struct getValue()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;- Specified by:
getValuein interfaceTypedStructOrBuilder- Returns:
- The value.
-
getValueOrBuilder
public com.google.protobuf.StructOrBuilder getValueOrBuilder()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;- Specified by:
getValueOrBuilderin interfaceTypedStructOrBuilder
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3
-
writeTo
public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException- Specified by:
writeToin interfacecom.google.protobuf.MessageLite- Overrides:
writeToin classcom.google.protobuf.GeneratedMessageV3- Throws:
IOException
-
getSerializedSize
public int getSerializedSize()
- Specified by:
getSerializedSizein interfacecom.google.protobuf.MessageLite- Overrides:
getSerializedSizein classcom.google.protobuf.GeneratedMessageV3
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfacecom.google.protobuf.Message- Overrides:
equalsin classcom.google.protobuf.AbstractMessage
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacecom.google.protobuf.Message- Overrides:
hashCodein classcom.google.protobuf.AbstractMessage
-
parseFrom
public static TypedStruct parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static TypedStruct parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static TypedStruct parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static TypedStruct parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static TypedStruct parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static TypedStruct parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static TypedStruct parseFrom(InputStream input) throws IOException
- Throws:
IOException
-
parseFrom
public static TypedStruct parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
parseDelimitedFrom
public static TypedStruct parseDelimitedFrom(InputStream input) throws IOException
- Throws:
IOException
-
parseDelimitedFrom
public static TypedStruct parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
parseFrom
public static TypedStruct parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
- Throws:
IOException
-
parseFrom
public static TypedStruct parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
newBuilderForType
public TypedStruct.Builder newBuilderForType()
- Specified by:
newBuilderForTypein interfacecom.google.protobuf.Message- Specified by:
newBuilderForTypein interfacecom.google.protobuf.MessageLite
-
newBuilder
public static TypedStruct.Builder newBuilder()
-
newBuilder
public static TypedStruct.Builder newBuilder(TypedStruct prototype)
-
toBuilder
public TypedStruct.Builder toBuilder()
- Specified by:
toBuilderin interfacecom.google.protobuf.Message- Specified by:
toBuilderin interfacecom.google.protobuf.MessageLite
-
newBuilderForType
protected TypedStruct.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
- Specified by:
newBuilderForTypein classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstance
public static TypedStruct getDefaultInstance()
-
parser
public static com.google.protobuf.Parser<TypedStruct> parser()
-
getParserForType
public com.google.protobuf.Parser<TypedStruct> getParserForType()
- Specified by:
getParserForTypein interfacecom.google.protobuf.Message- Specified by:
getParserForTypein interfacecom.google.protobuf.MessageLite- Overrides:
getParserForTypein classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstanceForType
public TypedStruct getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
-