public final class Context extends GeneratedMessageV3 implements ContextOrBuilder
`Context` defines which contexts an API requests.
Example:
context:
rules:
- selector: "*"
requested:
- google.rpc.context.ProjectContext
- google.rpc.context.OriginContext
The above specifies that all methods in the API request
`google.rpc.context.ProjectContext` and
`google.rpc.context.OriginContext`.
Available context types are defined in package
`google.rpc.context`.
This also provides mechanism to whitelist any protobuf message extension that
can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
“x-goog-ext-<extension_id>-jspb” format. For example, list any service
specific protobuf types that can appear in grpc metadata as follows in your
yaml file:
Example:
context:
rules:
- selector: "google.example.library.v1.LibraryService.CreateBook"
allowed_request_extensions:
- google.foo.v1.NewExtension
allowed_response_extensions:
- google.foo.v1.NewExtension
You can also specify extension ID instead of fully qualified extension name
here.
Protobuf type google.api.Context| Modifier and Type | Class and Description |
|---|---|
static class |
Context.Builder
`Context` defines which contexts an API requests.
|
GeneratedMessageV3.BuilderParent, GeneratedMessageV3.ExtendableBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage,BuilderType extends GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageV3.ExtendableMessage<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.FieldAccessorTable| Modifier and Type | Field and Description |
|---|---|
static int |
RULES_FIELD_NUMBER |
alwaysUseFieldBuilders, unknownFieldsmemoizedSizememoizedHashCode| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static Context |
getDefaultInstance() |
Context |
getDefaultInstanceForType() |
static Descriptors.Descriptor |
getDescriptor() |
Parser<Context> |
getParserForType() |
ContextRule |
getRules(int index)
A list of RPC context rules that apply to individual API methods.
|
int |
getRulesCount()
A list of RPC context rules that apply to individual API methods.
|
java.util.List<ContextRule> |
getRulesList()
A list of RPC context rules that apply to individual API methods.
|
ContextRuleOrBuilder |
getRulesOrBuilder(int index)
A list of RPC context rules that apply to individual API methods.
|
java.util.List<? extends ContextRuleOrBuilder> |
getRulesOrBuilderList()
A list of RPC context rules that apply to individual API methods.
|
int |
getSerializedSize() |
UnknownFieldSet |
getUnknownFields() |
int |
hashCode() |
protected GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static Context.Builder |
newBuilder() |
static Context.Builder |
newBuilder(Context prototype) |
Context.Builder |
newBuilderForType() |
protected Context.Builder |
newBuilderForType(GeneratedMessageV3.BuilderParent parent) |
static Context |
parseDelimitedFrom(java.io.InputStream input) |
static Context |
parseDelimitedFrom(java.io.InputStream input,
ExtensionRegistryLite extensionRegistry) |
static Context |
parseFrom(byte[] data) |
static Context |
parseFrom(byte[] data,
ExtensionRegistryLite extensionRegistry) |
static Context |
parseFrom(java.nio.ByteBuffer data) |
static Context |
parseFrom(java.nio.ByteBuffer data,
ExtensionRegistryLite extensionRegistry) |
static Context |
parseFrom(ByteString data) |
static Context |
parseFrom(ByteString data,
ExtensionRegistryLite extensionRegistry) |
static Context |
parseFrom(CodedInputStream input) |
static Context |
parseFrom(CodedInputStream input,
ExtensionRegistryLite extensionRegistry) |
static Context |
parseFrom(java.io.InputStream input) |
static Context |
parseFrom(java.io.InputStream input,
ExtensionRegistryLite extensionRegistry) |
static Parser<Context> |
parser() |
Context.Builder |
toBuilder() |
void |
writeTo(CodedOutputStream output) |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, 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, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneoftoByteArray, toByteString, writeDelimitedTo, writeTopublic static final int RULES_FIELD_NUMBER
public final UnknownFieldSet getUnknownFields()
getUnknownFields in interface MessageOrBuildergetUnknownFields in class GeneratedMessageV3public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class GeneratedMessageV3public java.util.List<ContextRule> getRulesList()
A list of RPC context rules that apply to individual API methods. **NOTE:** All service configuration rules follow "last one wins" order.
repeated .google.api.ContextRule rules = 1;getRulesList in interface ContextOrBuilderpublic java.util.List<? extends ContextRuleOrBuilder> getRulesOrBuilderList()
A list of RPC context rules that apply to individual API methods. **NOTE:** All service configuration rules follow "last one wins" order.
repeated .google.api.ContextRule rules = 1;getRulesOrBuilderList in interface ContextOrBuilderpublic int getRulesCount()
A list of RPC context rules that apply to individual API methods. **NOTE:** All service configuration rules follow "last one wins" order.
repeated .google.api.ContextRule rules = 1;getRulesCount in interface ContextOrBuilderpublic ContextRule getRules(int index)
A list of RPC context rules that apply to individual API methods. **NOTE:** All service configuration rules follow "last one wins" order.
repeated .google.api.ContextRule rules = 1;getRules in interface ContextOrBuilderpublic ContextRuleOrBuilder getRulesOrBuilder(int index)
A list of RPC context rules that apply to individual API methods. **NOTE:** All service configuration rules follow "last one wins" order.
repeated .google.api.ContextRule rules = 1;getRulesOrBuilder in interface ContextOrBuilderpublic final boolean isInitialized()
isInitialized in interface MessageLiteOrBuilderisInitialized in class GeneratedMessageV3public void writeTo(CodedOutputStream output) throws java.io.IOException
writeTo in interface MessageLitewriteTo in class GeneratedMessageV3java.io.IOExceptionpublic int getSerializedSize()
getSerializedSize in interface MessageLitegetSerializedSize in class GeneratedMessageV3public boolean equals(java.lang.Object obj)
equals in interface Messageequals in class AbstractMessagepublic int hashCode()
hashCode in interface MessagehashCode in class AbstractMessagepublic static Context parseFrom(java.nio.ByteBuffer data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static Context parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static Context parseFrom(ByteString data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static Context parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static Context parseFrom(byte[] data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static Context parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static Context parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Context parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Context parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Context parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Context parseFrom(CodedInputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Context parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic Context.Builder newBuilderForType()
newBuilderForType in interface MessagenewBuilderForType in interface MessageLitepublic static Context.Builder newBuilder()
public static Context.Builder newBuilder(Context prototype)
public Context.Builder toBuilder()
toBuilder in interface MessagetoBuilder in interface MessageLiteprotected Context.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class GeneratedMessageV3public static Context getDefaultInstance()
public Parser<Context> getParserForType()
getParserForType in interface MessagegetParserForType in interface MessageLitegetParserForType in class GeneratedMessageV3public Context getDefaultInstanceForType()
getDefaultInstanceForType in interface MessageLiteOrBuildergetDefaultInstanceForType in interface MessageOrBuilder