Documentation
¶
Index ¶
- func ResolveArtifactLocation(ctx context.Context, repositories artifactrepositories.Interface, ...) (*wfv1.ArtifactLocation, error)
- func ToStatusError(err error, code codes.Code) error
- func ValidateUploadedArtifactKey(namespace, key string) error
- type ListOptions
- func (l ListOptions) WithLimit(limit int) ListOptions
- func (l ListOptions) WithMaxStartedAt(maxStartedAt time.Time) ListOptions
- func (l ListOptions) WithMinStartedAt(minStartedAt time.Time) ListOptions
- func (l ListOptions) WithOffset(offset int) ListOptions
- func (l ListOptions) WithShowRemainingItemCount(showRemainingItemCount bool) ListOptions
- func (l ListOptions) WithStartedAtAscending(ascending bool) ListOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveArtifactLocation ¶
func ResolveArtifactLocation(ctx context.Context, repositories artifactrepositories.Interface, ref *wfv1.ArtifactRepositoryRef, namespace string) (*wfv1.ArtifactLocation, error)
ResolveArtifactLocation resolves the default artifact repository for namespace and returns its location. It returns a nil location (with no error) if no default artifact repository is configured, matching artifactrepositories.Interface.Get.
func ToStatusError ¶
ToStatusError tries to obtain an HTTP error code from the k8s layer or the ArgoError layer; if not, it resorts to a default value of `code`. NOTE: errors of the type from grpc's status are not converted and are returned as is. This is to keep user code as simple as possible. The assumption here is that the error in the lowest layer of the error stack is the most relevant error.
func ValidateUploadedArtifactKey ¶
ValidateUploadedArtifactKey checks that key is exactly the format the upload endpoint generates for namespace: uploads/{namespace}/{uuid}/{filename}. It rejects path traversal, absolute paths, empty segments, and any key outside the upload prefix, since a client-supplied key is otherwise applied to the artifact location without further checks.
This is defense-in-depth, not a proof of ownership: a valid-looking key naming another user's upload under the same namespace still passes.
Types ¶
type ListOptions ¶
type ListOptions struct {
Namespace, Name string
NamePrefix, NameFilter string
NamespaceFilter string
MinStartedAt, MaxStartedAt time.Time
CreatedAfter, FinishedBefore time.Time
LabelRequirements labels.Requirements
Limit, Offset int
ShowRemainingItemCount bool
StartedAtAscending bool
}
func BuildListOptions ¶
func BuildListOptions(options metav1.ListOptions, ns, namePrefix, nameFilter, createdAfter, finishedBefore string) (ListOptions, error)
func (ListOptions) WithLimit ¶
func (l ListOptions) WithLimit(limit int) ListOptions
func (ListOptions) WithMaxStartedAt ¶
func (l ListOptions) WithMaxStartedAt(maxStartedAt time.Time) ListOptions
func (ListOptions) WithMinStartedAt ¶
func (l ListOptions) WithMinStartedAt(minStartedAt time.Time) ListOptions
func (ListOptions) WithOffset ¶
func (l ListOptions) WithOffset(offset int) ListOptions
func (ListOptions) WithShowRemainingItemCount ¶
func (l ListOptions) WithShowRemainingItemCount(showRemainingItemCount bool) ListOptions
func (ListOptions) WithStartedAtAscending ¶
func (l ListOptions) WithStartedAtAscending(ascending bool) ListOptions