Class FieldPolicy.Builder (2.25.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
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public FieldPolicy.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
FieldPolicy.Builder
Overrides

build()

public FieldPolicy build()
Returns
TypeDescription
FieldPolicy

buildPartial()

public FieldPolicy buildPartial()
Returns
TypeDescription
FieldPolicy

clear()

public FieldPolicy.Builder clear()
Returns
TypeDescription
FieldPolicy.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public FieldPolicy.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
FieldPolicy.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public FieldPolicy.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
FieldPolicy.Builder

This builder for chaining.

clone()

public FieldPolicy.Builder clone()
Returns
TypeDescription
FieldPolicy.Builder
Overrides

getDefaultInstanceForType()

public FieldPolicy getDefaultInstanceForType()
Returns
TypeDescription
FieldPolicy

getDescriptorForType()

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

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(FieldPolicy other)

public FieldPolicy.Builder mergeFrom(FieldPolicy other)
Parameter
NameDescription
otherFieldPolicy
Returns
TypeDescription
FieldPolicy.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public FieldPolicy.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
FieldPolicy.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public FieldPolicy.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
FieldPolicy.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final FieldPolicy.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
FieldPolicy.Builder
Overrides

setField(Descriptors.FieldDescriptor field, Object value)

public FieldPolicy.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
FieldPolicy.Builder
Overrides

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

public FieldPolicy.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
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
NameDescription
valueString

The resourcePermission to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for resourcePermission to set.

Returns
TypeDescription
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
NameDescription
valueString

The resourceType to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for resourceType to set.

Returns
TypeDescription
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
NameDescription
valueString

The selector to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for selector to set.

Returns
TypeDescription
FieldPolicy.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final FieldPolicy.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
FieldPolicy.Builder
Overrides