diff --git a/app/cli/cmd/casbackend_list.go b/app/cli/cmd/casbackend_list.go index 0b240f581..8d1f40166 100644 --- a/app/cli/cmd/casbackend_list.go +++ b/app/cli/cmd/casbackend_list.go @@ -1,5 +1,5 @@ // -// Copyright 2024 The Chainloop Authors. +// Copyright 2024-2025 The Chainloop Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package cmd import ( "fmt" + "strings" "time" "code.cloudfoundry.org/bytefmt" @@ -56,9 +57,9 @@ func casBackendListTableOutput(backends []*action.CASBackendItem) error { } t := newTableWriter() - header := table.Row{"Name", "Location", "Provider", "Description", "Limits", "Default"} + header := table.Row{"Name", "Location", "Provider", "Description", "Limits", "Default", "Status"} if full { - header = append(header, "Validation Status", "Created At", "Validated At") + header = append(header, "Created At", "Validated At") } t.AppendHeader(header) @@ -68,12 +69,14 @@ func casBackendListTableOutput(backends []*action.CASBackendItem) error { limits = fmt.Sprintf("MaxSize: %s", bytefmt.ByteSize(uint64(b.Limits.MaxBytes))) } - r := table.Row{b.Name, wrap.String(b.Location, 35), b.Provider, wrap.String(b.Description, 35), limits, b.Default} + validationStatus := string(b.ValidationStatus) + if b.ValidationError != nil && *b.ValidationError != "" { + validationStatus = strings.Join([]string{validationStatus, wrap.String(*b.ValidationError, 50)}, "\n") + } + + r := table.Row{b.Name, wrap.String(b.Location, 35), b.Provider, wrap.String(b.Description, 35), limits, b.Default, validationStatus} if full { - r = append(r, b.ValidationStatus, - b.CreatedAt.Format(time.RFC822), - b.ValidatedAt.Format(time.RFC822), - ) + r = append(r, b.CreatedAt.Format(time.RFC822), b.ValidatedAt.Format(time.RFC822)) } t.AppendRow(r) diff --git a/app/cli/internal/action/casbackend_list.go b/app/cli/internal/action/casbackend_list.go index ba2df00e9..85121f48f 100644 --- a/app/cli/internal/action/casbackend_list.go +++ b/app/cli/internal/action/casbackend_list.go @@ -1,5 +1,5 @@ // -// Copyright 2023 The Chainloop Authors. +// Copyright 2023-2025 The Chainloop Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ type CASBackendItem struct { Inline bool `json:"inline"` Limits *CASBackendLimits `json:"limits"` ValidationStatus ValidationStatus `json:"validationStatus"` + ValidationError *string `json:"validationError,omitempty"` CreatedAt *time.Time `json:"createdAt"` ValidatedAt *time.Time `json:"validatedAt"` @@ -102,5 +103,9 @@ func pbCASBackendItemToAction(in *pb.CASBackendItem) *CASBackendItem { b.ValidationStatus = Invalid } + if in.ValidationError != nil { + b.ValidationError = in.ValidationError + } + return b } diff --git a/app/controlplane/api/controlplane/v1/response_messages.pb.go b/app/controlplane/api/controlplane/v1/response_messages.pb.go index 56731993b..d29b0202a 100644 --- a/app/controlplane/api/controlplane/v1/response_messages.pb.go +++ b/app/controlplane/api/controlplane/v1/response_messages.pb.go @@ -1953,6 +1953,8 @@ type CASBackendItem struct { // Is it an inline backend? // inline means that the content is stored in the attestation itself IsInline bool `protobuf:"varint,10,opt,name=is_inline,json=isInline,proto3" json:"is_inline,omitempty"` + // Error message if validation failed + ValidationError *string `protobuf:"bytes,12,opt,name=validation_error,json=validationError,proto3,oneof" json:"validation_error,omitempty"` } func (x *CASBackendItem) Reset() { @@ -2064,6 +2066,13 @@ func (x *CASBackendItem) GetIsInline() bool { return false } +func (x *CASBackendItem) GetValidationError() string { + if x != nil && x.ValidationError != nil { + return *x.ValidationError + } + return "" +} + type APITokenItem struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2938,7 +2947,7 @@ var file_controlplane_v1_response_messages_proto_rawDesc = []byte{ 0x12, 0x2f, 0x0a, 0x2b, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x56, 0x49, 0x4f, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x41, 0x44, 0x56, 0x49, 0x53, 0x4f, 0x52, 0x59, 0x10, - 0x02, 0x22, 0xf5, 0x04, 0x0a, 0x0e, 0x43, 0x41, 0x53, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, + 0x02, 0x22, 0xba, 0x05, 0x0a, 0x0e, 0x43, 0x41, 0x53, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, @@ -2968,7 +2977,10 @@ var file_controlplane_v1_response_messages_proto_rawDesc = []byte{ 0x6e, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x06, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x49, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x1a, 0x25, 0x0a, 0x06, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1b, 0x0a, 0x09, + 0x6e, 0x65, 0x12, 0x2e, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x88, + 0x01, 0x01, 0x1a, 0x25, 0x0a, 0x06, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x6e, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x0a, @@ -2977,96 +2989,97 @@ var file_controlplane_v1_response_messages_proto_rawDesc = []byte{ 0x12, 0x18, 0x0a, 0x14, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, - 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 0x22, 0xdd, 0x03, 0x0a, 0x0c, 0x41, 0x50, - 0x49, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x6f, 0x72, 0x67, - 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x64, - 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x53, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x0c, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xdd, + 0x03, 0x0a, 0x0c, 0x41, 0x50, 0x49, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2b, + 0x0a, 0x11, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x52, 0x0c, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, + 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x72, 0x65, + 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, - 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x72, 0x65, 0x76, 0x6f, + 0x6b, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, + 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x41, 0x74, - 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x12, 0x3c, 0x0a, 0x0c, 0x6c, - 0x61, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6c, - 0x61, 0x73, 0x74, 0x55, 0x73, 0x65, 0x64, 0x41, 0x74, 0x2a, 0xa6, 0x01, 0x0a, 0x09, 0x52, 0x75, - 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x52, 0x55, 0x4e, 0x5f, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, - 0x53, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x4c, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x01, 0x12, - 0x18, 0x0a, 0x14, 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x55, - 0x43, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x55, 0x4e, - 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, - 0x12, 0x16, 0x0a, 0x12, 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, - 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x52, 0x55, 0x4e, 0x5f, - 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44, - 0x10, 0x05, 0x2a, 0xd4, 0x01, 0x0a, 0x0e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, - 0x70, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, - 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, - 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x56, 0x49, - 0x45, 0x57, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, - 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x41, 0x44, - 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, - 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x4f, 0x57, 0x4e, - 0x45, 0x52, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, - 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x4d, 0x45, 0x4d, 0x42, - 0x45, 0x52, 0x10, 0x04, 0x12, 0x23, 0x0a, 0x1f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, - 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x43, 0x4f, 0x4e, 0x54, - 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x10, 0x05, 0x2a, 0x60, 0x0a, 0x0e, 0x41, 0x6c, 0x6c, - 0x6f, 0x77, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x20, 0x0a, 0x1c, 0x41, - 0x4c, 0x4c, 0x4f, 0x57, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x26, 0x0a, - 0x1c, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x4f, - 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x01, 0x1a, - 0x04, 0xa8, 0x45, 0x93, 0x03, 0x1a, 0x04, 0xa0, 0x45, 0xf4, 0x03, 0x2a, 0x6d, 0x0a, 0x12, 0x46, - 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x75, 0x74, 0x68, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x12, 0x24, 0x0a, 0x20, 0x46, 0x45, 0x44, 0x45, 0x52, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x41, - 0x55, 0x54, 0x48, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x2b, 0x0a, 0x21, 0x46, 0x45, 0x44, 0x45, 0x52, - 0x41, 0x54, 0x45, 0x44, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, - 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x01, 0x1a, 0x04, - 0xa8, 0x45, 0x93, 0x03, 0x1a, 0x04, 0xa0, 0x45, 0xf4, 0x03, 0x2a, 0x84, 0x01, 0x0a, 0x19, 0x55, - 0x73, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x6f, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, - 0x68, 0x69, 0x70, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2d, 0x0a, 0x29, 0x55, 0x53, 0x45, 0x52, - 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, - 0x48, 0x49, 0x50, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x32, 0x0a, 0x28, 0x55, 0x53, 0x45, 0x52, 0x5f, - 0x57, 0x49, 0x54, 0x48, 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, - 0x49, 0x50, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x5f, - 0x4f, 0x52, 0x47, 0x10, 0x01, 0x1a, 0x04, 0xa8, 0x45, 0x93, 0x03, 0x1a, 0x04, 0xa0, 0x45, 0xf4, - 0x03, 0x2a, 0x80, 0x01, 0x0a, 0x17, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x4d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x4f, 0x66, 0x4f, 0x72, 0x67, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2c, 0x0a, - 0x28, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, - 0x5f, 0x4f, 0x46, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x31, 0x0a, 0x27, 0x55, - 0x53, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x4f, - 0x46, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, - 0x49, 0x4e, 0x5f, 0x4f, 0x52, 0x47, 0x10, 0x01, 0x1a, 0x04, 0xa8, 0x45, 0x93, 0x03, 0x1a, 0x04, - 0xa0, 0x45, 0xf4, 0x03, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2d, 0x64, 0x65, 0x76, - 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x3b, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, + 0x12, 0x3c, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x73, 0x65, 0x64, 0x41, 0x74, 0x2a, 0xa6, + 0x01, 0x0a, 0x09, 0x52, 0x75, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, + 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x52, 0x55, 0x4e, 0x5f, + 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x4c, 0x49, 0x5a, + 0x45, 0x44, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x55, 0x53, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x12, 0x15, + 0x0a, 0x11, 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x45, 0x44, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x55, 0x53, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x04, 0x12, 0x18, 0x0a, + 0x14, 0x52, 0x55, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x41, 0x4e, 0x43, + 0x45, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x2a, 0xd4, 0x01, 0x0a, 0x0e, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x4d, 0x45, + 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x4d, + 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, + 0x52, 0x47, 0x5f, 0x56, 0x49, 0x45, 0x57, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x4d, + 0x45, 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, + 0x52, 0x47, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, + 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, + 0x47, 0x5f, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x45, 0x4d, + 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x47, + 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x04, 0x12, 0x23, 0x0a, 0x1f, 0x4d, 0x45, 0x4d, + 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x47, + 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x10, 0x05, 0x2a, 0x60, + 0x0a, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x45, + 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x26, 0x0a, 0x1c, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x5f, 0x4c, 0x49, 0x53, 0x54, + 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x5f, 0x4c, 0x49, + 0x53, 0x54, 0x10, 0x01, 0x1a, 0x04, 0xa8, 0x45, 0x93, 0x03, 0x1a, 0x04, 0xa0, 0x45, 0xf4, 0x03, + 0x2a, 0x6d, 0x0a, 0x12, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x75, 0x74, + 0x68, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x24, 0x0a, 0x20, 0x46, 0x45, 0x44, 0x45, 0x52, 0x41, + 0x54, 0x45, 0x44, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x2b, 0x0a, 0x21, + 0x46, 0x45, 0x44, 0x45, 0x52, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x5f, 0x45, + 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x45, + 0x44, 0x10, 0x01, 0x1a, 0x04, 0xa8, 0x45, 0x93, 0x03, 0x1a, 0x04, 0xa0, 0x45, 0xf4, 0x03, 0x2a, + 0x84, 0x01, 0x0a, 0x19, 0x55, 0x73, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x6f, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2d, 0x0a, + 0x29, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x45, + 0x4d, 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x32, 0x0a, 0x28, + 0x55, 0x53, 0x45, 0x52, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x45, 0x4d, + 0x42, 0x45, 0x52, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x4e, 0x4f, + 0x54, 0x5f, 0x49, 0x4e, 0x5f, 0x4f, 0x52, 0x47, 0x10, 0x01, 0x1a, 0x04, 0xa8, 0x45, 0x93, 0x03, + 0x1a, 0x04, 0xa0, 0x45, 0xf4, 0x03, 0x2a, 0x80, 0x01, 0x0a, 0x17, 0x55, 0x73, 0x65, 0x72, 0x4e, + 0x6f, 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x4f, 0x66, 0x4f, 0x72, 0x67, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x12, 0x2c, 0x0a, 0x28, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x4d, + 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x4f, 0x46, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x45, 0x52, 0x52, + 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x31, 0x0a, 0x27, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x4d, 0x45, 0x4d, + 0x42, 0x45, 0x52, 0x5f, 0x4f, 0x46, 0x5f, 0x4f, 0x52, 0x47, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, + 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x5f, 0x4f, 0x52, 0x47, 0x10, 0x01, 0x1a, 0x04, 0xa8, + 0x45, 0x93, 0x03, 0x1a, 0x04, 0xa0, 0x45, 0xf4, 0x03, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, + 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, + 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3460,6 +3473,7 @@ func file_controlplane_v1_response_messages_proto_init() { file_controlplane_v1_response_messages_proto_msgTypes[11].OneofWrappers = []interface{}{ (*WorkflowContractVersionItem_V1)(nil), } + file_controlplane_v1_response_messages_proto_msgTypes[15].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/app/controlplane/api/controlplane/v1/response_messages.proto b/app/controlplane/api/controlplane/v1/response_messages.proto index 6f48fa33f..29de94e80 100644 --- a/app/controlplane/api/controlplane/v1/response_messages.proto +++ b/app/controlplane/api/controlplane/v1/response_messages.proto @@ -292,6 +292,8 @@ message CASBackendItem { // Is it an inline backend? // inline means that the content is stored in the attestation itself bool is_inline = 10; + // Error message if validation failed + optional string validation_error = 12; message Limits { // Max number of bytes allowed to be stored in this backend diff --git a/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts b/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts index 7c15bda07..e006fa365 100644 --- a/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts +++ b/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts @@ -619,6 +619,8 @@ export interface CASBackendItem { * inline means that the content is stored in the attestation itself */ isInline: boolean; + /** Error message if validation failed */ + validationError?: string | undefined; } export enum CASBackendItem_ValidationStatus { @@ -3813,6 +3815,7 @@ function createBaseCASBackendItem(): CASBackendItem { default: false, limits: undefined, isInline: false, + validationError: undefined, }; } @@ -3851,6 +3854,9 @@ export const CASBackendItem = { if (message.isInline === true) { writer.uint32(80).bool(message.isInline); } + if (message.validationError !== undefined) { + writer.uint32(98).string(message.validationError); + } return writer; }, @@ -3938,6 +3944,13 @@ export const CASBackendItem = { message.isInline = reader.bool(); continue; + case 12: + if (tag !== 98) { + break; + } + + message.validationError = reader.string(); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -3962,6 +3975,7 @@ export const CASBackendItem = { default: isSet(object.default) ? Boolean(object.default) : false, limits: isSet(object.limits) ? CASBackendItem_Limits.fromJSON(object.limits) : undefined, isInline: isSet(object.isInline) ? Boolean(object.isInline) : false, + validationError: isSet(object.validationError) ? String(object.validationError) : undefined, }; }, @@ -3980,6 +3994,7 @@ export const CASBackendItem = { message.limits !== undefined && (obj.limits = message.limits ? CASBackendItem_Limits.toJSON(message.limits) : undefined); message.isInline !== undefined && (obj.isInline = message.isInline); + message.validationError !== undefined && (obj.validationError = message.validationError); return obj; }, @@ -4002,6 +4017,7 @@ export const CASBackendItem = { ? CASBackendItem_Limits.fromPartial(object.limits) : undefined; message.isInline = object.isInline ?? false; + message.validationError = object.validationError ?? undefined; return message; }, }; diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.jsonschema.json index 0435bde83..505cfb819 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.jsonschema.json @@ -13,6 +13,10 @@ "^(validated_at)$": { "$ref": "google.protobuf.Timestamp.jsonschema.json" }, + "^(validation_error)$": { + "description": "Error message if validation failed", + "type": "string" + }, "^(validation_status)$": { "anyOf": [ { @@ -68,6 +72,10 @@ "validatedAt": { "$ref": "google.protobuf.Timestamp.jsonschema.json" }, + "validationError": { + "description": "Error message if validation failed", + "type": "string" + }, "validationStatus": { "anyOf": [ { diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.schema.json index d0c93712f..a14a5600b 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.CASBackendItem.schema.json @@ -13,6 +13,10 @@ "^(validatedAt)$": { "$ref": "google.protobuf.Timestamp.schema.json" }, + "^(validationError)$": { + "description": "Error message if validation failed", + "type": "string" + }, "^(validationStatus)$": { "anyOf": [ { @@ -68,6 +72,10 @@ "validated_at": { "$ref": "google.protobuf.Timestamp.schema.json" }, + "validation_error": { + "description": "Error message if validation failed", + "type": "string" + }, "validation_status": { "anyOf": [ { diff --git a/app/controlplane/internal/service/casbackend.go b/app/controlplane/internal/service/casbackend.go index 00da45365..faeb4c10a 100644 --- a/app/controlplane/internal/service/casbackend.go +++ b/app/controlplane/internal/service/casbackend.go @@ -176,5 +176,9 @@ func bizCASBackendToPb(in *biz.CASBackend) *pb.CASBackendItem { r.ValidationStatus = pb.CASBackendItem_VALIDATION_STATUS_INVALID } + if in.ValidationError != nil { + r.ValidationError = in.ValidationError + } + return r } diff --git a/app/controlplane/pkg/auditor/events/casbackend.go b/app/controlplane/pkg/auditor/events/casbackend.go index 892495e81..f6b370301 100644 --- a/app/controlplane/pkg/auditor/events/casbackend.go +++ b/app/controlplane/pkg/auditor/events/casbackend.go @@ -183,6 +183,7 @@ type CASBackendStatusChanged struct { *CASBackendBase PreviousStatus string `json:"previous_status,omitempty"` NewStatus string `json:"new_status,omitempty"` + StatusError string `json:"status_error,omitempty"` IsRecovery bool `json:"is_recovery,omitempty"` } diff --git a/app/controlplane/pkg/biz/casbackend.go b/app/controlplane/pkg/biz/casbackend.go index f8a7f15bf..ca8c3cd5c 100644 --- a/app/controlplane/pkg/biz/casbackend.go +++ b/app/controlplane/pkg/biz/casbackend.go @@ -55,6 +55,7 @@ type CASBackend struct { CreatedAt, ValidatedAt *time.Time OrganizationID uuid.UUID ValidationStatus CASBackendValidationStatus + ValidationError *string // OCI, S3, ... Provider CASBackendProvider // Whether this is the default cas backend for the organization @@ -77,6 +78,8 @@ type CASBackendOpts struct { Location, SecretName, Description string Provider CASBackendProvider Default bool + ValidationStatus CASBackendValidationStatus + ValidationError *string } type CASBackendCreateOpts struct { @@ -98,10 +101,10 @@ type CASBackendRepo interface { FindByIDInOrg(ctx context.Context, OrgID, ID uuid.UUID) (*CASBackend, error) FindByNameInOrg(ctx context.Context, OrgID uuid.UUID, name string) (*CASBackend, error) List(ctx context.Context, orgID uuid.UUID) ([]*CASBackend, error) + UpdateValidationStatus(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus, validationError *string) error // ListBackends returns CAS backends across all organizations // If onlyDefaults is true, only default backends are returned ListBackends(ctx context.Context, onlyDefaults bool) ([]*CASBackend, error) - UpdateValidationStatus(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus) error Create(context.Context, *CASBackendCreateOpts) (*CASBackend, error) Update(context.Context, *CASBackendUpdateOpts) (*CASBackend, error) Delete(ctx context.Context, ID uuid.UUID) error @@ -345,6 +348,8 @@ func (uc *CASBackendUseCase) Update(ctx context.Context, orgID, id, description ID: uuid, CASBackendOpts: &CASBackendOpts{ SecretName: secretName, Default: defaultB, Description: description, OrgID: orgUUID, + ValidationStatus: CASBackendValidationOK, + ValidationError: ToPtr(""), }, }) if err != nil { @@ -530,6 +535,7 @@ func (CASBackendValidationStatus) Values() (kinds []string) { // Validate that the repository is valid and reachable func (uc *CASBackendUseCase) PerformValidation(ctx context.Context, id string) (err error) { validationStatus := CASBackendValidationFailed + var validationError *string backendUUID, err := uuid.Parse(id) if err != nil { @@ -559,16 +565,16 @@ func (uc *CASBackendUseCase) PerformValidation(ctx context.Context, id string) ( return } - // Store previous status for audit logging - previousStatus := backend.ValidationStatus - - // Update the validation status - uc.logger.Infow("msg", "updating validation status", "ID", id, "status", validationStatus) - if err := uc.repo.UpdateValidationStatus(ctx, backendUUID, validationStatus); err != nil { + // Update the validation status and error + uc.logger.Infow("msg", "updating validation status", "ID", id, "status", validationStatus, "error", validationError) + if err := uc.repo.UpdateValidationStatus(ctx, backendUUID, validationStatus, validationError); err != nil { uc.logger.Errorw("msg", "updating validation status", "ID", id, "error", err) return } + // Store previous status for audit logging + previousStatus := backend.ValidationStatus + // Log status change as an audit event if status has changed and auditor is available if uc.auditorUC != nil && previousStatus != validationStatus { uc.logger.Debugw("msg", "status changed, dispatching audit event", @@ -579,6 +585,11 @@ func (uc *CASBackendUseCase) PerformValidation(ctx context.Context, id string) ( // Check if this is a recovery event (going from failed to OK) isRecovery := previousStatus == CASBackendValidationFailed && validationStatus == CASBackendValidationOK + var validationErrorStr string + if validationError != nil { + validationErrorStr = *validationError + } + // Create and send event for the status change uc.auditorUC.Dispatch(ctx, &events.CASBackendStatusChanged{ CASBackendBase: &events.CASBackendBase{ @@ -590,6 +601,7 @@ func (uc *CASBackendUseCase) PerformValidation(ctx context.Context, id string) ( }, PreviousStatus: string(previousStatus), NewStatus: string(validationStatus), + StatusError: validationErrorStr, IsRecovery: isRecovery, }, &backend.OrganizationID) } @@ -598,25 +610,28 @@ func (uc *CASBackendUseCase) PerformValidation(ctx context.Context, id string) ( // 1 - Retrieve the credentials from the external secrets manager var creds any if err := uc.credsRW.ReadCredentials(ctx, backend.SecretName, &creds); err != nil { - uc.logger.Infow("msg", "credentials not found or invalid", "ID", id) + uc.logger.Infow("msg", "credentials not found or invalid", "ID", id, "error", err) return nil } credsJSON, err := json.Marshal(creds) if err != nil { - uc.logger.Infow("msg", "credentials invalid", "ID", id) + uc.logger.Infow("msg", "credentials invalid", "ID", id, "error", err) return nil } // 2 - run validation _, err = provider.ValidateAndExtractCredentials(backend.Location, credsJSON) if err != nil { - uc.logger.Infow("msg", "permissions validation failed", "ID", id) + errMsg := err.Error() + validationError = &errMsg + uc.logger.Infow("msg", "permissions validation failed", "ID", id, "error", err) return nil } // If everything went well, update the validation status to OK validationStatus = CASBackendValidationOK + validationError = nil uc.logger.Infow("msg", "validation OK", "ID", id) return nil diff --git a/app/controlplane/pkg/biz/casbackend_test.go b/app/controlplane/pkg/biz/casbackend_test.go index ccfa97669..77fd5ac90 100644 --- a/app/controlplane/pkg/biz/casbackend_test.go +++ b/app/controlplane/pkg/biz/casbackend_test.go @@ -139,7 +139,7 @@ func (s *casBackendTestSuite) TestPerformValidation() { t.Run("proper provider credentials missing, set validation status => invalid", func(_ *testing.T) { s.repo.On("FindByID", mock.Anything, s.validUUID).Return(validRepo, nil) - s.repo.On("UpdateValidationStatus", mock.Anything, s.validUUID, biz.CASBackendValidationFailed).Return(nil) + s.repo.On("UpdateValidationStatus", mock.Anything, s.validUUID, biz.CASBackendValidationFailed, mock.Anything).Return(nil) s.credsRW.On("ReadCredentials", mock.Anything, mock.Anything, mock.Anything).Return(credentials.ErrNotFound) err := s.useCase.PerformValidation(context.Background(), s.validUUID.String()) @@ -149,7 +149,7 @@ func (s *casBackendTestSuite) TestPerformValidation() { t.Run("invalid credentials, set validation status => invalid", func(_ *testing.T) { s.repo.On("FindByID", mock.Anything, s.validUUID).Return(validRepo, nil) - s.repo.On("UpdateValidationStatus", mock.Anything, s.validUUID, biz.CASBackendValidationFailed).Return(nil) + s.repo.On("UpdateValidationStatus", mock.Anything, s.validUUID, biz.CASBackendValidationFailed, mock.Anything).Return(nil) s.credsRW.On("ReadCredentials", mock.Anything, mock.Anything, mock.Anything).Return(nil) s.backendProvider.On("ValidateAndExtractCredentials", validRepo.Location, mock.Anything).Return(nil, errors.New("invalid credentials")) @@ -160,7 +160,7 @@ func (s *casBackendTestSuite) TestPerformValidation() { t.Run("valid credentials, set validation status => ok", func(_ *testing.T) { s.repo.On("FindByID", mock.Anything, s.validUUID).Return(validRepo, nil) - s.repo.On("UpdateValidationStatus", mock.Anything, s.validUUID, biz.CASBackendValidationOK).Return(nil) + s.repo.On("UpdateValidationStatus", mock.Anything, s.validUUID, biz.CASBackendValidationOK, mock.Anything).Return(nil) s.credsRW.On("ReadCredentials", mock.Anything, mock.Anything, mock.Anything).Return(nil) s.backendProvider.On("ValidateAndExtractCredentials", validRepo.Location, mock.Anything).Return(nil, nil) diff --git a/app/controlplane/pkg/biz/mocks/CASBackendRepo.go b/app/controlplane/pkg/biz/mocks/CASBackendRepo.go index 588287163..5f6eaed9e 100644 --- a/app/controlplane/pkg/biz/mocks/CASBackendRepo.go +++ b/app/controlplane/pkg/biz/mocks/CASBackendRepo.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery v2.53.5. DO NOT EDIT. package mocks @@ -245,6 +245,36 @@ func (_m *CASBackendRepo) List(ctx context.Context, orgID uuid.UUID) ([]*biz.CAS return r0, r1 } +// ListBackends provides a mock function with given fields: ctx, onlyDefaults +func (_m *CASBackendRepo) ListBackends(ctx context.Context, onlyDefaults bool) ([]*biz.CASBackend, error) { + ret := _m.Called(ctx, onlyDefaults) + + if len(ret) == 0 { + panic("no return value specified for ListBackends") + } + + var r0 []*biz.CASBackend + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bool) ([]*biz.CASBackend, error)); ok { + return rf(ctx, onlyDefaults) + } + if rf, ok := ret.Get(0).(func(context.Context, bool) []*biz.CASBackend); ok { + r0 = rf(ctx, onlyDefaults) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.CASBackend) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bool) error); ok { + r1 = rf(ctx, onlyDefaults) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // SoftDelete provides a mock function with given fields: ctx, ID func (_m *CASBackendRepo) SoftDelete(ctx context.Context, ID uuid.UUID) error { ret := _m.Called(ctx, ID) @@ -293,17 +323,17 @@ func (_m *CASBackendRepo) Update(_a0 context.Context, _a1 *biz.CASBackendUpdateO return r0, r1 } -// UpdateValidationStatus provides a mock function with given fields: ctx, ID, status -func (_m *CASBackendRepo) UpdateValidationStatus(ctx context.Context, ID uuid.UUID, status biz.CASBackendValidationStatus) error { - ret := _m.Called(ctx, ID, status) +// UpdateValidationStatus provides a mock function with given fields: ctx, ID, status, validationError +func (_m *CASBackendRepo) UpdateValidationStatus(ctx context.Context, ID uuid.UUID, status biz.CASBackendValidationStatus, validationError *string) error { + ret := _m.Called(ctx, ID, status, validationError) if len(ret) == 0 { panic("no return value specified for UpdateValidationStatus") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, biz.CASBackendValidationStatus) error); ok { - r0 = rf(ctx, ID, status) + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, biz.CASBackendValidationStatus, *string) error); ok { + r0 = rf(ctx, ID, status, validationError) } else { r0 = ret.Error(0) } diff --git a/app/controlplane/pkg/biz/mocks_test.go b/app/controlplane/pkg/biz/mocks_test.go index 459f40397..b93ff9392 100644 --- a/app/controlplane/pkg/biz/mocks_test.go +++ b/app/controlplane/pkg/biz/mocks_test.go @@ -1376,16 +1376,16 @@ func (_c *MockCASBackendRepo_Update_Call) RunAndReturn(run func(context1 context } // UpdateValidationStatus provides a mock function for the type MockCASBackendRepo -func (_mock *MockCASBackendRepo) UpdateValidationStatus(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus) error { - ret := _mock.Called(ctx, ID, status) +func (_mock *MockCASBackendRepo) UpdateValidationStatus(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus, validationError *string) error { + ret := _mock.Called(ctx, ID, status, validationError) if len(ret) == 0 { panic("no return value specified for UpdateValidationStatus") } var r0 error - if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, CASBackendValidationStatus) error); ok { - r0 = returnFunc(ctx, ID, status) + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, CASBackendValidationStatus, *string) error); ok { + r0 = returnFunc(ctx, ID, status, validationError) } else { r0 = ret.Error(0) } @@ -1401,11 +1401,12 @@ type MockCASBackendRepo_UpdateValidationStatus_Call struct { // - ctx context.Context // - ID uuid.UUID // - status CASBackendValidationStatus -func (_e *MockCASBackendRepo_Expecter) UpdateValidationStatus(ctx interface{}, ID interface{}, status interface{}) *MockCASBackendRepo_UpdateValidationStatus_Call { - return &MockCASBackendRepo_UpdateValidationStatus_Call{Call: _e.mock.On("UpdateValidationStatus", ctx, ID, status)} +// - validationError *string +func (_e *MockCASBackendRepo_Expecter) UpdateValidationStatus(ctx interface{}, ID interface{}, status interface{}, validationError interface{}) *MockCASBackendRepo_UpdateValidationStatus_Call { + return &MockCASBackendRepo_UpdateValidationStatus_Call{Call: _e.mock.On("UpdateValidationStatus", ctx, ID, status, validationError)} } -func (_c *MockCASBackendRepo_UpdateValidationStatus_Call) Run(run func(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus)) *MockCASBackendRepo_UpdateValidationStatus_Call { +func (_c *MockCASBackendRepo_UpdateValidationStatus_Call) Run(run func(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus, validationError *string)) *MockCASBackendRepo_UpdateValidationStatus_Call { _c.Call.Run(func(args mock.Arguments) { var arg0 context.Context if args[0] != nil { @@ -1419,10 +1420,15 @@ func (_c *MockCASBackendRepo_UpdateValidationStatus_Call) Run(run func(ctx conte if args[2] != nil { arg2 = args[2].(CASBackendValidationStatus) } + var arg3 *string + if args[3] != nil { + arg3 = args[3].(*string) + } run( arg0, arg1, arg2, + arg3, ) }) return _c @@ -1433,7 +1439,7 @@ func (_c *MockCASBackendRepo_UpdateValidationStatus_Call) Return(err error) *Moc return _c } -func (_c *MockCASBackendRepo_UpdateValidationStatus_Call) RunAndReturn(run func(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus) error) *MockCASBackendRepo_UpdateValidationStatus_Call { +func (_c *MockCASBackendRepo_UpdateValidationStatus_Call) RunAndReturn(run func(ctx context.Context, ID uuid.UUID, status CASBackendValidationStatus, validationError *string) error) *MockCASBackendRepo_UpdateValidationStatus_Call { _c.Call.Return(run) return _c } diff --git a/app/controlplane/pkg/data/casbackend.go b/app/controlplane/pkg/data/casbackend.go index def0ab0c3..2687e2685 100644 --- a/app/controlplane/pkg/data/casbackend.go +++ b/app/controlplane/pkg/data/casbackend.go @@ -158,6 +158,14 @@ func (r *CASBackendRepo) Update(ctx context.Context, opts *biz.CASBackendUpdateO updateChain = updateChain.SetSecretName(opts.SecretName) } + if opts.ValidationStatus != "" { + updateChain = updateChain.SetValidationStatus(opts.ValidationStatus) + } + + if opts.ValidationError != nil { + updateChain = updateChain.SetValidationError(*opts.ValidationError) + } + backend, err = updateChain.Save(ctx) if err != nil { return err @@ -224,12 +232,19 @@ func (r *CASBackendRepo) Delete(ctx context.Context, id uuid.UUID) error { return r.data.DB.CASBackend.DeleteOneID(id).Exec(ctx) } -// UpdateValidationStatus updates the validation status of an OCI repository -func (r *CASBackendRepo) UpdateValidationStatus(ctx context.Context, id uuid.UUID, status biz.CASBackendValidationStatus) error { - return r.data.DB.CASBackend.UpdateOneID(id). +// UpdateValidationStatus updates the validation status of a CAS backend +func (r *CASBackendRepo) UpdateValidationStatus(ctx context.Context, id uuid.UUID, status biz.CASBackendValidationStatus, validationError *string) error { + update := r.data.DB.CASBackend.UpdateOneID(id). SetValidationStatus(status). - SetValidatedAt(time.Now()). - Exec(ctx) + SetValidatedAt(time.Now()) + + if validationError != nil { + update = update.SetValidationError(*validationError) + } else { + update = update.ClearValidationError() + } + + return update.Exec(ctx) } // ListBackends returns CAS backends across all organizations. Only not inline backends are returned @@ -279,6 +294,7 @@ func entCASBackendToBiz(backend *ent.CASBackend) *biz.CASBackend { CreatedAt: toTimePtr(backend.CreatedAt), ValidatedAt: toTimePtr(backend.ValidatedAt), ValidationStatus: backend.ValidationStatus, + ValidationError: toStringPtr(backend.ValidationError), Provider: backend.Provider, Default: backend.Default, Inline: backend.Provider == biz.CASBackendInline, diff --git a/app/controlplane/pkg/data/data.go b/app/controlplane/pkg/data/data.go index 3c1cb560f..653088e75 100644 --- a/app/controlplane/pkg/data/data.go +++ b/app/controlplane/pkg/data/data.go @@ -143,6 +143,13 @@ func toTimePtr(t time.Time) *time.Time { return &t } +func toStringPtr(s string) *string { + if s == "" { + return nil + } + return &s +} + func orgScopedQuery(client *ent.Client, orgID uuid.UUID) *ent.OrganizationQuery { return client.Organization.Query().Where(organization.ID(orgID), organization.DeletedAtIsNil()) } diff --git a/app/controlplane/pkg/data/ent/casbackend.go b/app/controlplane/pkg/data/ent/casbackend.go index 43c841717..cc27b1c56 100644 --- a/app/controlplane/pkg/data/ent/casbackend.go +++ b/app/controlplane/pkg/data/ent/casbackend.go @@ -34,6 +34,8 @@ type CASBackend struct { CreatedAt time.Time `json:"created_at,omitempty"` // ValidationStatus holds the value of the "validation_status" field. ValidationStatus biz.CASBackendValidationStatus `json:"validation_status,omitempty"` + // ValidationError holds the value of the "validation_error" field. + ValidationError string `json:"validation_error,omitempty"` // ValidatedAt holds the value of the "validated_at" field. ValidatedAt time.Time `json:"validated_at,omitempty"` // Default holds the value of the "default" field. @@ -91,7 +93,7 @@ func (*CASBackend) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullBool) case casbackend.FieldMaxBlobSizeBytes: values[i] = new(sql.NullInt64) - case casbackend.FieldLocation, casbackend.FieldName, casbackend.FieldProvider, casbackend.FieldDescription, casbackend.FieldSecretName, casbackend.FieldValidationStatus: + case casbackend.FieldLocation, casbackend.FieldName, casbackend.FieldProvider, casbackend.FieldDescription, casbackend.FieldSecretName, casbackend.FieldValidationStatus, casbackend.FieldValidationError: values[i] = new(sql.NullString) case casbackend.FieldCreatedAt, casbackend.FieldValidatedAt, casbackend.FieldDeletedAt: values[i] = new(sql.NullTime) @@ -162,6 +164,12 @@ func (cb *CASBackend) assignValues(columns []string, values []any) error { } else if value.Valid { cb.ValidationStatus = biz.CASBackendValidationStatus(value.String) } + case casbackend.FieldValidationError: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field validation_error", values[i]) + } else if value.Valid { + cb.ValidationError = value.String + } case casbackend.FieldValidatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field validated_at", values[i]) @@ -266,6 +274,9 @@ func (cb *CASBackend) String() string { builder.WriteString("validation_status=") builder.WriteString(fmt.Sprintf("%v", cb.ValidationStatus)) builder.WriteString(", ") + builder.WriteString("validation_error=") + builder.WriteString(cb.ValidationError) + builder.WriteString(", ") builder.WriteString("validated_at=") builder.WriteString(cb.ValidatedAt.Format(time.ANSIC)) builder.WriteString(", ") diff --git a/app/controlplane/pkg/data/ent/casbackend/casbackend.go b/app/controlplane/pkg/data/ent/casbackend/casbackend.go index ad6013b4d..34c6b0615 100644 --- a/app/controlplane/pkg/data/ent/casbackend/casbackend.go +++ b/app/controlplane/pkg/data/ent/casbackend/casbackend.go @@ -31,6 +31,8 @@ const ( FieldCreatedAt = "created_at" // FieldValidationStatus holds the string denoting the validation_status field in the database. FieldValidationStatus = "validation_status" + // FieldValidationError holds the string denoting the validation_error field in the database. + FieldValidationError = "validation_error" // FieldValidatedAt holds the string denoting the validated_at field in the database. FieldValidatedAt = "validated_at" // FieldDefault holds the string denoting the default field in the database. @@ -71,6 +73,7 @@ var Columns = []string{ FieldSecretName, FieldCreatedAt, FieldValidationStatus, + FieldValidationError, FieldValidatedAt, FieldDefault, FieldDeletedAt, @@ -183,6 +186,11 @@ func ByValidationStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldValidationStatus, opts...).ToFunc() } +// ByValidationError orders the results by the validation_error field. +func ByValidationError(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldValidationError, opts...).ToFunc() +} + // ByValidatedAt orders the results by the validated_at field. func ByValidatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldValidatedAt, opts...).ToFunc() diff --git a/app/controlplane/pkg/data/ent/casbackend/where.go b/app/controlplane/pkg/data/ent/casbackend/where.go index f7a3b2842..ced44f0d3 100644 --- a/app/controlplane/pkg/data/ent/casbackend/where.go +++ b/app/controlplane/pkg/data/ent/casbackend/where.go @@ -82,6 +82,11 @@ func CreatedAt(v time.Time) predicate.CASBackend { return predicate.CASBackend(sql.FieldEQ(FieldCreatedAt, v)) } +// ValidationError applies equality check predicate on the "validation_error" field. It's identical to ValidationErrorEQ. +func ValidationError(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldEQ(FieldValidationError, v)) +} + // ValidatedAt applies equality check predicate on the "validated_at" field. It's identical to ValidatedAtEQ. func ValidatedAt(v time.Time) predicate.CASBackend { return predicate.CASBackend(sql.FieldEQ(FieldValidatedAt, v)) @@ -477,6 +482,81 @@ func ValidationStatusNotIn(vs ...biz.CASBackendValidationStatus) predicate.CASBa return predicate.CASBackend(sql.FieldNotIn(FieldValidationStatus, v...)) } +// ValidationErrorEQ applies the EQ predicate on the "validation_error" field. +func ValidationErrorEQ(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldEQ(FieldValidationError, v)) +} + +// ValidationErrorNEQ applies the NEQ predicate on the "validation_error" field. +func ValidationErrorNEQ(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldNEQ(FieldValidationError, v)) +} + +// ValidationErrorIn applies the In predicate on the "validation_error" field. +func ValidationErrorIn(vs ...string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldIn(FieldValidationError, vs...)) +} + +// ValidationErrorNotIn applies the NotIn predicate on the "validation_error" field. +func ValidationErrorNotIn(vs ...string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldNotIn(FieldValidationError, vs...)) +} + +// ValidationErrorGT applies the GT predicate on the "validation_error" field. +func ValidationErrorGT(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldGT(FieldValidationError, v)) +} + +// ValidationErrorGTE applies the GTE predicate on the "validation_error" field. +func ValidationErrorGTE(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldGTE(FieldValidationError, v)) +} + +// ValidationErrorLT applies the LT predicate on the "validation_error" field. +func ValidationErrorLT(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldLT(FieldValidationError, v)) +} + +// ValidationErrorLTE applies the LTE predicate on the "validation_error" field. +func ValidationErrorLTE(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldLTE(FieldValidationError, v)) +} + +// ValidationErrorContains applies the Contains predicate on the "validation_error" field. +func ValidationErrorContains(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldContains(FieldValidationError, v)) +} + +// ValidationErrorHasPrefix applies the HasPrefix predicate on the "validation_error" field. +func ValidationErrorHasPrefix(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldHasPrefix(FieldValidationError, v)) +} + +// ValidationErrorHasSuffix applies the HasSuffix predicate on the "validation_error" field. +func ValidationErrorHasSuffix(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldHasSuffix(FieldValidationError, v)) +} + +// ValidationErrorIsNil applies the IsNil predicate on the "validation_error" field. +func ValidationErrorIsNil() predicate.CASBackend { + return predicate.CASBackend(sql.FieldIsNull(FieldValidationError)) +} + +// ValidationErrorNotNil applies the NotNil predicate on the "validation_error" field. +func ValidationErrorNotNil() predicate.CASBackend { + return predicate.CASBackend(sql.FieldNotNull(FieldValidationError)) +} + +// ValidationErrorEqualFold applies the EqualFold predicate on the "validation_error" field. +func ValidationErrorEqualFold(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldEqualFold(FieldValidationError, v)) +} + +// ValidationErrorContainsFold applies the ContainsFold predicate on the "validation_error" field. +func ValidationErrorContainsFold(v string) predicate.CASBackend { + return predicate.CASBackend(sql.FieldContainsFold(FieldValidationError, v)) +} + // ValidatedAtEQ applies the EQ predicate on the "validated_at" field. func ValidatedAtEQ(v time.Time) predicate.CASBackend { return predicate.CASBackend(sql.FieldEQ(FieldValidatedAt, v)) diff --git a/app/controlplane/pkg/data/ent/casbackend_create.go b/app/controlplane/pkg/data/ent/casbackend_create.go index ca40942a4..bede863a2 100644 --- a/app/controlplane/pkg/data/ent/casbackend_create.go +++ b/app/controlplane/pkg/data/ent/casbackend_create.go @@ -93,6 +93,20 @@ func (cbc *CASBackendCreate) SetNillableValidationStatus(bbvs *biz.CASBackendVal return cbc } +// SetValidationError sets the "validation_error" field. +func (cbc *CASBackendCreate) SetValidationError(s string) *CASBackendCreate { + cbc.mutation.SetValidationError(s) + return cbc +} + +// SetNillableValidationError sets the "validation_error" field if the given value is not nil. +func (cbc *CASBackendCreate) SetNillableValidationError(s *string) *CASBackendCreate { + if s != nil { + cbc.SetValidationError(*s) + } + return cbc +} + // SetValidatedAt sets the "validated_at" field. func (cbc *CASBackendCreate) SetValidatedAt(t time.Time) *CASBackendCreate { cbc.mutation.SetValidatedAt(t) @@ -365,6 +379,10 @@ func (cbc *CASBackendCreate) createSpec() (*CASBackend, *sqlgraph.CreateSpec) { _spec.SetField(casbackend.FieldValidationStatus, field.TypeEnum, value) _node.ValidationStatus = value } + if value, ok := cbc.mutation.ValidationError(); ok { + _spec.SetField(casbackend.FieldValidationError, field.TypeString, value) + _node.ValidationError = value + } if value, ok := cbc.mutation.ValidatedAt(); ok { _spec.SetField(casbackend.FieldValidatedAt, field.TypeTime, value) _node.ValidatedAt = value @@ -512,6 +530,24 @@ func (u *CASBackendUpsert) UpdateValidationStatus() *CASBackendUpsert { return u } +// SetValidationError sets the "validation_error" field. +func (u *CASBackendUpsert) SetValidationError(v string) *CASBackendUpsert { + u.Set(casbackend.FieldValidationError, v) + return u +} + +// UpdateValidationError sets the "validation_error" field to the value that was provided on create. +func (u *CASBackendUpsert) UpdateValidationError() *CASBackendUpsert { + u.SetExcluded(casbackend.FieldValidationError) + return u +} + +// ClearValidationError clears the value of the "validation_error" field. +func (u *CASBackendUpsert) ClearValidationError() *CASBackendUpsert { + u.SetNull(casbackend.FieldValidationError) + return u +} + // SetValidatedAt sets the "validated_at" field. func (u *CASBackendUpsert) SetValidatedAt(v time.Time) *CASBackendUpsert { u.Set(casbackend.FieldValidatedAt, v) @@ -684,6 +720,27 @@ func (u *CASBackendUpsertOne) UpdateValidationStatus() *CASBackendUpsertOne { }) } +// SetValidationError sets the "validation_error" field. +func (u *CASBackendUpsertOne) SetValidationError(v string) *CASBackendUpsertOne { + return u.Update(func(s *CASBackendUpsert) { + s.SetValidationError(v) + }) +} + +// UpdateValidationError sets the "validation_error" field to the value that was provided on create. +func (u *CASBackendUpsertOne) UpdateValidationError() *CASBackendUpsertOne { + return u.Update(func(s *CASBackendUpsert) { + s.UpdateValidationError() + }) +} + +// ClearValidationError clears the value of the "validation_error" field. +func (u *CASBackendUpsertOne) ClearValidationError() *CASBackendUpsertOne { + return u.Update(func(s *CASBackendUpsert) { + s.ClearValidationError() + }) +} + // SetValidatedAt sets the "validated_at" field. func (u *CASBackendUpsertOne) SetValidatedAt(v time.Time) *CASBackendUpsertOne { return u.Update(func(s *CASBackendUpsert) { @@ -1033,6 +1090,27 @@ func (u *CASBackendUpsertBulk) UpdateValidationStatus() *CASBackendUpsertBulk { }) } +// SetValidationError sets the "validation_error" field. +func (u *CASBackendUpsertBulk) SetValidationError(v string) *CASBackendUpsertBulk { + return u.Update(func(s *CASBackendUpsert) { + s.SetValidationError(v) + }) +} + +// UpdateValidationError sets the "validation_error" field to the value that was provided on create. +func (u *CASBackendUpsertBulk) UpdateValidationError() *CASBackendUpsertBulk { + return u.Update(func(s *CASBackendUpsert) { + s.UpdateValidationError() + }) +} + +// ClearValidationError clears the value of the "validation_error" field. +func (u *CASBackendUpsertBulk) ClearValidationError() *CASBackendUpsertBulk { + return u.Update(func(s *CASBackendUpsert) { + s.ClearValidationError() + }) +} + // SetValidatedAt sets the "validated_at" field. func (u *CASBackendUpsertBulk) SetValidatedAt(v time.Time) *CASBackendUpsertBulk { return u.Update(func(s *CASBackendUpsert) { diff --git a/app/controlplane/pkg/data/ent/casbackend_update.go b/app/controlplane/pkg/data/ent/casbackend_update.go index e6b4d3b38..ee8d1c37b 100644 --- a/app/controlplane/pkg/data/ent/casbackend_update.go +++ b/app/controlplane/pkg/data/ent/casbackend_update.go @@ -81,6 +81,26 @@ func (cbu *CASBackendUpdate) SetNillableValidationStatus(bbvs *biz.CASBackendVal return cbu } +// SetValidationError sets the "validation_error" field. +func (cbu *CASBackendUpdate) SetValidationError(s string) *CASBackendUpdate { + cbu.mutation.SetValidationError(s) + return cbu +} + +// SetNillableValidationError sets the "validation_error" field if the given value is not nil. +func (cbu *CASBackendUpdate) SetNillableValidationError(s *string) *CASBackendUpdate { + if s != nil { + cbu.SetValidationError(*s) + } + return cbu +} + +// ClearValidationError clears the value of the "validation_error" field. +func (cbu *CASBackendUpdate) ClearValidationError() *CASBackendUpdate { + cbu.mutation.ClearValidationError() + return cbu +} + // SetValidatedAt sets the "validated_at" field. func (cbu *CASBackendUpdate) SetValidatedAt(t time.Time) *CASBackendUpdate { cbu.mutation.SetValidatedAt(t) @@ -278,6 +298,12 @@ func (cbu *CASBackendUpdate) sqlSave(ctx context.Context) (n int, err error) { if value, ok := cbu.mutation.ValidationStatus(); ok { _spec.SetField(casbackend.FieldValidationStatus, field.TypeEnum, value) } + if value, ok := cbu.mutation.ValidationError(); ok { + _spec.SetField(casbackend.FieldValidationError, field.TypeString, value) + } + if cbu.mutation.ValidationErrorCleared() { + _spec.ClearField(casbackend.FieldValidationError, field.TypeString) + } if value, ok := cbu.mutation.ValidatedAt(); ok { _spec.SetField(casbackend.FieldValidatedAt, field.TypeTime, value) } @@ -440,6 +466,26 @@ func (cbuo *CASBackendUpdateOne) SetNillableValidationStatus(bbvs *biz.CASBacken return cbuo } +// SetValidationError sets the "validation_error" field. +func (cbuo *CASBackendUpdateOne) SetValidationError(s string) *CASBackendUpdateOne { + cbuo.mutation.SetValidationError(s) + return cbuo +} + +// SetNillableValidationError sets the "validation_error" field if the given value is not nil. +func (cbuo *CASBackendUpdateOne) SetNillableValidationError(s *string) *CASBackendUpdateOne { + if s != nil { + cbuo.SetValidationError(*s) + } + return cbuo +} + +// ClearValidationError clears the value of the "validation_error" field. +func (cbuo *CASBackendUpdateOne) ClearValidationError() *CASBackendUpdateOne { + cbuo.mutation.ClearValidationError() + return cbuo +} + // SetValidatedAt sets the "validated_at" field. func (cbuo *CASBackendUpdateOne) SetValidatedAt(t time.Time) *CASBackendUpdateOne { cbuo.mutation.SetValidatedAt(t) @@ -667,6 +713,12 @@ func (cbuo *CASBackendUpdateOne) sqlSave(ctx context.Context) (_node *CASBackend if value, ok := cbuo.mutation.ValidationStatus(); ok { _spec.SetField(casbackend.FieldValidationStatus, field.TypeEnum, value) } + if value, ok := cbuo.mutation.ValidationError(); ok { + _spec.SetField(casbackend.FieldValidationError, field.TypeString, value) + } + if cbuo.mutation.ValidationErrorCleared() { + _spec.ClearField(casbackend.FieldValidationError, field.TypeString) + } if value, ok := cbuo.mutation.ValidatedAt(); ok { _spec.SetField(casbackend.FieldValidatedAt, field.TypeTime, value) } diff --git a/app/controlplane/pkg/data/ent/migrate/migrations/20250902095134.sql b/app/controlplane/pkg/data/ent/migrate/migrations/20250902095134.sql new file mode 100644 index 000000000..cf77ec31b --- /dev/null +++ b/app/controlplane/pkg/data/ent/migrate/migrations/20250902095134.sql @@ -0,0 +1,2 @@ +-- Modify "cas_backends" table +ALTER TABLE "cas_backends" ADD COLUMN "validation_error" character varying NULL; diff --git a/app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum b/app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum index 390d98adb..bf17318b1 100644 --- a/app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum +++ b/app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:juodzbTCyqY5JwQbyFWEtF5UeTSUEiafH2wny+s2E2c= +h1:aDLoUdZ7A/XcJmyQg4Qia82eQ6BN67RfTrTVh+uZoHo= 20230706165452_init-schema.sql h1:VvqbNFEQnCvUVyj2iDYVQQxDM0+sSXqocpt/5H64k8M= 20230710111950-cas-backend.sql h1:A8iBuSzZIEbdsv9ipBtscZQuaBp3V5/VMw7eZH6GX+g= 20230712094107-cas-backends-workflow-runs.sql h1:a5rzxpVGyd56nLRSsKrmCFc9sebg65RWzLghKHh5xvI= @@ -111,3 +111,4 @@ h1:juodzbTCyqY5JwQbyFWEtF5UeTSUEiafH2wny+s2E2c= 20250820090420.sql h1:xmJucXMVs+JyXWmyHu7Rv31hhgtAONDTv1mT/sTaJKk= 20250820171503.sql h1:SsLD5Tf6woeFE7/FLI9XVQpnEgx4CJ9d7fWwNOZvOrA= 20250827093032.sql h1:K+XDWewSLoGBM+zjkBMag3mMQFFQyoQ9SePzfRxC694= +20250902095134.sql h1:e1DP8uYf/CX7RCiCF+E2/TKXiFUR6EUQBPy0wh5Xxl0= diff --git a/app/controlplane/pkg/data/ent/migrate/schema.go b/app/controlplane/pkg/data/ent/migrate/schema.go index 121e3ec9e..8a0d04f64 100644 --- a/app/controlplane/pkg/data/ent/migrate/schema.go +++ b/app/controlplane/pkg/data/ent/migrate/schema.go @@ -90,6 +90,7 @@ var ( {Name: "secret_name", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"}, {Name: "validation_status", Type: field.TypeEnum, Enums: []string{"OK", "Invalid"}, Default: "OK"}, + {Name: "validation_error", Type: field.TypeString, Nullable: true}, {Name: "validated_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"}, {Name: "default", Type: field.TypeBool, Default: false}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, @@ -105,7 +106,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "cas_backends_organizations_cas_backends", - Columns: []*schema.Column{CasBackendsColumns[13]}, + Columns: []*schema.Column{CasBackendsColumns[14]}, RefColumns: []*schema.Column{OrganizationsColumns[0]}, OnDelete: schema.Cascade, }, @@ -114,7 +115,7 @@ var ( { Name: "casbackend_name_organization_cas_backends", Unique: true, - Columns: []*schema.Column{CasBackendsColumns[2], CasBackendsColumns[13]}, + Columns: []*schema.Column{CasBackendsColumns[2], CasBackendsColumns[14]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at IS NULL", }, diff --git a/app/controlplane/pkg/data/ent/mutation.go b/app/controlplane/pkg/data/ent/mutation.go index 504143e54..49187ebed 100644 --- a/app/controlplane/pkg/data/ent/mutation.go +++ b/app/controlplane/pkg/data/ent/mutation.go @@ -1485,6 +1485,7 @@ type CASBackendMutation struct { secret_name *string created_at *time.Time validation_status *biz.CASBackendValidationStatus + validation_error *string validated_at *time.Time _default *bool deleted_at *time.Time @@ -1871,6 +1872,55 @@ func (m *CASBackendMutation) ResetValidationStatus() { m.validation_status = nil } +// SetValidationError sets the "validation_error" field. +func (m *CASBackendMutation) SetValidationError(s string) { + m.validation_error = &s +} + +// ValidationError returns the value of the "validation_error" field in the mutation. +func (m *CASBackendMutation) ValidationError() (r string, exists bool) { + v := m.validation_error + if v == nil { + return + } + return *v, true +} + +// OldValidationError returns the old "validation_error" field's value of the CASBackend entity. +// If the CASBackend object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *CASBackendMutation) OldValidationError(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldValidationError is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldValidationError requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldValidationError: %w", err) + } + return oldValue.ValidationError, nil +} + +// ClearValidationError clears the value of the "validation_error" field. +func (m *CASBackendMutation) ClearValidationError() { + m.validation_error = nil + m.clearedFields[casbackend.FieldValidationError] = struct{}{} +} + +// ValidationErrorCleared returns if the "validation_error" field was cleared in this mutation. +func (m *CASBackendMutation) ValidationErrorCleared() bool { + _, ok := m.clearedFields[casbackend.FieldValidationError] + return ok +} + +// ResetValidationError resets all changes to the "validation_error" field. +func (m *CASBackendMutation) ResetValidationError() { + m.validation_error = nil + delete(m.clearedFields, casbackend.FieldValidationError) +} + // SetValidatedAt sets the "validated_at" field. func (m *CASBackendMutation) SetValidatedAt(t time.Time) { m.validated_at = &t @@ -2211,7 +2261,7 @@ func (m *CASBackendMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *CASBackendMutation) Fields() []string { - fields := make([]string, 0, 12) + fields := make([]string, 0, 13) if m.location != nil { fields = append(fields, casbackend.FieldLocation) } @@ -2233,6 +2283,9 @@ func (m *CASBackendMutation) Fields() []string { if m.validation_status != nil { fields = append(fields, casbackend.FieldValidationStatus) } + if m.validation_error != nil { + fields = append(fields, casbackend.FieldValidationError) + } if m.validated_at != nil { fields = append(fields, casbackend.FieldValidatedAt) } @@ -2270,6 +2323,8 @@ func (m *CASBackendMutation) Field(name string) (ent.Value, bool) { return m.CreatedAt() case casbackend.FieldValidationStatus: return m.ValidationStatus() + case casbackend.FieldValidationError: + return m.ValidationError() case casbackend.FieldValidatedAt: return m.ValidatedAt() case casbackend.FieldDefault: @@ -2303,6 +2358,8 @@ func (m *CASBackendMutation) OldField(ctx context.Context, name string) (ent.Val return m.OldCreatedAt(ctx) case casbackend.FieldValidationStatus: return m.OldValidationStatus(ctx) + case casbackend.FieldValidationError: + return m.OldValidationError(ctx) case casbackend.FieldValidatedAt: return m.OldValidatedAt(ctx) case casbackend.FieldDefault: @@ -2371,6 +2428,13 @@ func (m *CASBackendMutation) SetField(name string, value ent.Value) error { } m.SetValidationStatus(v) return nil + case casbackend.FieldValidationError: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetValidationError(v) + return nil case casbackend.FieldValidatedAt: v, ok := value.(time.Time) if !ok { @@ -2454,6 +2518,9 @@ func (m *CASBackendMutation) ClearedFields() []string { if m.FieldCleared(casbackend.FieldDescription) { fields = append(fields, casbackend.FieldDescription) } + if m.FieldCleared(casbackend.FieldValidationError) { + fields = append(fields, casbackend.FieldValidationError) + } if m.FieldCleared(casbackend.FieldDeletedAt) { fields = append(fields, casbackend.FieldDeletedAt) } @@ -2474,6 +2541,9 @@ func (m *CASBackendMutation) ClearField(name string) error { case casbackend.FieldDescription: m.ClearDescription() return nil + case casbackend.FieldValidationError: + m.ClearValidationError() + return nil case casbackend.FieldDeletedAt: m.ClearDeletedAt() return nil @@ -2506,6 +2576,9 @@ func (m *CASBackendMutation) ResetField(name string) error { case casbackend.FieldValidationStatus: m.ResetValidationStatus() return nil + case casbackend.FieldValidationError: + m.ResetValidationError() + return nil case casbackend.FieldValidatedAt: m.ResetValidatedAt() return nil diff --git a/app/controlplane/pkg/data/ent/runtime.go b/app/controlplane/pkg/data/ent/runtime.go index 6e849ab0d..1653b9e08 100644 --- a/app/controlplane/pkg/data/ent/runtime.go +++ b/app/controlplane/pkg/data/ent/runtime.go @@ -64,15 +64,15 @@ func init() { // casbackend.DefaultCreatedAt holds the default value on creation for the created_at field. casbackend.DefaultCreatedAt = casbackendDescCreatedAt.Default.(func() time.Time) // casbackendDescValidatedAt is the schema descriptor for validated_at field. - casbackendDescValidatedAt := casbackendFields[8].Descriptor() + casbackendDescValidatedAt := casbackendFields[9].Descriptor() // casbackend.DefaultValidatedAt holds the default value on creation for the validated_at field. casbackend.DefaultValidatedAt = casbackendDescValidatedAt.Default.(func() time.Time) // casbackendDescDefault is the schema descriptor for default field. - casbackendDescDefault := casbackendFields[9].Descriptor() + casbackendDescDefault := casbackendFields[10].Descriptor() // casbackend.DefaultDefault holds the default value on creation for the default field. casbackend.DefaultDefault = casbackendDescDefault.Default.(bool) // casbackendDescFallback is the schema descriptor for fallback field. - casbackendDescFallback := casbackendFields[11].Descriptor() + casbackendDescFallback := casbackendFields[12].Descriptor() // casbackend.DefaultFallback holds the default value on creation for the fallback field. casbackend.DefaultFallback = casbackendDescFallback.Default.(bool) // casbackendDescID is the schema descriptor for id field. diff --git a/app/controlplane/pkg/data/ent/schema-viz.html b/app/controlplane/pkg/data/ent/schema-viz.html index 4f263d233..59a20de09 100644 --- a/app/controlplane/pkg/data/ent/schema-viz.html +++ b/app/controlplane/pkg/data/ent/schema-viz.html @@ -70,7 +70,7 @@ } - const entGraph = JSON.parse("{\"nodes\":[{\"id\":\"APIToken\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"expires_at\",\"type\":\"time.Time\"},{\"name\":\"revoked_at\",\"type\":\"time.Time\"},{\"name\":\"last_used_at\",\"type\":\"time.Time\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"Attestation\",\"fields\":[{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"bundle\",\"type\":\"[]byte\"},{\"name\":\"workflowrun_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"CASBackend\",\"fields\":[{\"name\":\"location\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"provider\",\"type\":\"biz.CASBackendProvider\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"secret_name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"validation_status\",\"type\":\"biz.CASBackendValidationStatus\"},{\"name\":\"validated_at\",\"type\":\"time.Time\"},{\"name\":\"default\",\"type\":\"bool\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"fallback\",\"type\":\"bool\"},{\"name\":\"max_blob_size_bytes\",\"type\":\"int64\"}]},{\"id\":\"CASMapping\",\"fields\":[{\"name\":\"digest\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"workflow_run_id\",\"type\":\"uuid.UUID\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"Group\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"member_count\",\"type\":\"int\"}]},{\"id\":\"GroupMembership\",\"fields\":[{\"name\":\"group_id\",\"type\":\"uuid.UUID\"},{\"name\":\"user_id\",\"type\":\"uuid.UUID\"},{\"name\":\"maintainer\",\"type\":\"bool\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"}]},{\"id\":\"Integration\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"kind\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"secret_name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"configuration\",\"type\":\"[]byte\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"}]},{\"id\":\"IntegrationAttachment\",\"fields\":[{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"configuration\",\"type\":\"[]byte\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"workflow_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"Membership\",\"fields\":[{\"name\":\"current\",\"type\":\"bool\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"role\",\"type\":\"authz.Role\"},{\"name\":\"membership_type\",\"type\":\"authz.MembershipType\"},{\"name\":\"member_id\",\"type\":\"uuid.UUID\"},{\"name\":\"resource_type\",\"type\":\"authz.ResourceType\"},{\"name\":\"resource_id\",\"type\":\"uuid.UUID\"},{\"name\":\"parent_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"OrgInvitation\",\"fields\":[{\"name\":\"receiver_email\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"biz.OrgInvitationStatus\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"sender_id\",\"type\":\"uuid.UUID\"},{\"name\":\"role\",\"type\":\"authz.Role\"},{\"name\":\"context\",\"type\":\"biz.OrgInvitationContext\"}]},{\"id\":\"Organization\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"block_on_policy_violation\",\"type\":\"bool\"},{\"name\":\"policies_allowed_hostnames\",\"type\":\"[]string\"}]},{\"id\":\"Project\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"ProjectVersion\",\"fields\":[{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"},{\"name\":\"prerelease\",\"type\":\"bool\"},{\"name\":\"workflow_run_count\",\"type\":\"int\"},{\"name\":\"released_at\",\"type\":\"time.Time\"},{\"name\":\"latest\",\"type\":\"bool\"}]},{\"id\":\"Referrer\",\"fields\":[{\"name\":\"digest\",\"type\":\"string\"},{\"name\":\"kind\",\"type\":\"string\"},{\"name\":\"downloadable\",\"type\":\"bool\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"metadata\",\"type\":\"map[string]string\"},{\"name\":\"annotations\",\"type\":\"map[string]string\"}]},{\"id\":\"RobotAccount\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"revoked_at\",\"type\":\"time.Time\"}]},{\"id\":\"User\",\"fields\":[{\"name\":\"email\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"has_restricted_access\",\"type\":\"bool\"},{\"name\":\"first_name\",\"type\":\"string\"},{\"name\":\"last_name\",\"type\":\"string\"}]},{\"id\":\"Workflow\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"project_old\",\"type\":\"string\"},{\"name\":\"team\",\"type\":\"string\"},{\"name\":\"runs_count\",\"type\":\"int\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"public\",\"type\":\"bool\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"},{\"name\":\"latest_run\",\"type\":\"uuid.UUID\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"metadata\",\"type\":\"map[string]interface {}\"}]},{\"id\":\"WorkflowContract\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"scoped_resource_type\",\"type\":\"biz.ContractScope\"},{\"name\":\"scoped_resource_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"WorkflowContractVersion\",\"fields\":[{\"name\":\"body\",\"type\":\"[]byte\"},{\"name\":\"raw_body\",\"type\":\"[]byte\"},{\"name\":\"raw_body_format\",\"type\":\"unmarshal.RawFormat\"},{\"name\":\"revision\",\"type\":\"int\"},{\"name\":\"created_at\",\"type\":\"time.Time\"}]},{\"id\":\"WorkflowRun\",\"fields\":[{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"finished_at\",\"type\":\"time.Time\"},{\"name\":\"state\",\"type\":\"biz.WorkflowRunStatus\"},{\"name\":\"reason\",\"type\":\"string\"},{\"name\":\"run_url\",\"type\":\"string\"},{\"name\":\"runner_type\",\"type\":\"string\"},{\"name\":\"attestation\",\"type\":\"*dsse.Envelope\"},{\"name\":\"attestation_digest\",\"type\":\"string\"},{\"name\":\"attestation_state\",\"type\":\"[]byte\"},{\"name\":\"contract_revision_used\",\"type\":\"int\"},{\"name\":\"contract_revision_latest\",\"type\":\"int\"},{\"name\":\"version_id\",\"type\":\"uuid.UUID\"},{\"name\":\"workflow_id\",\"type\":\"uuid.UUID\"}]}],\"edges\":[{\"from\":\"APIToken\",\"to\":\"Project\",\"label\":\"project\"},{\"from\":\"CASMapping\",\"to\":\"CASBackend\",\"label\":\"cas_backend\"},{\"from\":\"CASMapping\",\"to\":\"Organization\",\"label\":\"organization\"},{\"from\":\"CASMapping\",\"to\":\"Project\",\"label\":\"project\"},{\"from\":\"GroupMembership\",\"to\":\"Group\",\"label\":\"group\"},{\"from\":\"GroupMembership\",\"to\":\"User\",\"label\":\"user\"},{\"from\":\"IntegrationAttachment\",\"to\":\"Integration\",\"label\":\"integration\"},{\"from\":\"IntegrationAttachment\",\"to\":\"Workflow\",\"label\":\"workflow\"},{\"from\":\"Membership\",\"to\":\"Membership\",\"label\":\"children\"},{\"from\":\"OrgInvitation\",\"to\":\"Organization\",\"label\":\"organization\"},{\"from\":\"OrgInvitation\",\"to\":\"User\",\"label\":\"sender\"},{\"from\":\"Organization\",\"to\":\"Membership\",\"label\":\"memberships\"},{\"from\":\"Organization\",\"to\":\"WorkflowContract\",\"label\":\"workflow_contracts\"},{\"from\":\"Organization\",\"to\":\"Workflow\",\"label\":\"workflows\"},{\"from\":\"Organization\",\"to\":\"CASBackend\",\"label\":\"cas_backends\"},{\"from\":\"Organization\",\"to\":\"Integration\",\"label\":\"integrations\"},{\"from\":\"Organization\",\"to\":\"APIToken\",\"label\":\"api_tokens\"},{\"from\":\"Organization\",\"to\":\"Project\",\"label\":\"projects\"},{\"from\":\"Organization\",\"to\":\"Group\",\"label\":\"groups\"},{\"from\":\"Project\",\"to\":\"Workflow\",\"label\":\"workflows\"},{\"from\":\"Project\",\"to\":\"ProjectVersion\",\"label\":\"versions\"},{\"from\":\"ProjectVersion\",\"to\":\"WorkflowRun\",\"label\":\"runs\"},{\"from\":\"Referrer\",\"to\":\"Referrer\",\"label\":\"references\"},{\"from\":\"Referrer\",\"to\":\"Workflow\",\"label\":\"workflows\"},{\"from\":\"User\",\"to\":\"Membership\",\"label\":\"memberships\"},{\"from\":\"Workflow\",\"to\":\"RobotAccount\",\"label\":\"robotaccounts\"},{\"from\":\"Workflow\",\"to\":\"WorkflowRun\",\"label\":\"workflowruns\"},{\"from\":\"Workflow\",\"to\":\"WorkflowContract\",\"label\":\"contract\"},{\"from\":\"Workflow\",\"to\":\"WorkflowRun\",\"label\":\"latest_workflow_run\"},{\"from\":\"WorkflowContract\",\"to\":\"WorkflowContractVersion\",\"label\":\"versions\"},{\"from\":\"WorkflowRun\",\"to\":\"WorkflowContractVersion\",\"label\":\"contract_version\"},{\"from\":\"WorkflowRun\",\"to\":\"CASBackend\",\"label\":\"cas_backends\"},{\"from\":\"WorkflowRun\",\"to\":\"Attestation\",\"label\":\"attestation_bundle\"}]}"); + const entGraph = JSON.parse("{\"nodes\":[{\"id\":\"APIToken\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"expires_at\",\"type\":\"time.Time\"},{\"name\":\"revoked_at\",\"type\":\"time.Time\"},{\"name\":\"last_used_at\",\"type\":\"time.Time\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"Attestation\",\"fields\":[{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"bundle\",\"type\":\"[]byte\"},{\"name\":\"workflowrun_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"CASBackend\",\"fields\":[{\"name\":\"location\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"provider\",\"type\":\"biz.CASBackendProvider\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"secret_name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"validation_status\",\"type\":\"biz.CASBackendValidationStatus\"},{\"name\":\"validation_error\",\"type\":\"string\"},{\"name\":\"validated_at\",\"type\":\"time.Time\"},{\"name\":\"default\",\"type\":\"bool\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"fallback\",\"type\":\"bool\"},{\"name\":\"max_blob_size_bytes\",\"type\":\"int64\"}]},{\"id\":\"CASMapping\",\"fields\":[{\"name\":\"digest\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"workflow_run_id\",\"type\":\"uuid.UUID\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"Group\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"member_count\",\"type\":\"int\"}]},{\"id\":\"GroupMembership\",\"fields\":[{\"name\":\"group_id\",\"type\":\"uuid.UUID\"},{\"name\":\"user_id\",\"type\":\"uuid.UUID\"},{\"name\":\"maintainer\",\"type\":\"bool\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"}]},{\"id\":\"Integration\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"kind\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"secret_name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"configuration\",\"type\":\"[]byte\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"}]},{\"id\":\"IntegrationAttachment\",\"fields\":[{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"configuration\",\"type\":\"[]byte\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"workflow_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"Membership\",\"fields\":[{\"name\":\"current\",\"type\":\"bool\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"role\",\"type\":\"authz.Role\"},{\"name\":\"membership_type\",\"type\":\"authz.MembershipType\"},{\"name\":\"member_id\",\"type\":\"uuid.UUID\"},{\"name\":\"resource_type\",\"type\":\"authz.ResourceType\"},{\"name\":\"resource_id\",\"type\":\"uuid.UUID\"},{\"name\":\"parent_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"OrgInvitation\",\"fields\":[{\"name\":\"receiver_email\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"biz.OrgInvitationStatus\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"sender_id\",\"type\":\"uuid.UUID\"},{\"name\":\"role\",\"type\":\"authz.Role\"},{\"name\":\"context\",\"type\":\"biz.OrgInvitationContext\"}]},{\"id\":\"Organization\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"block_on_policy_violation\",\"type\":\"bool\"},{\"name\":\"policies_allowed_hostnames\",\"type\":\"[]string\"}]},{\"id\":\"Project\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"ProjectVersion\",\"fields\":[{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"},{\"name\":\"prerelease\",\"type\":\"bool\"},{\"name\":\"workflow_run_count\",\"type\":\"int\"},{\"name\":\"released_at\",\"type\":\"time.Time\"},{\"name\":\"latest\",\"type\":\"bool\"}]},{\"id\":\"Referrer\",\"fields\":[{\"name\":\"digest\",\"type\":\"string\"},{\"name\":\"kind\",\"type\":\"string\"},{\"name\":\"downloadable\",\"type\":\"bool\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"metadata\",\"type\":\"map[string]string\"},{\"name\":\"annotations\",\"type\":\"map[string]string\"}]},{\"id\":\"RobotAccount\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"revoked_at\",\"type\":\"time.Time\"}]},{\"id\":\"User\",\"fields\":[{\"name\":\"email\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"has_restricted_access\",\"type\":\"bool\"},{\"name\":\"first_name\",\"type\":\"string\"},{\"name\":\"last_name\",\"type\":\"string\"}]},{\"id\":\"Workflow\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"project_old\",\"type\":\"string\"},{\"name\":\"team\",\"type\":\"string\"},{\"name\":\"runs_count\",\"type\":\"int\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"public\",\"type\":\"bool\"},{\"name\":\"organization_id\",\"type\":\"uuid.UUID\"},{\"name\":\"project_id\",\"type\":\"uuid.UUID\"},{\"name\":\"latest_run\",\"type\":\"uuid.UUID\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"metadata\",\"type\":\"map[string]interface {}\"}]},{\"id\":\"WorkflowContract\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"updated_at\",\"type\":\"time.Time\"},{\"name\":\"deleted_at\",\"type\":\"time.Time\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"scoped_resource_type\",\"type\":\"biz.ContractScope\"},{\"name\":\"scoped_resource_id\",\"type\":\"uuid.UUID\"}]},{\"id\":\"WorkflowContractVersion\",\"fields\":[{\"name\":\"body\",\"type\":\"[]byte\"},{\"name\":\"raw_body\",\"type\":\"[]byte\"},{\"name\":\"raw_body_format\",\"type\":\"unmarshal.RawFormat\"},{\"name\":\"revision\",\"type\":\"int\"},{\"name\":\"created_at\",\"type\":\"time.Time\"}]},{\"id\":\"WorkflowRun\",\"fields\":[{\"name\":\"created_at\",\"type\":\"time.Time\"},{\"name\":\"finished_at\",\"type\":\"time.Time\"},{\"name\":\"state\",\"type\":\"biz.WorkflowRunStatus\"},{\"name\":\"reason\",\"type\":\"string\"},{\"name\":\"run_url\",\"type\":\"string\"},{\"name\":\"runner_type\",\"type\":\"string\"},{\"name\":\"attestation\",\"type\":\"*dsse.Envelope\"},{\"name\":\"attestation_digest\",\"type\":\"string\"},{\"name\":\"attestation_state\",\"type\":\"[]byte\"},{\"name\":\"contract_revision_used\",\"type\":\"int\"},{\"name\":\"contract_revision_latest\",\"type\":\"int\"},{\"name\":\"version_id\",\"type\":\"uuid.UUID\"},{\"name\":\"workflow_id\",\"type\":\"uuid.UUID\"}]}],\"edges\":[{\"from\":\"APIToken\",\"to\":\"Project\",\"label\":\"project\"},{\"from\":\"CASMapping\",\"to\":\"CASBackend\",\"label\":\"cas_backend\"},{\"from\":\"CASMapping\",\"to\":\"Organization\",\"label\":\"organization\"},{\"from\":\"CASMapping\",\"to\":\"Project\",\"label\":\"project\"},{\"from\":\"GroupMembership\",\"to\":\"Group\",\"label\":\"group\"},{\"from\":\"GroupMembership\",\"to\":\"User\",\"label\":\"user\"},{\"from\":\"IntegrationAttachment\",\"to\":\"Integration\",\"label\":\"integration\"},{\"from\":\"IntegrationAttachment\",\"to\":\"Workflow\",\"label\":\"workflow\"},{\"from\":\"Membership\",\"to\":\"Membership\",\"label\":\"children\"},{\"from\":\"OrgInvitation\",\"to\":\"Organization\",\"label\":\"organization\"},{\"from\":\"OrgInvitation\",\"to\":\"User\",\"label\":\"sender\"},{\"from\":\"Organization\",\"to\":\"Membership\",\"label\":\"memberships\"},{\"from\":\"Organization\",\"to\":\"WorkflowContract\",\"label\":\"workflow_contracts\"},{\"from\":\"Organization\",\"to\":\"Workflow\",\"label\":\"workflows\"},{\"from\":\"Organization\",\"to\":\"CASBackend\",\"label\":\"cas_backends\"},{\"from\":\"Organization\",\"to\":\"Integration\",\"label\":\"integrations\"},{\"from\":\"Organization\",\"to\":\"APIToken\",\"label\":\"api_tokens\"},{\"from\":\"Organization\",\"to\":\"Project\",\"label\":\"projects\"},{\"from\":\"Organization\",\"to\":\"Group\",\"label\":\"groups\"},{\"from\":\"Project\",\"to\":\"Workflow\",\"label\":\"workflows\"},{\"from\":\"Project\",\"to\":\"ProjectVersion\",\"label\":\"versions\"},{\"from\":\"ProjectVersion\",\"to\":\"WorkflowRun\",\"label\":\"runs\"},{\"from\":\"Referrer\",\"to\":\"Referrer\",\"label\":\"references\"},{\"from\":\"Referrer\",\"to\":\"Workflow\",\"label\":\"workflows\"},{\"from\":\"User\",\"to\":\"Membership\",\"label\":\"memberships\"},{\"from\":\"Workflow\",\"to\":\"RobotAccount\",\"label\":\"robotaccounts\"},{\"from\":\"Workflow\",\"to\":\"WorkflowRun\",\"label\":\"workflowruns\"},{\"from\":\"Workflow\",\"to\":\"WorkflowContract\",\"label\":\"contract\"},{\"from\":\"Workflow\",\"to\":\"WorkflowRun\",\"label\":\"latest_workflow_run\"},{\"from\":\"WorkflowContract\",\"to\":\"WorkflowContractVersion\",\"label\":\"versions\"},{\"from\":\"WorkflowRun\",\"to\":\"WorkflowContractVersion\",\"label\":\"contract_version\"},{\"from\":\"WorkflowRun\",\"to\":\"CASBackend\",\"label\":\"cas_backends\"},{\"from\":\"WorkflowRun\",\"to\":\"Attestation\",\"label\":\"attestation_bundle\"}]}"); const nodes = new vis.DataSet((entGraph.nodes || []).map(n => ({ id: n.id, diff --git a/app/controlplane/pkg/data/ent/schema/casbackend.go b/app/controlplane/pkg/data/ent/schema/casbackend.go index 8829c6b8c..78b84e81e 100644 --- a/app/controlplane/pkg/data/ent/schema/casbackend.go +++ b/app/controlplane/pkg/data/ent/schema/casbackend.go @@ -49,6 +49,7 @@ func (CASBackend) Fields() []ent.Field { field.Enum("validation_status"). GoType(biz.CASBackendValidationStatus("")). Default(string(biz.CASBackendValidationOK)), + field.String("validation_error").Optional(), field.Time("validated_at").Default(time.Now). Annotations(&entsql.Annotation{Default: "CURRENT_TIMESTAMP"}), field.Bool("default").Default(false),