#[non_exhaustive]pub struct FieldPolicy {
pub selector: String,
pub resource_permission: String,
pub resource_type: String,
/* private fields */
}
Expand description
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.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.selector: String
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”.
resource_permission: String
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”.
resource_type: String
Specifies the resource type for the resource referred to by the field.
Implementations§
Source§impl FieldPolicy
impl FieldPolicy
pub fn new() -> Self
Sourcepub fn set_selector<T: Into<String>>(self, v: T) -> Self
pub fn set_selector<T: Into<String>>(self, v: T) -> Self
Sets the value of selector.
Sourcepub fn set_resource_permission<T: Into<String>>(self, v: T) -> Self
pub fn set_resource_permission<T: Into<String>>(self, v: T) -> Self
Sets the value of resource_permission.
Sourcepub fn set_resource_type<T: Into<String>>(self, v: T) -> Self
pub fn set_resource_type<T: Into<String>>(self, v: T) -> Self
Sets the value of resource_type.
Trait Implementations§
Source§impl Clone for FieldPolicy
impl Clone for FieldPolicy
Source§fn clone(&self) -> FieldPolicy
fn clone(&self) -> FieldPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more