Class FieldPolicy (2.25.0)

public final class FieldPolicy extends GeneratedMessageV3 implements FieldPolicyOrBuilder

Google API Policy Annotation

This message defines a simple API policy annotation that can be used to annotate API request and response message fields with applicable policies. One field may have multiple applicable policies that must all be satisfied before a request can be processed. This policy annotation is used to generate the overall policy that will be used for automatic runtime policy enforcement and documentation generation.

Protobuf type google.api.FieldPolicy

Static Fields

RESOURCE_PERMISSION_FIELD_NUMBER

public static final int RESOURCE_PERMISSION_FIELD_NUMBER
Field Value
TypeDescription
int

RESOURCE_TYPE_FIELD_NUMBER

public static final int RESOURCE_TYPE_FIELD_NUMBER
Field Value
TypeDescription
int

SELECTOR_FIELD_NUMBER

public static final int SELECTOR_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static FieldPolicy getDefaultInstance()
Returns
TypeDescription
FieldPolicy

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static FieldPolicy.Builder newBuilder()
Returns
TypeDescription
FieldPolicy.Builder

newBuilder(FieldPolicy prototype)

public static FieldPolicy.Builder newBuilder(FieldPolicy prototype)
Parameter
NameDescription
prototypeFieldPolicy
Returns
TypeDescription
FieldPolicy.Builder

parseDelimitedFrom(InputStream input)

public static FieldPolicy parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static FieldPolicy parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static FieldPolicy parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static FieldPolicy parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static FieldPolicy parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static FieldPolicy parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
FieldPolicy
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<FieldPolicy> parser()
Returns
TypeDescription
Parser<FieldPolicy>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getDefaultInstanceForType()

public FieldPolicy getDefaultInstanceForType()
Returns
TypeDescription
FieldPolicy

getParserForType()

public Parser<FieldPolicy> getParserForType()
Returns
TypeDescription
Parser<FieldPolicy>
Overrides

getResourcePermission()

public String getResourcePermission()

Specifies the required permission(s) for the resource referred to by the field. It requires the field contains a valid resource reference, and the request must pass the permission checks to proceed. For example, "resourcemanager.projects.get".

string resource_permission = 2;

Returns
TypeDescription
String

The resourcePermission.

getResourcePermissionBytes()

public ByteString getResourcePermissionBytes()

Specifies the required permission(s) for the resource referred to by the field. It requires the field contains a valid resource reference, and the request must pass the permission checks to proceed. For example, "resourcemanager.projects.get".

string resource_permission = 2;

Returns
TypeDescription
ByteString

The bytes for resourcePermission.

getResourceType()

public String getResourceType()

Specifies the resource type for the resource referred to by the field.

string resource_type = 3;

Returns
TypeDescription
String

The resourceType.

getResourceTypeBytes()

public ByteString getResourceTypeBytes()

Specifies the resource type for the resource referred to by the field.

string resource_type = 3;

Returns
TypeDescription
ByteString

The bytes for resourceType.

getSelector()

public String getSelector()

Selects one or more request or response message fields to apply this FieldPolicy.

When a FieldPolicy is used in proto annotation, the selector must be left as empty. The service config generator will automatically fill the correct value.

When a FieldPolicy is used in service config, the selector must be a comma-separated string with valid request or response field paths, such as "foo.bar" or "foo.bar,foo.baz".

string selector = 1;

Returns
TypeDescription
String

The selector.

getSelectorBytes()

public ByteString getSelectorBytes()

Selects one or more request or response message fields to apply this FieldPolicy.

When a FieldPolicy is used in proto annotation, the selector must be left as empty. The service config generator will automatically fill the correct value.

When a FieldPolicy is used in service config, the selector must be a comma-separated string with valid request or response field paths, such as "foo.bar" or "foo.bar,foo.baz".

string selector = 1;

Returns
TypeDescription
ByteString

The bytes for selector.

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public FieldPolicy.Builder newBuilderForType()
Returns
TypeDescription
FieldPolicy.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected FieldPolicy.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
FieldPolicy.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public FieldPolicy.Builder toBuilder()
Returns
TypeDescription
FieldPolicy.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides
Exceptions
TypeDescription
IOException