Documentation ¶
Overview ¶
Package aipreflect provides primitives to manipulate AIP annotations and descriptors.
Index ¶
- func RangeParentResourcesInPackage(registry *protoregistry.Files, packageName protoreflect.FullName, ...)
- func RangeResourceDescriptorsInFile(file protoreflect.FileDescriptor, ...)
- func RangeResourceDescriptorsInPackage(registry *protoregistry.Files, packageName protoreflect.FullName, ...)
- func ValidateResourceReferences(message proto.Message) error
- type GrammaticalName
- type MethodType
- type ResourceType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RangeParentResourcesInPackage ¶ added in v0.49.0
func RangeParentResourcesInPackage( registry *protoregistry.Files, packageName protoreflect.FullName, pattern string, fn func(parent *annotations.ResourceDescriptor) bool, )
RangeParentResourcesInPackage iterates over all a resource's parent descriptors in a package while fn returns true. The provided registry is used for looking up files in the package. The iteration order is undefined.
func RangeResourceDescriptorsInFile ¶ added in v0.49.0
func RangeResourceDescriptorsInFile( file protoreflect.FileDescriptor, fn func(resource *annotations.ResourceDescriptor) bool, )
RangeResourceDescriptorsInFile iterates over all resource descriptors in a file while fn returns true. The iteration order is undefined.
func RangeResourceDescriptorsInPackage ¶ added in v0.49.0
func RangeResourceDescriptorsInPackage( registry *protoregistry.Files, packageName protoreflect.FullName, fn func(resource *annotations.ResourceDescriptor) bool, )
RangeResourceDescriptorsInPackage iterates over all resource descriptors in a package while fn returns true. The provided registry is used for looking up files in the package. The iteration order is undefined.
func ValidateResourceReferences ¶ added in v0.49.0
ValidateResourceReferences validates the resource reference fields in a message.
Types ¶
type GrammaticalName ¶ added in v0.17.0
type GrammaticalName string // e.g. "userEvents"
GrammaticalName is the grammatical name for the singular or plural form of resource type. Grammatical names must be URL-safe and use lowerCamelCase.
func (GrammaticalName) UpperCamelCase ¶ added in v0.17.0
func (g GrammaticalName) UpperCamelCase() string
UpperCamelCase returns the UpperCamelCase version of the grammatical name, for use in e.g. method names.
func (GrammaticalName) Validate ¶ added in v0.17.0
func (g GrammaticalName) Validate() error
Validate checks that the grammatical name is non-empty, URL-safe, and uses lowerCamelCase.
type MethodType ¶ added in v0.17.0
type MethodType int
MethodType is an AIP method type.
const ( // MethodTypeNone represents no method type. MethodTypeNone MethodType = iota // MethodTypeGet is the method type of the AIP standard Get method. // See: https://google.aip.dev/131 (Standard methods: Get). MethodTypeGet // MethodTypeList is the method type of the AIP standard List method. // See: https://google.aip.dev/132 (Standard methods: List). MethodTypeList // MethodTypeCreate is the method type of the AIP standard Create method. // See: https://google.aip.dev/133 (Standard methods: Create). MethodTypeCreate // MethodTypeUpdate is the method type of the AIP standard Update method. // See: https://google.aip.dev/133 (Standard methods: Update). MethodTypeUpdate // MethodTypeDelete is the method type of the AIP standard Delete method. // See: https://google.aip.dev/135 (Standard methods: Delete). MethodTypeDelete // MethodTypeUndelete is the method type of the AIP Undelete method for soft delete. // See: https://google.aip.dev/164 (Soft delete). MethodTypeUndelete // MethodTypeBatchGet is the method type of the AIP standard BatchGet method. // See: https://google.aip.dev/231 (Batch methods: Get). MethodTypeBatchGet // MethodTypeBatchCreate is the method type of the AIP standard BatchCreate method. // See: https://google.aip.dev/233 (Batch methods: Create). MethodTypeBatchCreate // MethodTypeBatchUpdate is the method type of the AIP standard BatchUpdate method. // See: https://google.aip.dev/234 (Batch methods: Update). MethodTypeBatchUpdate // MethodTypeBatchDelete is the method type of the AIP standard BatchDelete method. // See: https://google.aip.dev/235 (Batch methods: Delete). MethodTypeBatchDelete // MethodTypeSearch is the method type of the custom AIP method for searching a resource collection. // See: https://google.aip.dev/136 (Custom methods). MethodTypeSearch )
func (MethodType) IsPlural ¶ added in v0.17.0
func (s MethodType) IsPlural() bool
IsPlural returns true if the method type relates to a plurality of resources.
func (MethodType) NamePrefix ¶ added in v0.19.0
func (s MethodType) NamePrefix() protoreflect.Name
NamePrefix returns the method type's method name prefix.
func (MethodType) String ¶ added in v0.19.0
func (i MethodType) String() string
type ResourceType ¶
type ResourceType string // e.g. pubsub.googleapis.com/Topic.
ResourceType represents a resource type name.
func (ResourceType) ServiceName ¶ added in v0.49.0
func (n ResourceType) ServiceName() string
ServiceName returns the service name of the resource type name.
func (ResourceType) Type ¶ added in v0.49.0
func (n ResourceType) Type() string
Type returns the type of the resource type name.
func (ResourceType) Validate ¶ added in v0.49.0
func (n ResourceType) Validate() error
Validate checks that the resource type name is syntactically valid.