Class FieldPolicy.Builder (2.43.0)

public static final class FieldPolicy.Builder extends GeneratedMessageV3.Builder<FieldPolicy.Builder> 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 Methods

getDescriptor()

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public FieldPolicy.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
FieldPolicy.Builder
Overrides

build()

public FieldPolicy build()
Returns
Type Description
FieldPolicy

buildPartial()

public FieldPolicy buildPartial()
Returns
Type Description
FieldPolicy

clear()

public FieldPolicy.Builder clear()
Returns
Type Description
FieldPolicy.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public FieldPolicy.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
FieldPolicy.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public FieldPolicy.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
FieldPolicy.Builder
Overrides

clearResourcePermission()

public FieldPolicy.Builder clearResourcePermission()

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
FieldPolicy.Builder

This builder for chaining.

clearResourceType()

public FieldPolicy.Builder clearResourceType()

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

string resource_type = 3;

Returns
Type Description
FieldPolicy.Builder

This builder for chaining.

clearSelector()

public FieldPolicy.Builder clearSelector()

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
FieldPolicy.Builder

This builder for chaining.

clone()

public FieldPolicy.Builder clone()
Returns
Type Description
FieldPolicy.Builder
Overrides

getDefaultInstanceForType()

public FieldPolicy getDefaultInstanceForType()
Returns
Type Description
FieldPolicy

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
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.

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(FieldPolicy other)

public FieldPolicy.Builder mergeFrom(FieldPolicy other)
Parameter
Name Description
other FieldPolicy
Returns
Type Description
FieldPolicy.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public FieldPolicy.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FieldPolicy.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public FieldPolicy.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
FieldPolicy.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final FieldPolicy.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
FieldPolicy.Builder
Overrides

setField(Descriptors.FieldDescriptor field, Object value)

public FieldPolicy.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
FieldPolicy.Builder
Overrides

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public FieldPolicy.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
FieldPolicy.Builder
Overrides

setResourcePermission(String value)

public FieldPolicy.Builder setResourcePermission(String value)

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;

Parameter
Name Description
value String

The resourcePermission to set.

Returns
Type Description
FieldPolicy.Builder

This builder for chaining.

setResourcePermissionBytes(ByteString value)

public FieldPolicy.Builder setResourcePermissionBytes(ByteString value)

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;

Parameter
Name Description
value ByteString

The bytes for resourcePermission to set.

Returns
Type Description
FieldPolicy.Builder

This builder for chaining.

setResourceType(String value)

public FieldPolicy.Builder setResourceType(String value)

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

string resource_type = 3;

Parameter
Name Description
value String

The resourceType to set.

Returns
Type Description
FieldPolicy.Builder

This builder for chaining.

setResourceTypeBytes(ByteString value)

public FieldPolicy.Builder setResourceTypeBytes(ByteString value)

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

string resource_type = 3;

Parameter
Name Description
value ByteString

The bytes for resourceType to set.

Returns
Type Description
FieldPolicy.Builder

This builder for chaining.

setSelector(String value)

public FieldPolicy.Builder setSelector(String value)

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;

Parameter
Name Description
value String

The selector to set.

Returns
Type Description
FieldPolicy.Builder

This builder for chaining.

setSelectorBytes(ByteString value)

public FieldPolicy.Builder setSelectorBytes(ByteString value)

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;

Parameter
Name Description
value ByteString

The bytes for selector to set.

Returns
Type Description
FieldPolicy.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final FieldPolicy.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
FieldPolicy.Builder
Overrides