Documentation ¶
Index ¶
- func GetFieldBehavior(f *desc.FieldDescriptor) stringset.Set
- func GetMethodSignatures(m *desc.MethodDescriptor) [][]string
- func GetOperationInfo(m *desc.MethodDescriptor) *lrpb.OperationInfo
- func GetResource(m *desc.MessageDescriptor) *apb.ResourceDescriptor
- func GetResourceDefinitions(f *desc.FileDescriptor) []*apb.ResourceDescriptor
- func GetResourceReference(f *desc.FieldDescriptor) *apb.ResourceReference
- func GetTypeName(f *desc.FieldDescriptor) string
- func IsCommonProto(f *desc.FileDescriptor) bool
- func ToPlural(s string) string
- type HTTPRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFieldBehavior ¶
func GetFieldBehavior(f *desc.FieldDescriptor) stringset.Set
GetFieldBehavior returns a stringset.Set of FieldBehavior annotations for the given field.
func GetMethodSignatures ¶
func GetMethodSignatures(m *desc.MethodDescriptor) [][]string
GetMethodSignatures returns the `google.api.method_signature` annotations.
func GetOperationInfo ¶
func GetOperationInfo(m *desc.MethodDescriptor) *lrpb.OperationInfo
GetOperationInfo returns the google.longrunning.operation_info annotation.
func GetResource ¶
func GetResource(m *desc.MessageDescriptor) *apb.ResourceDescriptor
GetResource returns the google.api.resource annotation.
func GetResourceDefinitions ¶ added in v1.1.0
func GetResourceDefinitions(f *desc.FileDescriptor) []*apb.ResourceDescriptor
GetResourceDefinitions returns the google.api.resource_definition annotations for a file.
func GetResourceReference ¶
func GetResourceReference(f *desc.FieldDescriptor) *apb.ResourceReference
GetResourceReference returns the google.api.resource_reference annotation.
func GetTypeName ¶
func GetTypeName(f *desc.FieldDescriptor) string
GetTypeName returns the name of the type of the field, as a string, regardless of primitive, message, etc.
TODO: Add support for map types.
func IsCommonProto ¶
func IsCommonProto(f *desc.FileDescriptor) bool
IsCommonProto returns true if a proto file is considered "common".
Types ¶
type HTTPRule ¶
type HTTPRule struct { // The HTTP method. Guaranteed to be in all caps. // This is set to "CUSTOM" if the Custom property is set. Method string // The HTTP URI (the value corresponding to the selected HTTP method). URI string // The `body` value forwarded from the generated proto's HttpRule. Body string // The `response_body` value forwarded from the generated proto's HttpRule. ResponseBody string }
HTTPRule defines a parsed, easier-to-query equivalent to `apb.HttpRule`.
func GetHTTPRules ¶
func GetHTTPRules(m *desc.MethodDescriptor) []*HTTPRule
GetHTTPRules returns a slice of HTTP rules for a given method descriptor.
Note: This returns a slice -- it takes the google.api.http annotation, and then flattens the values in `additional_bindings`. This allows rule authors to simply range over all of the HTTP rules, since the common case is to want to apply the checks to all of them.
func (*HTTPRule) GetPlainURI ¶
GetPlainURI returns the URI with variable segment information removed.
func (*HTTPRule) GetVariables ¶
GetVariables returns the variable segments in a URI as a map.