Documentation
¶
Index ¶
- Constants
- func AppendGrantReplaced(annos annotations.Annotations, replacedGrantID string) annotations.Annotations
- func AppendGrantsRevoked(annos annotations.Annotations, grants ...*v2.Grant) annotations.Annotations
- func GrantCancelledReasonFromStatus(st *status.Status) (string, bool)
- func IsErrGrantCancelled(err error) (string, bool)
- func NewErrGrantCancelled(reason string) error
- func NewGrant(resource *v2.Resource, entitlementName string, principal GrantPrincipal, ...) *v2.Grant
- func NewGrantID(principal GrantPrincipal, entitlement *v2.Entitlement) string
- func NewGrantIDFromRecord(r *v3.GrantRecord) string
- func NewGrantReplaced(replacedGrantID string) *v2.GrantReplaced
- func NewGrantsRevoked(grants ...*v2.Grant) *v2.GrantsRevoked
- type ErrGrantCancelled
- type GrantOption
- type GrantPrincipal
- type Source
- type Sources
Constants ¶
const ( GrantCancelledErrorReason = "grant_cancelled" GrantCancelledErrorDomain = "github.com/conductorone/baton-sdk" )
const UnknownGrantId string = "🧸_UNKNOWN_GRANT_ID"
Sometimes C1 doesn't have the grant ID, but does have the principal and entitlement.
Variables ¶
This section is empty.
Functions ¶
func AppendGrantReplaced ¶ added in v0.9.12
func AppendGrantReplaced(annos annotations.Annotations, replacedGrantID string) annotations.Annotations
AppendGrantReplaced appends a GrantReplaced annotation to the given annotations slice and returns the updated slice. Convenience wrapper around NewGrantReplaced for the common case where the caller is building a response annotations slice inline.
func AppendGrantsRevoked ¶ added in v0.33.1
func AppendGrantsRevoked(annos annotations.Annotations, grants ...*v2.Grant) annotations.Annotations
AppendGrantsRevoked adds grants to the GrantsRevoked annotation on annos and returns the updated slice. When annos already contains GrantsRevoked, the grants are appended to that message so a later Pick sees one annotation. Otherwise a new GrantsRevoked is appended.
func GrantCancelledReasonFromStatus ¶ added in v0.12.3
GrantCancelledReasonFromStatus returns the connector-supplied reason if status carries the grant-cancelled ErrorInfo detail.
func IsErrGrantCancelled ¶ added in v0.12.3
IsErrGrantCancelled reports whether err is an intentionally declined grant, returning the connector-supplied reason. It matches both the typed error (in-process) and the flattened gRPC status detail (across a transport).
func NewErrGrantCancelled ¶ added in v0.10.0
func NewGrant ¶
func NewGrant(resource *v2.Resource, entitlementName string, principal GrantPrincipal, grantOptions ...GrantOption) *v2.Grant
NewGrant returns a new grant for the given entitlement on the resource for the provided principal resource ID.
func NewGrantID ¶ added in v0.2.84
func NewGrantID(principal GrantPrincipal, entitlement *v2.Entitlement) string
NewGrantID returns the public grant id for a principal on an entitlement. The raw ":"-join is an external-consumer contract: ids must stay byte-identical across SDK versions (C1 carries configuration keyed on them), so this join is deliberately lossy and MUST NOT be used as an internal identity — storage keys derive from the structured entitlement/principal refs instead (see pkg/dotc1z/engine/pebble/identity.go).
func NewGrantIDFromRecord ¶ added in v0.42.5
func NewGrantIDFromRecord(r *v3.GrantRecord) string
NewGrantIDFromRecord returns the public grant id for a stored record: the record's external id when set, otherwise the NewGrantID join of the entitlement id and principal. It returns "" when the external id is empty and the entitlement or principal ref is missing a field.
func NewGrantReplaced ¶ added in v0.9.12
func NewGrantReplaced(replacedGrantID string) *v2.GrantReplaced
NewGrantReplaced returns a GrantReplaced annotation suitable for appending to the annotations slice returned from a Grant provisioning call.
replacedGrantID is the ID of the grant that the new grant atomically replaced. ConductorOne marks it revoked without dispatching a separate Revoke RPC.
Typical use:
annos := annotations.Annotations{}
annos.Append(grant.NewGrantReplaced(currentGrant.GetId()))
return newGrants, annos, nil
func NewGrantsRevoked ¶ added in v0.33.1
func NewGrantsRevoked(grants ...*v2.Grant) *v2.GrantsRevoked
NewGrantsRevoked returns a GrantsRevoked annotation suitable for appending to the annotations slice returned from a Revoke provisioning call.
Types ¶
type ErrGrantCancelled ¶ added in v0.10.0
type ErrGrantCancelled struct {
Reason string
}
ErrGrantCancelled indicates a connector intentionally declined to create a grant.
func (*ErrGrantCancelled) Error ¶ added in v0.10.0
func (e *ErrGrantCancelled) Error() string
func (*ErrGrantCancelled) GRPCStatus ¶ added in v0.12.3
func (e *ErrGrantCancelled) GRPCStatus() *status.Status
GRPCStatus encodes the cancellation as a FailedPrecondition status carrying a typed ErrorInfo detail. The status flattening that the connector gRPC boundary applies to handler errors otherwise discards the Go error type; the detail rides the wire so C1 can recognize an intentional decline rather than treating it as a connector failure.
type GrantOption ¶
func WithAnnotation ¶
func WithAnnotation(msgs ...proto.Message) GrantOption
func WithExternalPrincipalID ¶ added in v0.1.15
func WithExternalPrincipalID(externalID *v2.ExternalId) GrantOption
WithExternalPrincipalID: Deprecated. This field is no longer used.
func WithGrantMetadata ¶ added in v0.1.1
func WithGrantMetadata(metadata map[string]interface{}) GrantOption