From 827694f1e459d70ea14435f328c161dec6aefcfc Mon Sep 17 00:00:00 2001 From: ZhuBo <41532403+Jeremy-boo@users.noreply.github.com> Date: Sat, 15 Apr 2023 21:34:28 +0800 Subject: [PATCH] feat: add fileupload ResourceAttribute. (#430) Co-authored-by: Jeremy-boo --- apis/artifacts/v1alpha1/upload.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apis/artifacts/v1alpha1/upload.go b/apis/artifacts/v1alpha1/upload.go index 9fb8cc88..d24ff026 100644 --- a/apis/artifacts/v1alpha1/upload.go +++ b/apis/artifacts/v1alpha1/upload.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha1 import ( + authv1 "k8s.io/api/authorization/v1" "k8s.io/apimachinery/pkg/runtime" duckv1 "knative.dev/pkg/apis/duck/v1" ) @@ -37,3 +38,13 @@ type FileUploadParams struct { // if type is ContainerImage,The supported fields under properties is `tags` Properties *runtime.RawExtension `json:"properties,omitempty"` } + +// FileUploadResourceAttributes returns a ResourceAttribute object to be used in a filter +func FileUploadResourceAttributes(verb string) authv1.ResourceAttributes { + return authv1.ResourceAttributes{ + Group: GroupVersion.Group, + Version: GroupVersion.Version, + Resource: "artifactuploads", + Verb: verb, + } +}