Class FieldPolicy (2.39.1)

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
Type Description
int

RESOURCE_TYPE_FIELD_NUMBER

public static final int RESOURCE_TYPE_FIELD_NUMBER
Field Value
Type Description
int

SELECTOR_FIELD_NUMBER

public static final int SELECTOR_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static FieldPolicy getDefaultInstance()
Returns
Type Description
FieldPolicy

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static FieldPolicy.Builder newBuilder()
Returns
Type Description
FieldPolicy.Builder

newBuilder(FieldPolicy prototype)

public static FieldPolicy.Builder newBuilder(FieldPolicy prototype)
Parameter
Name Description
prototype FieldPolicy
Returns
Type Description
FieldPolicy.Builder

parseDelimitedFrom(InputStream input)

public static FieldPolicy parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
FieldPolicy
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FieldPolicy
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static FieldPolicy parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
FieldPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FieldPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static FieldPolicy parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
FieldPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FieldPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static FieldPolicy parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
FieldPolicy
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FieldPolicy
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static FieldPolicy parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
FieldPolicy
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FieldPolicy
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static FieldPolicy parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
FieldPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static FieldPolicy parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FieldPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<FieldPolicy> parser()
Returns
Type Description
Parser<FieldPolicy>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getDefaultInstanceForType()

public FieldPolicy getDefaultInstanceForType()
Returns
Type Description
FieldPolicy

getParserForType()

public Parser<FieldPolicy> getParserForType()
Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
String

The resourceType.

getResourceTypeBytes()

public ByteString getResourceTypeBytes()

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

string resource_type = 3;

Returns
Type Description
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
Type Description
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
Type Description
ByteString

The bytes for selector.

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public FieldPolicy.Builder newBuilderForType()
Returns
Type Description
FieldPolicy.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected FieldPolicy.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
FieldPolicy.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public FieldPolicy.Builder toBuilder()
Returns
Type Description
FieldPolicy.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException