Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultFlagName is a default command-line flag name. DefaultFlagName = "sink" // DefaultFlagShorthand is a default command-line flag shorthand. DefaultFlagShorthand = "s" )
var DefaultMappings = withAliasses(map[string]schema.GroupVersionResource{
"kservice": {
Resource: "services",
Group: "serving.knative.dev",
Version: "v1",
},
"broker": {
Resource: "brokers",
Group: "eventing.knative.dev",
Version: "v1",
},
"channel": {
Resource: "channels",
Group: "messaging.knative.dev",
Version: "v1",
},
"service": {
Resource: "services",
Group: "",
Version: "v1",
},
}, defaultMappingAliasses)
DefaultMappings are used to easily map prefixes for sinks to their GroupVersionResources.
var ErrSinkIsInvalid = errors.New("sink has invalid format")
ErrSinkIsInvalid is returned when the sink has invalid format.
var ErrSinkIsRequired = errors.New("sink is required")
ErrSinkIsRequired is returned when no sink is given.
Functions ¶
func ComputeWithDefaultMappings ¶
func ComputeWithDefaultMappings(mappings map[string]schema.GroupVersionResource) map[string]schema.GroupVersionResource
ComputeWithDefaultMappings will compute mapping by including default mappings and mappings provided by the end-user.
Types ¶
type KubeReference ¶
type KubeReference struct { GVR schema.GroupVersionResource Name string Namespace string }
KubeReference represents a Kubernetes resource as given by command-line args.
type Reference ¶
type Reference struct { *KubeReference *apis.URL }
Reference represents either a URL or Kubernetes resource.
func GuessFromDestination ¶
func GuessFromDestination(dest duckv1.Destination) *Reference
GuessFromDestination converts the duckv1.Destination to the Reference by guessing the type by convention. Will return nil, if given empty destination.
func Parse ¶
func Parse(sinkRepr, namespace string, mappings map[string]schema.GroupVersionResource) (*Reference, error)
Parse returns the sink reference of given sink representation, which may refer to URL or to the Kubernetes resource. The namespace given should be the current namespace within the context.
func (*Reference) AsText ¶
AsText creates a text representation of the resource, and should be used by giving a current namespace.
func (*Reference) Resolve ¶
func (r *Reference) Resolve(ctx context.Context, knclient clientdynamic.KnDynamicClient) (*duckv1.Destination, error)
Resolve returns the Destination referred to by the sink. It validates that any object the user is referring to exists.