Documentation ¶
Index ¶
- Variables
- func EqualCondition(a, b *pbresource.Condition) bool
- func EqualID(a, b *pbresource.ID) bool
- func EqualReference(a, b *pbresource.Reference) bool
- func EqualStatus(a, b *pbresource.Status, compareUpdatedAt bool) bool
- func EqualStatusMap(a, b map[string]*pbresource.Status) bool
- func EqualTenancy(a, b *pbresource.Tenancy) bool
- func EqualType(a, b *pbresource.Type) bool
- func Reference(id *pbresource.ID, section string) *pbresource.Reference
- func ToGVK(resourceType *pbresource.Type) string
- type ACLHooks
- type ErrDataParse
- type ErrInvalidField
- type ErrInvalidListElement
- type ErrInvalidMapKey
- type ErrInvalidMapValue
- type ErrInvalidReferenceType
- type ErrOwnerTenantInvalid
- type ErrOwnerTypeInvalid
- type Registration
- type Registry
- type TypeRegistry
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissing = errors.New("missing required field") ErrEmpty = errors.New("cannot be empty") ErrReferenceTenancyNotEqual = errors.New("resource tenancy and reference tenancy differ") )
var (
TypeV1Tombstone = &pbresource.Type{
Group: "internal",
GroupVersion: "v1",
Kind: "Tombstone",
}
)
Functions ¶
func EqualCondition ¶
func EqualCondition(a, b *pbresource.Condition) bool
EqualCondition compares two conditions for equality without reflection.
func EqualID ¶
func EqualID(a, b *pbresource.ID) bool
EqualType compares two resource IDs for equality without reflection.
func EqualReference ¶
func EqualReference(a, b *pbresource.Reference) bool
EqualReference compares two references for equality without reflection.
func EqualStatus ¶
func EqualStatus(a, b *pbresource.Status, compareUpdatedAt bool) bool
EqualStatus compares two statuses for equality without reflection.
Pass true for compareUpdatedAt to compare the UpdatedAt timestamps, which you generally *don't* want when dirty checking the status in a controller.
func EqualStatusMap ¶
func EqualStatusMap(a, b map[string]*pbresource.Status) bool
EqualStatusMap compares two status maps for equality without reflection.
func EqualTenancy ¶
func EqualTenancy(a, b *pbresource.Tenancy) bool
EqualType compares two resource tenancies for equality without reflection.
func EqualType ¶
func EqualType(a, b *pbresource.Type) bool
EqualType compares two resource types for equality without reflection.
func Reference ¶
func Reference(id *pbresource.ID, section string) *pbresource.Reference
Reference returns a reference to the resource with the given ID.
func ToGVK ¶
func ToGVK(resourceType *pbresource.Type) string
Types ¶
type ACLHooks ¶
type ACLHooks struct { // Read is used to authorize Read RPCs and to filter results in List // RPCs. // // If it is omitted, `operator:read` permission is assumed. Read func(acl.Authorizer, *pbresource.ID) error // Write is used to authorize Write and Delete RPCs. // // If it is omitted, `operator:write` permission is assumed. Write func(acl.Authorizer, *pbresource.ID) error // List is used to authorize List RPCs. // // If it is omitted, we only filter the results using Read. List func(acl.Authorizer, *pbresource.Tenancy) error }
type ErrDataParse ¶
func NewErrDataParse ¶
func NewErrDataParse(msg protoreflect.ProtoMessage, err error) ErrDataParse
func (ErrDataParse) Error ¶
func (err ErrDataParse) Error() string
func (ErrDataParse) Unwrap ¶
func (err ErrDataParse) Unwrap() error
type ErrInvalidField ¶
func (ErrInvalidField) Error ¶
func (err ErrInvalidField) Error() string
func (ErrInvalidField) Unwrap ¶
func (err ErrInvalidField) Unwrap() error
type ErrInvalidListElement ¶
func (ErrInvalidListElement) Error ¶
func (err ErrInvalidListElement) Error() string
func (ErrInvalidListElement) Unwrap ¶
func (err ErrInvalidListElement) Unwrap() error
type ErrInvalidMapKey ¶
func (ErrInvalidMapKey) Error ¶
func (err ErrInvalidMapKey) Error() string
func (ErrInvalidMapKey) Unwrap ¶
func (err ErrInvalidMapKey) Unwrap() error
type ErrInvalidMapValue ¶
func (ErrInvalidMapValue) Error ¶
func (err ErrInvalidMapValue) Error() string
func (ErrInvalidMapValue) Unwrap ¶
func (err ErrInvalidMapValue) Unwrap() error
type ErrInvalidReferenceType ¶
type ErrInvalidReferenceType struct {
AllowedType *pbresource.Type
}
func (ErrInvalidReferenceType) Error ¶
func (err ErrInvalidReferenceType) Error() string
type ErrOwnerTenantInvalid ¶
type ErrOwnerTenantInvalid struct { ResourceType *pbresource.Type ResourceTenancy *pbresource.Tenancy OwnerTenancy *pbresource.Tenancy }
func (ErrOwnerTenantInvalid) Error ¶
func (err ErrOwnerTenantInvalid) Error() string
type ErrOwnerTypeInvalid ¶
type ErrOwnerTypeInvalid struct { ResourceType *pbresource.Type OwnerType *pbresource.Type }
func (ErrOwnerTypeInvalid) Error ¶
func (err ErrOwnerTypeInvalid) Error() string
type Registration ¶
type Registration struct { // Type is the GVK of the resource type. Type *pbresource.Type // Proto is the resource's protobuf message type. Proto proto.Message // ACLs are hooks called to perform authorization on RPCs. ACLs *ACLHooks // Validate is called to structurally validate the resource (e.g. // check for required fields). Validate func(*pbresource.Resource) error // Mutate is called to fill out any autogenerated fields (e.g. UUIDs). Mutate func(*pbresource.Resource) error }
type Registry ¶
type Registry interface { // Register the given resource type and its hooks. Register(reg Registration) // Resolve the given resource type and its hooks. Resolve(typ *pbresource.Type) (reg Registration, ok bool) }
func NewRegistry ¶
func NewRegistry() Registry
type TypeRegistry ¶
type TypeRegistry struct {
// contains filtered or unexported fields
}
Resource type registry
func (*TypeRegistry) Register ¶
func (r *TypeRegistry) Register(registration Registration)
func (*TypeRegistry) Resolve ¶
func (r *TypeRegistry) Resolve(typ *pbresource.Type) (reg Registration, ok bool)
Directories ¶
Path | Synopsis |
---|---|
Package demo includes fake resource types for working on Consul's generic state storage without having to refer to specific features.
|
Package demo includes fake resource types for working on Consul's generic state storage without having to refer to specific features. |