sink

package
v0.0.0-...-60a31f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultFlagName is a default command-line flag name.
	DefaultFlagName = "sink"
	// DefaultFlagShorthand is a default command-line flag shorthand.
	DefaultFlagShorthand = "s"
)
View Source
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.

View Source
var ErrSinkIsInvalid = errors.New("sink has invalid format")

ErrSinkIsInvalid is returned when the sink has invalid format.

View Source
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.

func Usage

func Usage(fname string) string

Usage returns a usage text which can be used to define sink-like flag.

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

func (r *Reference) AsText(currentNamespace string) string

AsText creates a text representation of the resource, and should be used by giving a current namespace.

func (*Reference) GvrAsText

func (r *Reference) GvrAsText() string

GvrAsText returns the

func (*Reference) Resolve

Resolve returns the Destination referred to by the sink. It validates that any object the user is referring to exists.

func (*Reference) String

func (r *Reference) String() string

String creates a text representation of the reference Deprecated: use AsText instead

func (*Reference) Type

func (r *Reference) Type() Type

Type returns the type of the reference.

type Type

type Type int

Type is a type of Reference.

const (
	// TypeURL is a URL version of the sink.
	TypeURL Type = iota
	// TypeReference is a Kuberentes version of the sink.
	TypeReference
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL